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

Add FlipChannels and IsolateChannel to mixer stub #657

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

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.

None yet

1 participant