TAAE2: Demo code makes sense, but I can't hear its audio output.

edited July 2016

@Michael ,

In the code example on the TAAE2 documentation page, I didn't see a playAtTime method to begin the playback of the audio files:

http://theamazingaudioengine.com/doc2/_the-_buffer-_stack.html

I followed the code example to better understand how buffers and modules work in TAAE2, but couldn't hear any of the audio output playing with the added effects. Here's the code from that BufferStack page:

// Create our renderer and output
AERenderer * renderer = [AERenderer new];
self.output = [[AEAudioUnitOutput alloc] initWithRenderer:renderer];

// Create the players
AEAudioFilePlayerModule * file1 = [[AEAudioFilePlayerModule alloc] initWithRenderer:renderer URL:url1 error:NULL];
AEAudioFilePlayerModule * file2 = [[AEAudioFilePlayerModule alloc] initWithRenderer:renderer URL:url2 error:NULL];
AEAudioFilePlayerModule * file3 = [[AEAudioFilePlayerModule alloc] initWithRenderer:renderer URL:url3 error:NULL];

// Create the filters
AEBandpassModule * filter1 = [[AEBandpassModule alloc] initWithRenderer:renderer];
AEDelayModule * filter2 = [[AEDelayModule alloc] initWithRenderer:renderer];

// Create the recorder
AEAudioFileRecorderModule * recorder = [[AEAudioFileRecorderModule alloc] initWithRenderer:renderer URL:outputUrl error:NULL];

renderer.block = ^(const AERenderContext * _Nonnull context) {

 AEModuleProcess(file1, context); // Run player (pushes 1)
 AEModuleProcess(filter1, context); // Run filter (edits top buffer)

 AEModuleProcess(file2, context); // Run player (pushes 1)
 AEModuleProcess(file3, context); // Run player (pushes 1)
 AEBufferStackMix(context->stack, 2); // Mix top 2 buffers

 AEModuleProcess(filter2, context); // Run filter (edits top buffer)

 AERenderContextOutput(context, 1); // Put top buffer onto output

 AEModuleProcess(recorder, context); // Run recorder (uses top buffer)

};

[self.output start:NULL];

Should the audio files automatically play on their own? I was thinking that I might have to add something like the following:

[self.file1 playAtTime:(0)]; // How can I obtain the AudioTimeStamp and what does that look like?

I know that the documentation isn't finished, but will there be an intuitive way to modify the pan and volume with ease, similar to TAAE1? I'm used to setting them like file1.volume = 0.8; or file1.pan = 0.6; I saw 'balance' somewhere in the source, but didn't know how to apply it to the AEAudioFilePlayerModule file.

Thanks in advance for your time and help. Excellent work on TAAE2, by the way!

Take care,
Mark

Comments

  • Sorry about the delay @markjeschke - yup, the players need to be started. I've updated the docs.

    Hmm. Yeah, I might add volume/pan support to AEModule...

    And cheers =)

Sign In or Register to comment.