What does "void *source" represent in AEBlockAudioReceiver?

edited October 2014

Hello,

I'm trying to integrate Kamcord with my TAAE app, if you don't know Kamcord, Kamcord is a great framework that lets users record and share gameplay videos from inside the app (https://www.kamcord.com/developers/), Usually it automatically captures the app's audio from Cocos2d-Unity3d unless a custom audio engine is used (Non-OpenAL, in this case TAAE), the framework does provide a function to write audio data to the Kamcord audio recorder in this case and it requires 2 arguments:

void Kamcord_WriteAudioBytes(void * data, unsigned int numSamples);

@param data The pointer to the audio data byte stream.

@param numSamples The number of audio samples in this data buffer.

So i'm using the following code to capture audio from TAAE and pass it to Kamcord:

-(void)captureOutput
{
    //Set AudioStreamDescription to mach the AudioStreamDescription TAAE uses
    Kamcord_SetAudioStreamDescription(44100.0,
                                      kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian,
                                      sizeof(SInt16)*2,
                                      2);
    //Set audio quality
    Kamcord_SetAudioRecordingProperties (2 , 44100 , 128000);
    //Pull audio
    id receiver = [AEBlockAudioReceiver audioReceiverWithBlock:
                                 ^(void *source,
                                  const AudioTimeStamp *time,
                                  UInt32 frames,
                                  AudioBufferList *audio) {
                                    if (!Kamcord_IsRecording()) return;
                                    //this block is called from the audio thread each framebuffer duration (in this case each 0.05 seconds)
                                    Kamcord_WriteAudioBytes(source, frames);
                                }];
    [_audioController addOutputReceiver:receiver];
}

Unfortunately this doesn't seem to work, i can't figure out what void *source refers to, Is it the actual data bytes, or is it stored inside the AudioBufferList?

Thanks!

Comments

Sign In or Register to comment.