Small changes to new code.

CQTexperiment
vspader 2005-09-12 01:36:23 +00:00
parent a73d6cb4ce
commit b644e05f55
3 changed files with 8 additions and 3 deletions

View File

@ -21,7 +21,7 @@
Semaphore *ioSemaphore;
NSMutableArray *amountConverted;
unsigned int amountPlayed; //when amountPlayed > amountConverted[0], amountPlayed -= amountConverted[0], pop(amountConverted[0])
unsigned int amountPlayed; //when amountPlayed > amountConverted[0], amountPlayed -= amountConverted[0], pop(amountConverted[0]), song changed
}
- (void)convertedAmount:(int)amount; //called by converter...same thread?

View File

@ -81,11 +81,16 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
ioData.mBuffers[0].mNumberChannels = [[soundController output] format].mChannelsPerFrame;
ioData.mNumberBuffers = 1;
[[soundController inputLock] lock];
err = AudioConverterFillComplexBuffer(converter, ACInputProc, &[[soundController input] format], &ioNumberFrames, &ioData, NULL);
if (err != noErr)
DBLog(@"Converter error: %i", err);
[[soundController inputBuffer] didReadLength:(ioNumberFrames * [[[soundController input] format].mBytesPerFrame]);
[[soundController input] buffer] didReadLength:(ioNumberFrames * [[[soundController input] format].mBytesPerFrame]);
[[soundController inputLock] unlock];
[[soundController ioSemaphore] signal];
return ioData.mBuffers[0].mDataByteSize;

View File

@ -13,7 +13,7 @@
- (void)play
{
[SoundFile open:filename];
[soundFile open:filename];
}
@end