1
我是ObjectAL的新手。我用它來改變音高播放mp3。對象中的播放緩衝區AL
我無法弄清楚如何在ObjectAL中「正確地」播放加載的緩衝區。當我打電話給[source play:buffer]
時,聲音只有幾分之一秒。爲了不斷地「播放」一個緩衝區,我可以將它嵌入到無限循環中,然後正確地播放緩衝區。我假設我錯過了一些基本觀點,你能指出我的方向嗎?
我的代碼:
[OALSimpleAudio sharedInstance].reservedSources = 0;
ALSource *source = [ALSource source];
ALBuffer *buffer = [[OpenALManager sharedInstance] bufferFromFile:@"video.mp3" reduceToMono:YES];
source.pitch = 1;
for (;;) { // infinite loop because otherwise only a millisecond of buffer is played
[source play:buffer];
}