Hah, I did some more debugging and I found something interesting. I set up more debugging prints, this time at the point where samples are actually copied to the outBuffer
: https://github.com/Tracktion/tracktion_engine/blob/e7e388efdccd86cb767b72f1532d513d4be94c44/modules/tracktion_engine/plugins/effects/tracktion_SamplerPlugin.cpp#L69-L74
I’m printing the first 20 samples of both the audioData
buffer (which should have the step sequencer sample) and the outBuffer
(which I guess is what is passed to the next plugin in the chain). On macOS I see non-zero values in both buffers (which makes sense):
...
void addNextBlock - writing channel 1 to output buffer, offset 10856
inBuffer: 4.44651e-05, 3.96967e-05, 3.71933e-05, 3.23057e-05, 2.75373e-05, 2.2769e-05, 1.80006e-05, 1.32322e-05, 8.46386e-06, 3.69549e-06, 1.07288e-06, -3.69549e-06, -8.46386e-06, -1.32322e-05, -1.80006e-05, -2.06232e-05, -2.53916e-05, -3.016e-05, -3.50475e-05, -3.75509e-05,
outBuffer: 2.84397e-05, 2.53898e-05, 2.37887e-05, 2.06626e-05, 1.76128e-05, 1.45629e-05, 1.15131e-05, 8.46328e-06, 5.41345e-06, 2.36362e-06, 6.86212e-07, -2.36362e-06, -5.41345e-06, -8.46328e-06, -1.15131e-05, -1.31905e-05, -1.62403e-05, -1.92902e-05, -2.24163e-05, -2.40174e-05,
void addNextBlock - writing channel 0 to output buffer, offset 10856
inBuffer: 4.44651e-05, 3.96967e-05, 3.71933e-05, 3.23057e-05, 2.75373e-05, 2.2769e-05, 1.80006e-05, 1.32322e-05, 8.46386e-06, 3.69549e-06, 1.07288e-06, -3.69549e-06, -8.46386e-06, -1.32322e-05, -1.80006e-05, -2.06232e-05, -2.53916e-05, -3.016e-05, -3.50475e-05, -3.75509e-05,
outBuffer: 2.84397e-05, 2.53898e-05, 2.37887e-05, 2.06626e-05, 1.76128e-05, 1.45629e-05, 1.15131e-05, 8.46328e-06, 5.41345e-06, 2.36362e-06, 6.86212e-07, -2.36362e-06, -5.41345e-06, -8.46328e-06, -1.15131e-05, -1.31905e-05, -1.62403e-05, -1.92902e-05, -2.24163e-05, -2.40174e-05,
...
However, in ELK, both buffers are always 0 (so I hear no sound!):
...
void addNextBlock - writing channel 1 to output buffer, offset 10995
inBuffer: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
outBuffer: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
void addNextBlock - writing channel 0 to output buffer, offset 10995
inBuffer: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
outBuffer: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...
Just FYI, the way I do this logging is by adding the following lines after the call to the reampler processAdding
method:
auto* inBufferPtr = audioData.getReadPointer (jmin (i, audioData.getNumChannels() - 1), offset);
std::cout << " inBuffer: ";
for (auto sample = 0; sample < 20; ++sample)
std::cout << inBufferPtr[sample] << ", ";
std::cout << std::endl;
auto* outBufferPtr = outBuffer.getReadPointer (i, startSamp);
std::cout << " outBuffer: ";
for (auto sample = 0; sample < 20; ++sample)
std::cout << outBufferPtr[sample] << ", ";
std::cout << std::endl;
This makes me thing of the idea of the sampler not reading properly the audio data…
I’ll continue testing…