void DiskOutUGenInternalAiff16::processBlock(bool& shouldDelete, const unsigned int blockID, const int /*channel*/) throw() { static const float factor = 0x7FFF; const int blockSize = uGenOutput.getBlockSize(); checkBufferSize(blockSize); if(audioFile_) { for(int channel = 0; channel < numChannels; channel++) { const float *inputSamples = inputs[Input].processBlock(shouldDelete, blockID, channel); float *outputSamples = proxies[channel]->getSampleData(); memcpy(outputSamples, inputSamples, blockSize * sizeof(float)); SInt16* audioFileSamples = ((SInt16*)audioData) + channel; int numSamplesToProcess = blockSize; while(numSamplesToProcess--) { SInt16 sample = (SInt16)(*inputSamples * factor); *audioFileSamples = bigEndian16Bit((const char*)&sample); inputSamples++; audioFileSamples += numChannels; } } writeBuffer(blockSize); } }
void DiskInUGenInternalAiff16::processBlock(bool& shouldDelete, const unsigned int blockID, const int /*channel*/) throw() { static const float factor = 1.0 / 0x7FFF; if(clearOutputsAndReadData(shouldDelete) == noErr) { for(int channel = 0; channel < numChannels_; channel++) { float *outputSamples = proxies[channel]->getSampleData(); SInt16* audioFileSamples = (SInt16*)audioData + channel; int numSamplesToProcess = numPackets; while(numSamplesToProcess--) { *outputSamples = (float)bigEndian16Bit((const char*)audioFileSamples) * factor; outputSamples++; audioFileSamples += numChannels_; } } } }