samedi 3 janvier 2015

Not able to hear 'noise' when writing random values AudioBuffer in iOS

I am using EZAudio and trying to write some samples generated by my softaware to an AudioBuffer provided by this library http://ift.tt/1efODcD as seen in the example "Playback By Manual Override".


My code looks like this...



// Completely override the output callback function
- (void)
output:(EZOutput *)output
callbackWithActionFlags:(AudioUnitRenderActionFlags *)ioActionFlags
inTimeStamp:(const AudioTimeStamp *)inTimeStamp
inBusNumber:(UInt32)inBusNumber
inNumberFrames:(UInt32)inNumberFrames
ioData:(AudioBufferList *)ioData {
//grab latest sample from sample queue
if (currentAudioPiece == nil || currentAudioPiece.duration >= currentAudioPieceIndex) {
self.currentAudioPiece = sampleQueue.dequeue;
}
AudioBuffer audioBuffer = ioData->mBuffers[0];


if (true) {
for (int i = 0; i < audioBuffer.mDataByteSize; i++) {
uint8_t rofl[2048];
arc4random_buf(&rofl, 2048);
audioBuffer.mData = rofl;
}

return;
}

//... more code that I'll debug later...'


Essentially I am unable to get a sanity check that a random bunch of memory playing back should make some noise. I think the problem is with "audioBuffer.mData = rofl;". I'm rather confused about working with memory at void*.


Aucun commentaire:

Enregistrer un commentaire