|
|
|
|
|
|
|
|
/* Audio Library for Teensy 3.X |
|
|
|
|
|
* Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com |
|
|
|
|
|
|
|
|
/* Copyright (c) 2018 John-Michael Reed |
|
|
|
|
|
* bleeplabs.com |
|
|
* |
|
|
* |
|
|
* Development of this audio library was funded by PJRC.COM, LLC by sales of |
|
|
* Development of this audio library was funded by PJRC.COM, LLC by sales of |
|
|
* Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop |
|
|
* Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop |
|
|
|
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
|
* THE SOFTWARE. |
|
|
* THE SOFTWARE. |
|
|
|
|
|
|
|
|
Combine analog signals with bitwise expressions like OXR. Combining two simple oscillators results in interesting new waveforms, |
|
|
|
|
|
Combining white noise or dynamic incoming audio results in aggressive digital distortion. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
* Combine analog signals with bitwise expressions like XOR. |
|
|
|
|
|
* Combining two simple oscillators results in interesting new waveforms, |
|
|
|
|
|
* Combining white noise or dynamic incoming audio results in aggressive digital distortion. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#ifndef effect_digital_combine_h_ |
|
|
#ifndef effect_digital_combine_h_ |
|
|
|
|
|
|
|
|
#include <Arduino.h> |
|
|
#include <Arduino.h> |
|
|
#include "AudioStream.h" |
|
|
#include "AudioStream.h" |
|
|
|
|
|
|
|
|
#define OR 0 |
|
|
|
|
|
#define XOR 1 |
|
|
|
|
|
#define AND 2 |
|
|
|
|
|
#define MODULO 3 |
|
|
|
|
|
|
|
|
|
|
|
class AudioEffectDigitalCombine : public AudioStream |
|
|
class AudioEffectDigitalCombine : public AudioStream |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
|
|
|
enum combineMode { |
|
|
|
|
|
OR = 0, |
|
|
|
|
|
XOR = 1, |
|
|
|
|
|
AND = 2, |
|
|
|
|
|
MODULO = 3, |
|
|
|
|
|
}; |
|
|
AudioEffectDigitalCombine() : AudioStream(2, inputQueueArray), mode_sel(OR) { } |
|
|
AudioEffectDigitalCombine() : AudioStream(2, inputQueueArray), mode_sel(OR) { } |
|
|
void mode(short mode_in) { |
|
|
|
|
|
|
|
|
void setCombineMode(int mode_in) { |
|
|
if (mode_in > 3) { |
|
|
if (mode_in > 3) { |
|
|
mode_in = 3; |
|
|
mode_in = 3; |
|
|
} |
|
|
} |