aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorOfer Plesser <plesserofer@gmail.com>2016-12-16 21:52:51 +0200
committerOfer Plesser <plesserofer@gmail.com>2016-12-16 21:52:51 +0200
commit6a462c818cc35ad5a51576bee96077d9614b1a8d (patch)
treecda535a4e64bd0183b800b6abe87005c3f98a74f /quantum
parent6e7cfa83b9424061914793b02757fa4ec75b356b (diff)
parentb8e13167c813b59ebd6f4484dccae37bde2bfdba (diff)
downloadqmk_firmware-6a462c818cc35ad5a51576bee96077d9614b1a8d.tar.gz
qmk_firmware-6a462c818cc35ad5a51576bee96077d9614b1a8d.zip
Merge branch 'master' into feature/combos
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio/voices.c23
-rw-r--r--quantum/audio/voices.h1
-rw-r--r--quantum/process_keycode/process_music.c6
3 files changed, 26 insertions, 4 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c
index 6d4172a06..19f7b646e 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -18,7 +18,7 @@ void voice_iterate() {
18} 18}
19 19
20void voice_deiterate() { 20void voice_deiterate() {
21 voice = (voice - 1) % number_of_voices; 21 voice = (voice - 1 + number_of_voices) % number_of_voices;
22} 22}
23 23
24float voice_envelope(float frequency) { 24float voice_envelope(float frequency) {
@@ -31,6 +31,27 @@ float voice_envelope(float frequency) {
31 polyphony_rate = 0; 31 polyphony_rate = 0;
32 break; 32 break;
33 33
34 case something:
35 polyphony_rate = 0;
36 switch (compensated_index) {
37 case 0 ... 9:
38 note_timbre = TIMBRE_12;
39 break;
40
41 case 10 ... 19:
42 note_timbre = TIMBRE_25;
43 break;
44
45 case 20 ... 200:
46 note_timbre = .25 + .125 + pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
47 break;
48
49 default:
50 note_timbre = .25;
51 break;
52 }
53 break;
54
34 case butts_fader: 55 case butts_fader:
35 polyphony_rate = 0; 56 polyphony_rate = 0;
36 switch (compensated_index) { 57 switch (compensated_index) {
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h
index b2495b23b..b43def3d7 100644
--- a/quantum/audio/voices.h
+++ b/quantum/audio/voices.h
@@ -11,6 +11,7 @@ float voice_envelope(float frequency);
11 11
12typedef enum { 12typedef enum {
13 default_voice, 13 default_voice,
14 something,
14 butts_fader, 15 butts_fader,
15 octave_crunch, 16 octave_crunch,
16 duty_osc, 17 duty_osc,
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 2d52e47a7..bae43943e 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -1,8 +1,8 @@
1#include "process_music.h" 1#include "process_music.h"
2 2
3bool music_activated = false; 3bool music_activated = false;
4uint8_t starting_note = 0x0C; 4uint8_t music_starting_note = 0x0C;
5int offset = 7; 5int music_offset = 7;
6 6
7// music sequencer 7// music sequencer
8static bool music_sequence_recording = false; 8static bool music_sequence_recording = false;
@@ -115,7 +115,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
115 return false; 115 return false;
116 } 116 }
117 117
118 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)); 118 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));
119 if (record->event.pressed) { 119 if (record->event.pressed) {
120 play_note(freq, 0xF); 120 play_note(freq, 0xF);
121 if (music_sequence_recording) { 121 if (music_sequence_recording) {