update music functionality

This commit is contained in:
Jack Humbert
2018-01-06 23:52:20 -05:00
parent 8582faab6f
commit 7923376de1
7 changed files with 212 additions and 147 deletions

View File

@ -39,6 +39,7 @@
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#define C6_AUDIO
#define B7_AUDIO
#undef BACKLIGHT_PIN

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,27 @@
// Enable vibrato strength/amplitude - slows down ISR too much
// #define VIBRATO_STRENGTH_ENABLE
#ifdef B_AUDIO
#error Please define B5_AUDIO, B6_AUDIO, or B7_AUDIO instead
#endif
#if defined(B5_AUDIO) || defined(B6_AUDIO) || defined(B7_AUDIO)
#define B_AUDIO
#endif
#if defined(C6_AUDIO) && defined (B_AUDIO)
#define NUMBER_OF_TIMERS 2
#elif defined(C6_AUDIO)
#define NUMBER_OF_TIMERS 1
#elif defined(B_AUDIO)
#define NUMBER_OF_TIMERS 1
#else
#define NUMBER_OF_TIMERS 0
#endif
#define TIMER_1_INDEX 0
#define TIMER_3_INDEX 1
typedef union {
uint8_t raw;
struct {
@ -75,7 +96,7 @@ void disable_polyphony(void);
void increase_polyphony_rate(float change);
void decrease_polyphony_rate(float change);
void set_timbre(float timbre);
void set_timbre(float timbre, uint8_t timer_index);
void set_tempo(uint8_t tempo);
void increase_tempo(uint8_t tempo_change);

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
#ifndef VOICES_H
#define VOICES_H
float voice_envelope(float frequency);
float voice_envelope(float frequency, uint8_t timer_index);
typedef enum {
default_voice,
@ -45,8 +45,12 @@ typedef enum {
number_of_voices // important that this is last
} voice_type;
void set_voice(voice_type v);
void voice_iterate(void);
void voice_deiterate(void);
void set_all_voices(voice_type v);
void all_voices_iterate(void);
void all_voices_deiterate(void);
void set_voice(voice_type v, uint8_t timer_index);
void voice_iterate(uint8_t timer_index);
void voice_deiterate(uint8_t timer_index);
#endif

View File

@ -38,13 +38,13 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
}
if (keycode == MUV_IN && record->event.pressed) {
voice_iterate();
all_voices_iterate();
PLAY_SONG(voice_change_song);
return false;
}
if (keycode == MUV_DE && record->event.pressed) {
voice_deiterate();
all_voices_deiterate();
PLAY_SONG(voice_change_song);
return false;
}

View File

@ -28,7 +28,7 @@ bool music_activated = false;
bool midi_activated = false;
uint8_t music_starting_note = 0x0C;
int music_offset = 7;
uint8_t music_mode = MUSIC_MODE_CHROMATIC;
uint8_t music_mode = MUSIC_MODE_MAJOR;
// music sequencer
static bool music_sequence_recording = false;