dRowAudio - pitch transposer usage

Howdy

Trying to use the pitch transposer like this:

for (int channel = 0; channel < buffer.getNumChannels(); ++channel)
    {
        float* pitchDataIn = pitchBuffer.getWritePointer(channel);
        float* pitchDataOut = pitchBuffer.getWritePointer(channel);

        //soundtouch pitch
        stSettings.pitch = pitchShiftSmooth;
        stShift[channel].setPlaybackSettings(stSettings);
        stShift[channel].writeSamples(&pitchDataIn, 1, numSamples);
        stShift[channel].readSamples(&pitchDataOut, 1, numSamples);

When I try to compile on os x, it just crashes with some memory errors on startup. I think I can tell from the crash that it's happening in RateTransposerFloat::transposeMono

When I try in iOS, I can load the app fine, but once any audio device is enabled I crash at (bolded):

uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint nSamples)
{
    unsigned int i, used;

    used = 0;    
    i = 0;

    // Process the last sample saved from the previous call first...
    while (fSlopeCount <= 1.0f)
    {
        dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]); //CRASH HERE
        i++;
        fSlopeCount += fRate;
    }

Any clues to what I'm doing wrong here?

Thanks

My initial thought turned out to be correct - just use two separate buffers.



AudioSampleBuffer pitchBufferIn(2, numSamples);
pitchBufferIn = buffer; //COPIES IT - does not reference it

AudioSampleBuffer pitchBufferOut(2, numSamples);
pitchBufferOut = buffer; //COPIES IT - does not reference it

for (int channel = 0; channel < buffer.getNumChannels(); ++channel)
{
        pitchDataIn = pitchBufferIn.getWritePointer(channel);
        pitchDataOut = pitchBufferOut.getWritePointer(channel);

Doesn't seem to be working on iOS so I'm still debugging.

It seems totally random - without changing any code, sometimes it will work, and sometimes it will crash in that rateTransposer function.

That's on OS X.

 

I get a number of different errors:

objc[17160]: Hash table corrupted. This is probably a memory error somewhere.

...being one of them.

Looks like maybe I was setting the pitch shift factor to garbage...if I make sure that is correct, I do ok.

Wanted to clarify that this isn't totally the issue - the pitch transposer still crashes occasionally once audio starts getting processed. I'm on a further garbage hunt but I can't really guess what it might be.

It either crashes in the mono-transpose function or some other place in the apps main function.