Hey guys,
i want to play a sound every 1/16 th. i got all the functions working for that, except, that i cant determine the correct SamplePos somehow.
assigning GetSamplePos() to a variable in ProcessDouble Replacing updates the variable only every nFrames, which causes the samplepos to overjump values: 0,32,64,96,....
Code:
void Reb::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
int SamplePos = GetSamplePos();
So i thought, okay i update SamplePos every Sample by assigning it from within the for loop in processdoublereplacing:
Code:
for (int s = 0; s < nFrames; ++s, ++in1, ++in2, ++out1, ++out2) {
SamplePos = GetSamplePos();
But that doesnt work somehow. the samplePos was still overjumping values.
So i thought alright, i update the SamplePos every nFrames from ProcessDoubleReplacing:
Code:
void Reb::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
int SamplePos = GetSamplePos();
and then sort of interpolate it with ++SamplePos in the For Loop:
Code:
for (int s = 0; s < nFrames; ++s, ++in1, ++in2, ++out1, ++out2) {
++SamplePos;
this increases the SamplePos with +1 which is what i wanted.
but when i want to play a sound every 1/16:
Code:
if(inBeatSync) {
PlaySaw = true;
}
inBeatSync turns true at the right SamplePos, but the SamplePos doesnt seem to be aligned with the actual samplePos that is played right now in the daw(bitwig in my case), the played Saw has always an offset to the grid.
this offset seems to change depening on what blocksize i select.
so my conclusion from that would be, that as midi notes need a midi queue the samplepos needs also a readjusting-offset manipulator in oder to be in sync with the daw samplepos - but i belive i overlooked something here, i hope you understand somewaht what i want and can help :-)