ESP8266Audio
ESP8266Audio copied to clipboard
Add FlipChannels and IsolateChannel to mixer stub
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.