Small changes to new code.
This commit is contained in:
parent
a73d6cb4ce
commit
b644e05f55
3 changed files with 8 additions and 3 deletions
|
@ -21,7 +21,7 @@
|
||||||
Semaphore *ioSemaphore;
|
Semaphore *ioSemaphore;
|
||||||
|
|
||||||
NSMutableArray *amountConverted;
|
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?
|
- (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.mBuffers[0].mNumberChannels = [[soundController output] format].mChannelsPerFrame;
|
||||||
ioData.mNumberBuffers = 1;
|
ioData.mNumberBuffers = 1;
|
||||||
|
|
||||||
|
[[soundController inputLock] lock];
|
||||||
|
|
||||||
err = AudioConverterFillComplexBuffer(converter, ACInputProc, &[[soundController input] format], &ioNumberFrames, &ioData, NULL);
|
err = AudioConverterFillComplexBuffer(converter, ACInputProc, &[[soundController input] format], &ioNumberFrames, &ioData, NULL);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
DBLog(@"Converter error: %i", err);
|
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];
|
[[soundController ioSemaphore] signal];
|
||||||
|
|
||||||
return ioData.mBuffers[0].mDataByteSize;
|
return ioData.mBuffers[0].mDataByteSize;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
- (void)play
|
- (void)play
|
||||||
{
|
{
|
||||||
[SoundFile open:filename];
|
[soundFile open:filename];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue