diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-04-16 23:15:40 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-04-16 23:15:40 -0400 |
| commit | e7b9959819e709d7df2e96a94bdaf36e4e9e23e3 (patch) | |
| tree | 648db4eeb6a51675e917eef36ec439313ec2f1c8 /quantum/audio.c | |
| parent | 720e67e55838de6811b9feee2e01f8b31b5df120 (diff) | |
| parent | 45f10b4c4b308226fa1568277654a13853a03ab4 (diff) | |
| download | qmk_firmware-e7b9959819e709d7df2e96a94bdaf36e4e9e23e3.tar.gz qmk_firmware-e7b9959819e709d7df2e96a94bdaf36e4e9e23e3.zip | |
no need for length of play_notes array with macro
Diffstat (limited to 'quantum/audio.c')
| -rw-r--r-- | quantum/audio.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/quantum/audio.c b/quantum/audio.c index 773edfd8e..90f3c5a13 100644 --- a/quantum/audio.c +++ b/quantum/audio.c | |||
| @@ -181,7 +181,7 @@ void init_notes() { | |||
| 181 | DDRC |= _BV(PORTC6); | 181 | DDRC |= _BV(PORTC6); |
| 182 | 182 | ||
| 183 | TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs | 183 | TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs |
| 184 | 184 | ||
| 185 | TCCR3A = 0x0; // Options not needed | 185 | TCCR3A = 0x0; // Options not needed |
| 186 | TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC | 186 | TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC |
| 187 | OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback | 187 | OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback |
| @@ -202,14 +202,14 @@ ISR(TIMER3_COMPA_vect) { | |||
| 202 | if (voices == 1) { | 202 | if (voices == 1) { |
| 203 | // SINE | 203 | // SINE |
| 204 | OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2; | 204 | OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2; |
| 205 | 205 | ||
| 206 | // SQUARE | 206 | // SQUARE |
| 207 | // if (((int)place) >= 1024){ | 207 | // if (((int)place) >= 1024){ |
| 208 | // OCR4A = 0xFF >> 2; | 208 | // OCR4A = 0xFF >> 2; |
| 209 | // } else { | 209 | // } else { |
| 210 | // OCR4A = 0x00; | 210 | // OCR4A = 0x00; |
| 211 | // } | 211 | // } |
| 212 | 212 | ||
| 213 | // SAWTOOTH | 213 | // SAWTOOTH |
| 214 | // OCR4A = (int)place / 4; | 214 | // OCR4A = (int)place / 4; |
| 215 | 215 | ||
| @@ -298,9 +298,9 @@ ISR(TIMER3_COMPA_vect) { | |||
| 298 | 298 | ||
| 299 | note_position++; | 299 | note_position++; |
| 300 | bool end_of_note = false; | 300 | bool end_of_note = false; |
| 301 | if (ICR3 > 0) | 301 | if (ICR3 > 0) |
| 302 | end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF)); | 302 | end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF)); |
| 303 | else | 303 | else |
| 304 | end_of_note = (note_position >= (note_length * 0x7FF)); | 304 | end_of_note = (note_position >= (note_length * 0x7FF)); |
| 305 | if (end_of_note) { | 305 | if (end_of_note) { |
| 306 | current_note++; | 306 | current_note++; |
| @@ -412,7 +412,7 @@ if (audio_config.enable && voices < 8) { | |||
| 412 | if (frequency != 0) { | 412 | if (frequency != 0) { |
| 413 | double starting_f = frequency; | 413 | double starting_f = frequency; |
| 414 | if (frequency < freq) { | 414 | if (frequency < freq) { |
| 415 | for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { | 415 | for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { |
| 416 | frequency = f; | 416 | frequency = f; |
| 417 | } | 417 | } |
| 418 | } else if (frequency > freq) { | 418 | } else if (frequency > freq) { |
