Trying a faster way to mix stereo to mono.

Garbage collection at config.h.
pull/6/head
Holger Wirtz 5 years ago
parent 2aad206764
commit ef104f6909
  1. 24
      config.h
  2. 10
      effect_stereo_mono.cpp

@ -44,12 +44,16 @@
//* DEVICE SETTINGS
//*************************************************************************************************
// MIDI
//*************************************************************************************************
//* MIDI HARDWARE SETTINGS
//*************************************************************************************************
//#define MIDI_DEVICE_DIN Serial1
#define MIDI_DEVICE_USB 1
#define MIDI_DEVICE_USB_HOST 1
// AUDIO
//*************************************************************************************************
//* AUDIO HARDWARE SETTINGS
//*************************************************************************************************
// If nothing is defined Teensy internal DAC is used as audio output device!
// Left and right channel audio signal is presented on pins A21 and A22.
#define AUDIO_DEVICE_USB
@ -61,9 +65,8 @@
#define PT8211_AUDIO
//*************************************************************************************************
//* MIDI SETTINGS
//* MIDI SOFTWARE SETTINGS
//*************************************************************************************************
#define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI
#define MIDI_MERGE_THRU 1
#define SYSEXBANK_DEFAULT 0
@ -82,7 +85,7 @@
//#define USE_REVERB 1
//*************************************************************************************************
//* AUDIO SETTINGS
//* AUDIO SOFTWARE SETTINGS
//*************************************************************************************************
// https://rechneronline.de/funktionsgraphen/
#ifndef TEENSY_AUDIO_BOARD
@ -141,7 +144,6 @@
#endif
#define CONTROL_RATE_MS 50
#define BACK_FROM_VOLUME_MS 1000
//*************************************************************************************************
@ -156,7 +158,6 @@
//*************************************************************************************************
//* HARDWARE SETTINGS
//*************************************************************************************************
#if defined(__IMXRT1062__) //Teensy-4.0
#define TEENSY4
#endif
@ -248,9 +249,8 @@
// Some optimizations
#define USE_TEENSY_DSP 1
#define SUM_UP_AS_INT 1
/* HELPER MACROS */
// HELPER MACROS
#define TIME_MS2SAMPLES(x) floor(uint32_t(x) * AUDIO_SAMPLE_RATE / 1000)
#define SAMPLES2TIME_MS(x) float(uint32_t(x) * 1000 / AUDIO_SAMPLE_RATE)
// Modulated delay options
@ -367,12 +367,6 @@ struct config_t {
uint8_t engine;
};
// struct for smoothing value changes
struct value_change_t {
float diff;
uint16_t steps;
};
inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)
{
return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

@ -45,6 +45,7 @@ void AudioEffectStereoMono::update(void)
{
if (block[0] && block[1])
{
#ifdef USE_OLD_STEREO_TO_MONO
int16_t *bp[2] = { block[0]->data, block[1]->data };
for (uint16_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++)
@ -54,6 +55,15 @@ void AudioEffectStereoMono::update(void)
bp[0]++;
bp[1]++;
}
#else
// device every channel by 2
arm_shift_q15(block[0]->data, -1, block[0]->data, AUDIO_BLOCK_SAMPLES);
arm_shift_q15(block[1]->data, -1, block[1]->data, AUDIO_BLOCK_SAMPLES);
// add channel 2 to channel 1
arm_add_q15(block[0]->data, block[1]->data, block[0]->data, AUDIO_BLOCK_SAMPLES);
// copy channel 1 to channel 2
arm_copy_q15(block[0]->data, block[1]->data, AUDIO_BLOCK_SAMPLES);
#endif
}
}

Loading…
Cancel
Save