Small changes to new code.
parent
a73d6cb4ce
commit
b644e05f55
|
@ -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?
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
- (void)play
|
||||
{
|
||||
[SoundFile open:filename];
|
||||
[soundFile open:filename];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue