|
|
|
|
|
|
|
|
/* Play Zelda music. |
|
|
|
|
|
|
|
|
/* Play Zelda music, Overland Theme from The Wind Walker |
|
|
|
|
|
|
|
|
|
|
|
Reference for this music: |
|
|
|
|
|
https://www.youtube.com/watch?v=RekBzP114do&t=1091s |
|
|
|
|
|
|
|
|
Requires Teensy 3.6 due to 520 kbytes of wavetable data |
|
|
|
|
|
Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html |
|
|
Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <SerialFlash.h> |
|
|
#include <SerialFlash.h> |
|
|
|
|
|
|
|
|
#include "Pizzicato_samples.h" |
|
|
#include "Pizzicato_samples.h" |
|
|
#include "FrenchHorns_samples.h" |
|
|
|
|
|
#include "Viola_samples.h" |
|
|
#include "Viola_samples.h" |
|
|
#include "BasicFlute1_samples.h" |
|
|
|
|
|
|
|
|
#include "WT_Trumpet_samples.h" |
|
|
|
|
|
#include "MutedTrumpet_samples.h" |
|
|
#include "PlaySynthMusic.h" |
|
|
#include "PlaySynthMusic.h" |
|
|
|
|
|
|
|
|
//#define DEBUG_ALLOC |
|
|
//#define DEBUG_ALLOC |
|
|
|
|
|
|
|
|
for (int j = 0; j < 4; ++j) |
|
|
for (int j = 0; j < 4; ++j) |
|
|
mixer[i].gain(j, 0.25); |
|
|
mixer[i].gain(j, 0.25); |
|
|
for (int i = 0; i < 4; ++i) |
|
|
for (int i = 0; i < 4; ++i) |
|
|
mixer[TOTAL_MIXERS - 1].gain(i, i < SECONDARY_MIXERS ? 1.0 / SECONDARY_MIXERS : 0.0); |
|
|
|
|
|
|
|
|
mixer[TOTAL_MIXERS - 1].gain(i, 0.5); |
|
|
|
|
|
|
|
|
usbMIDI.setHandleNoteOn(OnNoteOn); |
|
|
|
|
|
usbMIDI.setHandleNoteOff(OnNoteOff); |
|
|
|
|
|
|
|
|
//usbMIDI.setHandleNoteOn(OnNoteOn); |
|
|
|
|
|
//usbMIDI.setHandleNoteOff(OnNoteOff); |
|
|
//volumeTimer.begin(setVolume, 100000); |
|
|
//volumeTimer.begin(setVolume, 100000); |
|
|
guitarHeroTimer.begin(guitarHeroMode, 1000000/120); |
|
|
|
|
|
|
|
|
//guitarHeroTimer.begin(guitarHeroMode, 1000000/120); |
|
|
//midiMapTimer.begin(printVoices, 5000); |
|
|
//midiMapTimer.begin(printVoices, 5000); |
|
|
|
|
|
|
|
|
delay(2000); |
|
|
delay(2000); |
|
|
|
|
|
|
|
|
unsigned char c,opcode,chan; |
|
|
unsigned char c,opcode,chan; |
|
|
unsigned long d_time; |
|
|
unsigned long d_time; |
|
|
|
|
|
|
|
|
// Volume control |
|
|
|
|
|
// uncomment if you have a volume pot soldered to your audio shield |
|
|
|
|
|
/* |
|
|
|
|
|
int n = analogRead(15); |
|
|
|
|
|
if (n != volume) { |
|
|
|
|
|
volume = n; |
|
|
|
|
|
codec.volume((float)n / 1023); |
|
|
|
|
|
} |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
// read the next note from the table |
|
|
// read the next note from the table |
|
|
c = *sp++; |
|
|
c = *sp++; |
|
|
opcode = c & 0xF0; |
|
|
opcode = c & 0xF0; |
|
|
|
|
|
|
|
|
wavetable[chan].setInstrument(Viola); |
|
|
wavetable[chan].setInstrument(Viola); |
|
|
break; |
|
|
break; |
|
|
case 57: |
|
|
case 57: |
|
|
wavetable[chan].setInstrument(BasicFlute1); |
|
|
|
|
|
|
|
|
wavetable[chan].setInstrument(WT_Trumpet); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
wavetable[chan].setInstrument(FrenchHorns); |
|
|
|
|
|
|
|
|
wavetable[chan].setInstrument(MutedTrumpet); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
usbMIDI.read(); |
|
|
|
|
|
|
|
|
//usbMIDI.read(); |
|
|
//for (int i = 0; i < TOTAL_BUTTONS; ++i) buttons[i].update(); |
|
|
//for (int i = 0; i < TOTAL_BUTTONS; ++i) buttons[i].update(); |
|
|
//if (buttons[0].fallingEdge()) AudioSynthWavetable::print_performance(); |
|
|
//if (buttons[0].fallingEdge()) AudioSynthWavetable::print_performance(); |
|
|
//if (buttons[1].risingEdge()) { |
|
|
//if (buttons[1].risingEdge()) { |