-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-09-14 12:41, Alexandros Drymonitis wrote:
A different block size? Can you do that? I think Pd is always, and has always, used 64 frames per block.
Audio settings?
hmm, those are different beasts. Pd's default blocksize and the only blocksize allowed for on a patch containing [dac~] or [adc~] is DEFDACBLKSIZE which has always been 64 (in all known incarnations of Pd-vanilla and Pd-extended; and as far as i can remember, which is *quite* some time)
even if you change the audio block size via the audio settings, within the patch you still have a default blocksize of 64 samples.
sp[0]->s_n is supposed to be pointing at the defined block size, or am I wrong?
it points to the block-size of the signal as used in your (sub)patch. that means: this is the actually used block-size when your object is fed audio (or generates audio). it is the same for all inputs and outputs of your object, since the object's iolet~s are all in the same (sub)patch, and you can only change the blocksize per (sub)patch. this can be achieved with [block~] or [switch~].
this is also the answer i would have given to your initial question:
if you need to access the block-size and samplerate within your external, use sp[0]->s_sr /* samplerate */ and sp[0]->s_n /* blocksize */
unfortunately there is (still) no member that holds the overlap factor (but i hear that there is some hope here), and it's "somehow" part of s_sr (to be precise: s_sr=signal.samplerate*signal.overlap; so "s_sr" is really the "number of samples processed per second" rather than the "samplerate" in a more traditional meaning).
in any case, you probably do *not* want to use sys_getsr(), as this will give you the *wrong* samplerate if your (sub)patch is being re-sampled.
furthermore, these values are only available once the signal graph is compiled (that is: when the "dsp"-callback is executed). AND these values *can change* during the lifetime of an object. luckily it is *guaranteed* that whenever on of these values changes, the "dsp"-callback will be re-executed, so you will be informed of any change.
SO: - - you should add code to your external that (re)allocates data in the "dsp"-callback. - - you can use sys_getsr() and DEFDACBLKSIZE (or just 64) as *default* values. but be prepared to change them when you are notified.
fgmasdr IOhannes