aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode/process_music.c
diff options
context:
space:
mode:
authorJoshua T <joshua@sonofone.net>2017-01-07 14:01:21 -0600
committerJoshua T <joshua@sonofone.net>2017-01-07 14:01:21 -0600
commit8f8d10475956a17953f6db4db3f3b50bd795c0d8 (patch)
tree90c80474baa080e5743ee745ec98254e1a2faadd /quantum/process_keycode/process_music.c
parentb7b44dc481430438552d91b7069d5e37a5e3a649 (diff)
parente7df488a92da56cf160ac64c8cc7302ab717e145 (diff)
downloadfirmware-8f8d10475956a17953f6db4db3f3b50bd795c0d8.tar.gz
firmware-8f8d10475956a17953f6db4db3f3b50bd795c0d8.tar.bz2
firmware-8f8d10475956a17953f6db4db3f3b50bd795c0d8.zip
Merged from upstream
Diffstat (limited to 'quantum/process_keycode/process_music.c')
-rw-r--r--quantum/process_keycode/process_music.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 2d52e47a7..ca68bef6c 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -1,8 +1,8 @@
#include "process_music.h"
bool music_activated = false;
-uint8_t starting_note = 0x0C;
-int offset = 7;
+uint8_t music_starting_note = 0x0C;
+int music_offset = 7;
// music sequencer
static bool music_sequence_recording = false;
@@ -115,7 +115,16 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false;
}
- float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row));
+ #ifdef MUSIC_MODE_CHROMATIC
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(MATRIX_ROWS - record->event.key.row));
+ #elif defined(MUSIC_MODE_GUITAR)
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 7)*5.0/12);
+ #elif defined(MUSIC_MODE_VIOLIN)
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 5)*7.0/12);
+ #else
+ float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + SCALE[record->event.key.col + music_offset])/12.0+(MATRIX_ROWS - record->event.key.row));
+ #endif
+
if (record->event.pressed) {
play_note(freq, 0xF);
if (music_sequence_recording) {