audio fixes
This commit is contained in:
		
							parent
							
								
									319fbe344b
								
							
						
					
					
						commit
						ce463ef424
					
				
					 3 changed files with 9 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -257,7 +257,7 @@ ISR(TIMER3_COMPA_vect) {
 | 
			
		|||
                    place = 0.0;
 | 
			
		||||
                }
 | 
			
		||||
                ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period
 | 
			
		||||
                OCR3A = (int)((((double)F_CPU) / (note_frequency * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
 | 
			
		||||
                OCR3A = (int)((((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
 | 
			
		||||
                //OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period
 | 
			
		||||
                place++;
 | 
			
		||||
                // if (duty_counter > (frequencies[voice_place] / 500)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -353,6 +353,7 @@ if (audio_config.enable) {
 | 
			
		|||
 | 
			
		||||
    if (note)
 | 
			
		||||
        stop_all_notes();
 | 
			
		||||
    notes = true;
 | 
			
		||||
 | 
			
		||||
    notes_pointer = np;
 | 
			
		||||
    notes_count = n_count;
 | 
			
		||||
| 
						 | 
				
			
			@ -378,7 +379,6 @@ if (audio_config.enable) {
 | 
			
		|||
        TCCR3A |= _BV(COM3A1);
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    notes = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -408,6 +408,7 @@ if (audio_config.enable && voices < 8) {
 | 
			
		|||
 | 
			
		||||
    if (notes)
 | 
			
		||||
        stop_all_notes();
 | 
			
		||||
    note = true;
 | 
			
		||||
    #ifdef PWM_AUDIO
 | 
			
		||||
        freq = freq / SAMPLE_RATE;
 | 
			
		||||
    #endif
 | 
			
		||||
| 
						 | 
				
			
			@ -439,7 +440,6 @@ if (audio_config.enable && voices < 8) {
 | 
			
		|||
        TCCR3A |= _BV(COM3A1);
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    note = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
#include <avr/io.h>
 | 
			
		||||
#include <util/delay.h>
 | 
			
		||||
#include "musical_notes.h"
 | 
			
		||||
#include "song_list.h"
 | 
			
		||||
 | 
			
		||||
#ifndef AUDIO_H
 | 
			
		||||
#define AUDIO_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue