|
|
@ -100,9 +100,6 @@ uint32_t xrun = 0; |
|
|
|
uint32_t overload = 0; |
|
|
|
uint32_t overload = 0; |
|
|
|
uint32_t peak = 0; |
|
|
|
uint32_t peak = 0; |
|
|
|
uint16_t render_time_max = 0; |
|
|
|
uint16_t render_time_max = 0; |
|
|
|
float vol = VOLUME; |
|
|
|
|
|
|
|
float vol_right = 1.0; |
|
|
|
|
|
|
|
float vol_left = 1.0; |
|
|
|
|
|
|
|
elapsedMicros fill_audio_buffer; |
|
|
|
elapsedMicros fill_audio_buffer; |
|
|
|
elapsedMillis control_rate; |
|
|
|
elapsedMillis control_rate; |
|
|
|
elapsedMillis autostore; |
|
|
|
elapsedMillis autostore; |
|
|
@ -197,7 +194,7 @@ void setup() |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//set_volume(vol, vol_left, vol_right);
|
|
|
|
//set_volume(vol, vol_left, vol_right);
|
|
|
|
set_volume(1.0, 1.0, 1.0); |
|
|
|
set_volume(1.0, 0.5); |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
// Initialize processor and memory measurements
|
|
|
|
// Initialize processor and memory measurements
|
|
|
@ -293,14 +290,6 @@ void loop() |
|
|
|
peak++; |
|
|
|
peak++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifndef TEENSY_AUDIO_BOARD |
|
|
|
|
|
|
|
for (uint8_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
audio_buffer_r[i] *= vol; |
|
|
|
|
|
|
|
audio_buffer_l[i] *= vol; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queue_r.playBuffer(); |
|
|
|
queue_r.playBuffer(); |
|
|
|
queue_l.playBuffer(); |
|
|
|
queue_l.playBuffer(); |
|
|
|
} |
|
|
|
} |
|
|
@ -311,13 +300,9 @@ void loop() |
|
|
|
if (control_rate > CONTROL_RATE_MS) |
|
|
|
if (control_rate > CONTROL_RATE_MS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
control_rate = 0; |
|
|
|
control_rate = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*************************************************************************************************
|
|
|
|
//*************************************************************************************************
|
|
|
|
//* PROGRAM FUNCTIONS
|
|
|
|
//* PROGRAM FUNCTIONS
|
|
|
|
//*************************************************************************************************
|
|
|
|
//*************************************************************************************************
|
|
|
@ -446,9 +431,28 @@ bool checkMidiChannel(byte inChannel) |
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void set_volume(float v, float vr, float vl) |
|
|
|
void set_volume(float v, float p) |
|
|
|
{ |
|
|
|
{ |
|
|
|
; |
|
|
|
configuration.vol = v; |
|
|
|
|
|
|
|
configuration.pan = p; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Setting volume: VOL=")); |
|
|
|
|
|
|
|
Serial.print(v, DEC); |
|
|
|
|
|
|
|
Serial.print(F("[")); |
|
|
|
|
|
|
|
Serial.print(configuration.vol, DEC); |
|
|
|
|
|
|
|
Serial.print(F("] PAN=")); |
|
|
|
|
|
|
|
Serial.print(F("[")); |
|
|
|
|
|
|
|
Serial.print(configuration.pan, DEC); |
|
|
|
|
|
|
|
Serial.print(F("] ")); |
|
|
|
|
|
|
|
Serial.print(pow(configuration.vol * sinf(configuration.pan * PI / 2), VOLUME_CURVE), 3); |
|
|
|
|
|
|
|
Serial.print(F("/")); |
|
|
|
|
|
|
|
Serial.println(pow(configuration.vol * cosf( configuration.pan * PI / 2), VOLUME_CURVE), 3); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html
|
|
|
|
|
|
|
|
mixer_r.gain(0,sinf(p * PI / 2)); |
|
|
|
|
|
|
|
mixer_l.gain(0,cosf(p * PI / 2)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
/******************************************************************************
|
|
|
|