Experimental implementation of the adaptive filter of "Interface" magazine in 2016-2017
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
signal_processing.cpp
00001 #include "signal_processing.h" 00002 00003 /*========================= Project Dependent Method =========================*/ 00004 // Modify this constructor to initialize your audio algorithm. 00005 SignalProcessing::SignalProcessing( unsigned int block_size ) 00006 { 00007 // place the signal processing initializing code here. 00008 this->volume_level = 0.0; // sample initializaiton 00009 } // End of constructor() 00010 00011 00012 // Modify this method to implement your audio algorithm. 00013 void SignalProcessing::run( 00014 float rx_left_buffer[], // array of the left input samples 00015 float rx_right_buffer[], // array of the right input samples 00016 float tx_left_buffer[], // place to write the left output samples 00017 float tx_right_buffer[], // place to write the right output samples 00018 unsigned int block_size // block size [sample] 00019 ) 00020 { 00021 // place the signal processing coce here 00022 for ( int i= 0; i< block_size; i++ ) 00023 { 00024 tx_left_buffer[i] = rx_left_buffer[i] * this->volume_level; 00025 tx_right_buffer[i] = rx_right_buffer[i] * this->volume_level; 00026 } 00027 } // End of run() 00028 00029 00030 // Sample method. Set the volume level to the object. 00031 void SignalProcessing::set_volume( float vol ) 00032 { 00033 this->enter_critical_section(); // forbidden interrrupt. 00034 this->volume_level = vol; 00035 this->leave_critical_section(); // now, ok to accept interrupt. 00036 } 00037 00038 00039 00040 /************************** skeleton dependent methond. ***********************/ 00041 // essential members. Do not touch. 00042 void SignalProcessing::enter_critical_section(void) 00043 { 00044 __disable_irq(); // globaly forbid all interrupt 00045 } 00046 00047 void SignalProcessing::leave_critical_section(void) 00048 { 00049 __enable_irq(); // globaly allow all interrupts 00050 } 00051
Generated on Fri Jul 15 2022 03:14:00 by 1.7.2