| #include "Audio.h" | |||||
| #include "analyze_fft256.h" | |||||
| #include "arm_math.h" | #include "arm_math.h" | ||||
| #include "utility/dspinst.h" | |||||
| // TODO: this should be a class member, so more than one FFT can be used | |||||
| static arm_cfft_radix4_instance_q15 fft_inst; | static arm_cfft_radix4_instance_q15 fft_inst; | ||||
| void AudioAnalyzeFFT256::init(void) | void AudioAnalyzeFFT256::init(void) |
| #define analyze_fft256_h_ | #define analyze_fft256_h_ | ||||
| #include "AudioStream.h" | #include "AudioStream.h" | ||||
| #include "arm_math.h" | |||||
| // windows.c | // windows.c | ||||
| extern "C" { | extern "C" { |
| #include "Audio.h" | |||||
| #include "analyze_print.h" | |||||
| // TODO: this needs some sort of trigger or delay or other options to make | // TODO: this needs some sort of trigger or delay or other options to make | ||||
| // actually useful for watching interesting parts of data, without spewing | // actually useful for watching interesting parts of data, without spewing | ||||
| // tremendous and endless data to the Arduino Serial Monitor | // tremendous and endless data to the Arduino Serial Monitor | ||||
| void AudioPrint::update(void) | void AudioPrint::update(void) | ||||
| { | { | ||||
| audio_block_t *block; | audio_block_t *block; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "analyze_tonedetect.h" | |||||
| #include "utility/dspinst.h" | #include "utility/dspinst.h" | ||||
| static inline int32_t multiply_32x32_rshift30(int32_t a, int32_t b) __attribute__((always_inline)); | static inline int32_t multiply_32x32_rshift30(int32_t a, int32_t b) __attribute__((always_inline)); | ||||
| static inline int32_t multiply_32x32_rshift30(int32_t a, int32_t b) | static inline int32_t multiply_32x32_rshift30(int32_t a, int32_t b) | ||||
| { | { |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "control_sgtl5000.h" | |||||
| #include "Wire.h" | #include "Wire.h" | ||||
| #define CHIP_ID 0x0000 | #define CHIP_ID 0x0000 |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "control_wm8731.h" | |||||
| #include "Wire.h" | #include "Wire.h" | ||||
| #define WM8731_I2C_ADDR 0x1A | #define WM8731_I2C_ADDR 0x1A |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "utility/dspinst.h" | |||||
| #include "effect_chorus.h" | |||||
| /******************************************************************/ | /******************************************************************/ | ||||
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "effect_fade.h" | |||||
| #include "utility/dspinst.h" | #include "utility/dspinst.h" | ||||
| extern "C" { | extern "C" { | ||||
| extern const int16_t fader_table[256]; | extern const int16_t fader_table[256]; | ||||
| }; | }; | ||||
| void AudioEffectFade::update(void) | void AudioEffectFade::update(void) | ||||
| { | { | ||||
| audio_block_t *block; | audio_block_t *block; |
| #include "Audio.h" | |||||
| #include "effect_flange.h" | |||||
| #include "arm_math.h" | #include "arm_math.h" | ||||
| #include "utility/dspinst.h" | |||||
| /******************************************************************/ | /******************************************************************/ | ||||
| // A u d i o E f f e c t F l a n g e | // A u d i o E f f e c t F l a n g e |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "filter_biquad.h" | |||||
| #include "utility/dspinst.h" | #include "utility/dspinst.h" | ||||
| void AudioFilterBiquad::update(void) | void AudioFilterBiquad::update(void) | ||||
| { | { | ||||
| audio_block_t *block; | audio_block_t *block; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "utility/dspinst.h" | |||||
| #include "filter_fir.h" | |||||
| void AudioFilterFIR::begin(short *cp,int n_coeffs) | void AudioFilterFIR::begin(short *cp,int n_coeffs) | ||||
| { | { |
| #define filter_fir_h_ | #define filter_fir_h_ | ||||
| #include "AudioStream.h" | #include "AudioStream.h" | ||||
| #include "arm_math.h" | |||||
| // Maximum number of coefficients in a FIR filter | // Maximum number of coefficients in a FIR filter | ||||
| // The audio breaks up with 128 coefficients so a | // The audio breaks up with 128 coefficients so a |
| #include "Audio.h" | |||||
| #include "input_adc.h" | |||||
| #include "utility/pdb.h" | #include "utility/pdb.h" | ||||
| DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES]; | DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES]; | ||||
| audio_block_t * AudioInputAnalog::block_left = NULL; | audio_block_t * AudioInputAnalog::block_left = NULL; | ||||
| uint16_t AudioInputAnalog::block_offset = 0; | uint16_t AudioInputAnalog::block_offset = 0; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "input_i2s.h" | |||||
| #include "output_i2s.h" | |||||
| DMAMEM static uint32_t i2s_rx_buffer[AUDIO_BLOCK_SAMPLES]; | DMAMEM static uint32_t i2s_rx_buffer[AUDIO_BLOCK_SAMPLES]; | ||||
| audio_block_t * AudioInputI2S::block_left = NULL; | audio_block_t * AudioInputI2S::block_left = NULL; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "mixer.h" | |||||
| #include "utility/dspinst.h" | #include "utility/dspinst.h" | ||||
| void applyGain(int16_t *data, int32_t mult) | void applyGain(int16_t *data, int32_t mult) | ||||
| { | { | ||||
| uint32_t *p = (uint32_t *)data; | uint32_t *p = (uint32_t *)data; |
| #include "Audio.h" | |||||
| #include "output_dac.h" | |||||
| #include "utility/pdb.h" | #include "utility/pdb.h" | ||||
| // #define PDB_CONFIG (PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT) | |||||
| // #define PDB_PERIOD 1087 // 48e6 / 44100 | |||||
| #if defined(__MK20DX256__) | #if defined(__MK20DX256__) | ||||
| DMAMEM static uint16_t dac_buffer[AUDIO_BLOCK_SAMPLES*2]; | DMAMEM static uint16_t dac_buffer[AUDIO_BLOCK_SAMPLES*2]; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "output_i2s.h" | |||||
| // MCLK needs to be 48e6 / 1088 * 256 = 11.29411765 MHz -> 44.117647 kHz sample rate | // MCLK needs to be 48e6 / 1088 * 256 = 11.29411765 MHz -> 44.117647 kHz sample rate | ||||
| // Possible to create using fractional divider for all USB-compatible Kinetis: | // Possible to create using fractional divider for all USB-compatible Kinetis: | ||||
| // clock, which has audio band jitter from the PLL | // clock, which has audio band jitter from the PLL | ||||
| audio_block_t * AudioOutputI2S::block_left_1st = NULL; | audio_block_t * AudioOutputI2S::block_left_1st = NULL; | ||||
| audio_block_t * AudioOutputI2S::block_right_1st = NULL; | audio_block_t * AudioOutputI2S::block_right_1st = NULL; | ||||
| audio_block_t * AudioOutputI2S::block_left_2nd = NULL; | audio_block_t * AudioOutputI2S::block_left_2nd = NULL; | ||||
| } | } | ||||
| void dma_ch0_isr(void) | void dma_ch0_isr(void) | ||||
| { | { | ||||
| const int16_t *src, *end; | const int16_t *src, *end; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "output_pwm.h" | |||||
| audio_block_t * AudioOutputPWM::block_1st = NULL; | audio_block_t * AudioOutputPWM::block_1st = NULL; | ||||
| audio_block_t * AudioOutputPWM::block_2nd = NULL; | audio_block_t * AudioOutputPWM::block_2nd = NULL; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "play_memory.h" | |||||
| #include "utility/dspinst.h" | #include "utility/dspinst.h" | ||||
| void AudioPlayMemory::play(const unsigned int *data) | void AudioPlayMemory::play(const unsigned int *data) | ||||
| { | { | ||||
| uint32_t format; | uint32_t format; |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "utility/dspinst.h" | |||||
| #include "play_sd_raw.h" | |||||
| void AudioPlaySDcardRAW::begin(void) | void AudioPlaySDcardRAW::begin(void) |
| #include "Audio.h" | |||||
| #include "arm_math.h" | |||||
| #include "utility/dspinst.h" | |||||
| #include "play_sd_wav.h" | |||||
| #define STATE_DIRECT_8BIT_MONO 0 // playing mono at native sample rate | #define STATE_DIRECT_8BIT_MONO 0 // playing mono at native sample rate | ||||
| #define STATE_DIRECT_8BIT_STEREO 1 // playing stereo at native sample rate | #define STATE_DIRECT_8BIT_STEREO 1 // playing stereo at native sample rate |
| #include "Audio.h" | |||||
| #include "synth_tonesweep.h" | |||||
| #include "arm_math.h" | #include "arm_math.h" | ||||
| #include "utility/dspinst.h" | |||||
| // TODO: this object should be renamed to AudioSynthToneSweep | // TODO: this object should be renamed to AudioSynthToneSweep |
| #include "Audio.h" | |||||
| #include "synth_waveform.h" | |||||
| #include "arm_math.h" | #include "arm_math.h" | ||||
| #include "utility/dspinst.h" | #include "utility/dspinst.h" | ||||
| #ifdef ORIGINAL_AUDIOSYNTHWAVEFORM | #ifdef ORIGINAL_AUDIOSYNTHWAVEFORM | ||||
| /******************************************************************/ | /******************************************************************/ | ||||
| // PAH - add ramp-up and ramp-down to the onset of the wave | // PAH - add ramp-up and ramp-down to the onset of the wave |