Dependencies: mbed USBDevice PinDetect
Audio/AudioEngine.h@9:1e012f67470c, 2016-04-13 (annotated)
- Committer:
- asuszek
- Date:
- Wed Apr 13 19:46:28 2016 +0000
- Revision:
- 9:1e012f67470c
- Parent:
- AudioEngine.h@6:688698f814c0
- Child:
- 13:bb0ec927e458
Moved Audio into it's own folder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asuszek | 6:688698f814c0 | 1 | /** |
asuszek | 6:688698f814c0 | 2 | * The interface for all audio input and output. |
asuszek | 6:688698f814c0 | 3 | * This class acts as a container for individual voices. |
asuszek | 6:688698f814c0 | 4 | * It takes in MIDI events and handles processing and output. |
asuszek | 6:688698f814c0 | 5 | * |
asuszek | 6:688698f814c0 | 6 | * @author Austin Suszek |
asuszek | 6:688698f814c0 | 7 | */ |
asuszek | 6:688698f814c0 | 8 | |
asuszek | 6:688698f814c0 | 9 | #ifndef AS_AUDIO_ENGINE_H |
asuszek | 6:688698f814c0 | 10 | #define AS_AUDIO_ENGINE_H |
asuszek | 6:688698f814c0 | 11 | |
asuszek | 9:1e012f67470c | 12 | #include "../Constants.h" |
asuszek | 9:1e012f67470c | 13 | #include "../mbed.h" |
asuszek | 6:688698f814c0 | 14 | #include "Synthesizer.h" |
asuszek | 6:688698f814c0 | 15 | |
asuszek | 6:688698f814c0 | 16 | class AudioEngine { |
asuszek | 6:688698f814c0 | 17 | public: |
asuszek | 6:688698f814c0 | 18 | |
asuszek | 6:688698f814c0 | 19 | /** |
asuszek | 6:688698f814c0 | 20 | * Constructor |
asuszek | 6:688698f814c0 | 21 | */ |
asuszek | 6:688698f814c0 | 22 | AudioEngine(); |
asuszek | 6:688698f814c0 | 23 | |
asuszek | 6:688698f814c0 | 24 | /** |
asuszek | 6:688698f814c0 | 25 | * Signal the beginning of a note being pressed. |
asuszek | 6:688698f814c0 | 26 | * |
asuszek | 6:688698f814c0 | 27 | * @param key The integer representation of the note |
asuszek | 6:688698f814c0 | 28 | * @param velocity (optional) The note velocity in the range of 0-127 |
asuszek | 6:688698f814c0 | 29 | */ |
asuszek | 6:688698f814c0 | 30 | void midiNoteOn(const int key, const int velocity = 0x7F); |
asuszek | 6:688698f814c0 | 31 | |
asuszek | 6:688698f814c0 | 32 | /** |
asuszek | 6:688698f814c0 | 33 | * Signal the end of a note being pressed. |
asuszek | 6:688698f814c0 | 34 | * |
asuszek | 6:688698f814c0 | 35 | * @param key The integer representation of the note |
asuszek | 6:688698f814c0 | 36 | */ |
asuszek | 6:688698f814c0 | 37 | void midiNoteOff(const int key); |
asuszek | 6:688698f814c0 | 38 | |
asuszek | 6:688698f814c0 | 39 | /** |
asuszek | 6:688698f814c0 | 40 | * Switch to a new synth instrument. |
asuszek | 6:688698f814c0 | 41 | * |
asuszek | 6:688698f814c0 | 42 | * @param direction 1 for next, -1 for previous. |
asuszek | 6:688698f814c0 | 43 | */ |
asuszek | 6:688698f814c0 | 44 | void nextSynth(int direction); |
asuszek | 6:688698f814c0 | 45 | |
asuszek | 6:688698f814c0 | 46 | private: |
asuszek | 6:688698f814c0 | 47 | |
asuszek | 6:688698f814c0 | 48 | Ticker samplePeriod; |
asuszek | 6:688698f814c0 | 49 | void outputAudio(); |
asuszek | 6:688698f814c0 | 50 | |
asuszek | 6:688698f814c0 | 51 | Synthesizer synthesizers[C::MAX_POLYPHONY]; |
asuszek | 6:688698f814c0 | 52 | |
asuszek | 6:688698f814c0 | 53 | }; |
asuszek | 6:688698f814c0 | 54 | |
asuszek | 6:688698f814c0 | 55 | #endif |