diff options
author | IBNobody <[email protected]> | 2016-04-16 22:10:18 -0500 |
---|---|---|
committer | IBNobody <[email protected]> | 2016-04-16 22:10:18 -0500 |
commit | 45f10b4c4b308226fa1568277654a13853a03ab4 (patch) | |
tree | 640e6e7f414d89490fbbde058da1da0d1be98411 /quantum/audio.c | |
parent | 12a9b2b9aeb59a16602374dab202df2bbe256be4 (diff) | |
download | qmk_firmware-45f10b4c4b308226fa1568277654a13853a03ab4.tar.gz qmk_firmware-45f10b4c4b308226fa1568277654a13853a03ab4.zip |
Fixed how note arrays are used.
Diffstat (limited to 'quantum/audio.c')
-rw-r--r-- | quantum/audio.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/quantum/audio.c b/quantum/audio.c index 40d09d62fd..90f3c5a13f 100644 --- a/quantum/audio.c +++ b/quantum/audio.c @@ -181,7 +181,7 @@ void init_notes() { DDRC |= _BV(PORTC6); TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs - + TCCR3A = 0x0; // Options not needed TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback @@ -202,14 +202,14 @@ ISR(TIMER3_COMPA_vect) { if (voices == 1) { // SINE OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2; - + // SQUARE // if (((int)place) >= 1024){ // OCR4A = 0xFF >> 2; // } else { // OCR4A = 0x00; // } - + // SAWTOOTH // OCR4A = (int)place / 4; @@ -298,9 +298,9 @@ ISR(TIMER3_COMPA_vect) { note_position++; bool end_of_note = false; - if (ICR3 > 0) + if (ICR3 > 0) end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF)); - else + else end_of_note = (note_position >= (note_length * 0x7FF)); if (end_of_note) { current_note++; @@ -318,7 +318,7 @@ ISR(TIMER3_COMPA_vect) { return; } } - if (!note_resting && ((int)notes_rest != 0)) { + if (!note_resting && (notes_rest > 0)) { note_resting = true; note_frequency = 0; note_length = notes_rest; @@ -412,7 +412,7 @@ if (audio_config.enable && voices < 8) { if (frequency != 0) { double starting_f = frequency; if (frequency < freq) { - for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { + for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { frequency = f; } } else if (frequency > freq) { |