Skip to content

Conversation

@ChuckMash
Copy link
Contributor

Adds additional utilities to mixer stubs.

FlipChannels

stub->FlipChannels(true); // Enables Left and Right channel switch/flip for this mixer stub

stub->FlipChannels(false); // Disables Left and Right channel switch/flip for this mixer stub

stub->FlipChannels(); // Inverts current switch/flip setting

IsolateChanel

stub->IsolateChannel(1); // Isolates left channel, effectively muting right channel

stub->IsolateChannel(2); // Isolates right channel, effectively muting left channel

stub->IsolateChannel(0); // Disables channel isolation,

Among other things, this is useful for playing a specific channel from 2 different audio sources to a specific channel in the audio output.


mixer = new AudioOutputMixer(1024, out);

stub[0] = mixer->NewInput();
stub[0]->SetGain(.5);
stub[0]->IsolateChannel(1);

stub[1] = mixer->NewInput();
stub[1]->SetGain(.5);
stub[1]->IsolateChannel(2);

//stub[0]->FlipChannels(true);
//stub[1]->FlipChannels(true);
  
play_file1 = new AudioFileSourceSD("/1.mp3");
play_file2 = new AudioFileSourceSD("/2.mp3");

mp31 = new AudioGeneratorMP3();
mp32 = new AudioGeneratorMP3();

mp31->begin(play_file1, stub[0]);
mp32->begin(play_file2, stub[1]);

In this example, the output heard is the left channel from 1.mp3 and the right channel from 2.mp3.

@earlephilhower
Copy link
Owner

Thanks for the contribution, but the code has diverged quite a bit and we have many merge conflicts now. Closing.

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

Successfully merging this pull request may close these issues.

2 participants