Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On the fly channel mapping for readers and writers #11

Closed
alexbw opened this issue Apr 27, 2012 · 1 comment
Closed

On the fly channel mapping for readers and writers #11

alexbw opened this issue Apr 27, 2012 · 1 comment

Comments

@alexbw
Copy link
Owner

alexbw commented Apr 27, 2012

Should be able to automatically (using channel maps) change the channel count of audio coming or going to a file.

Did this at one point, a long time ago. It looked roughly like this:

// If there's only single-channel input, set up a channel map to record to both channels
if (self.numChannels == 1) {
    // Get the underlying AudioConverterRef
    UInt32 size = sizeof(AudioConverterRef);
    AudioConverterRef conv = NULL;
    XThrowIfError( ExtAudioFileGetProperty(outputFileRef, kExtAudioFileProperty_AudioConverter, &size, &conv), "Could not get underlying converter for ExtAudioFile");
    if (conv)
    {
        // This should be as large as the number of output channels,
        // each element specifies which input channel's data is routed to that output channel
        SInt32 channelMap[] = { 0, 0 };
        XThrowIfError( AudioConverterSetProperty(conv, kAudioConverterChannelMap, 2*sizeof(SInt32), channelMap), "Could not set up mono->stereo channel map");
    }
}
@alexbw
Copy link
Owner Author

alexbw commented Nov 15, 2013

I once was ambitious

@alexbw alexbw closed this as completed Nov 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant