|
Post by verklagekasper on Jan 26, 2016 11:26:46 GMT 1
Hi, I have a couple of questions about SDK3 that don't seem addressed by documentation.
1) In SDK2, one could check whether an input pin was static: "pin->getStatus() == ST_STATIC". In SDK3, the equivalent to this appears to be "pin.isStreaming()". However, non-audio pins, eg. integer pins, don't have a "isStreaming()" method. How do I find out whether a non-audio pin is static in SDK3?
2) Does getBlockPosition() in SDK3 have the same meaning as SampleClock() in SDK2? If not, what is the equivalent of SampleClock() in SDK3?
3) For that matter, using SDK3, "pin.getValue()" sometimes causes an assertion error requesting a concrete sample time as argument. Is using "pin.getValue(getBlockPosition())" the proper fix for this?
4) In SDK2, there was only SET_PROCESS_FUNC. But in SDK3, there are two versions, SET_PROCESS and SET_PROCESS2. The former is appears to be for functions receiving buffer_offset + sampletime as arguments, the latter for functions receiving only sampletime as argument. Well, buffer_offset seems no longer needed in SDK3 to me, so why the two versions of SET_PROCESS? Right now I'm using SET_PROCESS2, but maybe I'm missing something and should be using SET_PROCESS?
Cheers, Burkhard
|
|
|
Post by Rob on Jan 26, 2016 19:30:16 GMT 1
Hi, I posted your questions over at the SDK usergroup, hope he or others can reply. Am not sure I can answer your questions, I normally do more GUI side. groups.yahoo.com/neo/groups/syntheditsdk/conversations/messages/83584: I think that's because the SDK3 codebase is changing still, Jeff keeps some older classes for backwards compitibility or so.
|
|
|
Post by verklagekasper on Jan 26, 2016 20:11:47 GMT 1
Thank you!
|
|
|
Post by verklagekasper on Jan 27, 2016 11:02:31 GMT 1
Well after some analysis and debugging, I think I found at least the answer to 1), and some more: - In SDK3, a non-audio pin being static is equivalent to "!pin.isUpdated()".
- Don't bother calling isUpdated() in your subprocess method. The only time isUpdated() can ever return "true" is during calls of onSetPins().
- The behavior of the Gate pin of the Midi to CV module has changed in SDK3/SE1.2. Even though it's an audio pin, pinGate.isStreaming() will always return false. So don't bother using isStreaming() on a pin connected with Gate, use pinGate.isUpdated() within onSetPins() instead.
|
|
|
Post by Rob on Jan 27, 2016 20:03:38 GMT 1
Ah right, should have known about the pin.isUpdated() function. Thanks for reporting this.
|
|
|
Post by jeffmcclintock on Jan 27, 2016 20:56:37 GMT 1
As you noticed. pin.isUpdated() is how you identify a pin update on a non-audio pin.
2) Does getBlockPosition() in SDK3 have the same meaning as SampleClock() in SDK2? If not, what is the equivalent of SampleClock() in SDK3? In a DAW, audio is process in 'blocks' (aka buffers or batches) getBlockPosistion() tells you how far though processing the current block your module is. e.g. if the buffer size is 100 samples, a block position of 50 indicates you have processed half the samples in the block and have 50 remaining. Note: SampleClock() returned the *absolute* position since the module started processing audio. e.g. if you are half-way through processing the 3rd block of 100 samples, sampleclock = 250, blockPosision=50
No. Some overloaded member functions, like setPins(), have access to the block position. So you don't need to specify a block position when accessing the 'current' value of an audio input pin. However your processing function (usually called subProcess() ) is required to process a 'block' of say 100 samples. So this function might for example take 100 successive input samples and transform them to 100 successive output samples. In this situation the SDK can't assume the 'current' block-position represents the current time, because the SDK does not know how many of those 100 samples you might have processed already. In this case you need to provide the block position to indicate e.g. "i have processed 50 samples of this block, so tell me the input signal at block-position = 50. Hope that makes sense.
In SDK I am experimenting with a tweak that simplifies the process function by removing the need to pass block-position explicitly (block-position is still available via the getBlockPosition() method if you need it). This results in cleaner, smaller code.
The old way is Modules inherit from a base class called MpBase, and have a subProcess with two arguments like:
void subProcess( int bufferOffset, int sampleFrames );
In this case use macro SET_PROCESS.
The new way is your module inherits from MpBase2, and has a simplified subProcess like:
void subProcess(int sampleFrames);
in which case you use SET_PROCESS2. (these are a few other small differences too. You can check the example code to see both flavours of module).
Hope that helps, jeff
Read more: syntheditforum.boards.net/post/new/305#ixzz3yTWKur2k
|
|
|
Post by verklagekasper on Jan 27, 2016 22:47:48 GMT 1
Hi Jeff, thank you very much for your elaborate answer! It helps me understand the concepts of SDK3 better. Cheers, Burkhard
|
|
Andrew
Developer
Posts: 110
Posts: 110
|
Post by Andrew on Aug 8, 2016 17:29:18 GMT 1
- The behavior of the Gate pin of the Midi to CV module has changed in SDK3/SE1.2. Even though it's an audio pin, pinGate.isStreaming() will always return false. So don't bother using isStreaming() on a pin connected with Gate, use pinGate.isUpdated() within onSetPins() instead.
Yeah, learnt that the hard way.
|
|