summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authordbroqua <dbroqua@mousur.org>2016-12-17 22:28:56 +0100
committerdbroqua <dbroqua@mousur.org>2016-12-17 22:28:56 +0100
commitc3469b8d2175cd5a6f3c922d478222bf3908516e (patch)
tree98123b52d6ce2938d424339417e2c54864e15260 /quantum
parentdf50bee5a88cacbd1f5fab98b26c2068646b61c0 (diff)
parentc9803f78b2409cfaf6a1be0a4b6c1a37778a3f37 (diff)
downloadqmk_firmware-c3469b8d2175cd5a6f3c922d478222bf3908516e.tar.gz
qmk_firmware-c3469b8d2175cd5a6f3c922d478222bf3908516e.zip
Merge branch 'master' of https://github.com/Dbroqua/qmk_firmware
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 6d4172a06c..19f7b646ef 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -18,7 +18,7 @@ void voice_iterate() {
}
void voice_deiterate() {
- voice = (voice - 1) % number_of_voices;
+ voice = (voice - 1 + number_of_voices) % number_of_voices;
}
float voice_envelope(float frequency) {
@@ -31,6 +31,27 @@ float voice_envelope(float frequency) {
polyphony_rate = 0;
break;
+ case something:
+ polyphony_rate = 0;
+ switch (compensated_index) {
+ case 0 ... 9:
+ note_timbre = TIMBRE_12;
+ break;
+
+ case 10 ... 19:
+ note_timbre = TIMBRE_25;
+ break;
+
+ case 20 ... 200:
+ note_timbre = .25 + .125 + pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
+ break;
+
+ default:
+ note_timbre = .25;
+ break;
+ }
+ break;
+
case butts_fader:
polyphony_rate = 0;
switch (compensated_index) {
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h
index b2495b23b5..b43def3d7d 100644
--- a/quantum/audio/voices.h
+++ b/quantum/audio/voices.h
@@ -11,6 +11,7 @@ float voice_envelope(float frequency);
typedef enum {
default_voice,
+ something,
butts_fader,
octave_crunch,
duty_osc,
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 2d52e47a72..bae43943e0 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,7 @@ 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));
+ 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));
if (record->event.pressed) {
play_note(freq, 0xF);
if (music_sequence_recording) {