forked from PAWPAW-Mirror/lib_xua
Updated level meter buffer names to make sense! Also dealt with some disjointness checking issues due to tools changes.
This commit is contained in:
@@ -60,14 +60,17 @@ xc_ptr mix_map;
|
||||
#endif
|
||||
|
||||
/* Arrays for level data */
|
||||
int samples_to_host_inputs[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. dev inputs */
|
||||
int samples_to_host_inputs[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. device inputs */
|
||||
xc_ptr samples_to_host_inputs_ptr;
|
||||
|
||||
#ifdef LEVEL_METER_LEDS
|
||||
int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. dev inputs */
|
||||
#endif
|
||||
static int samples_to_host_streams[NUM_USB_CHAN_OUT]; /* Audio stream to host from host */
|
||||
#if (MAX_MIX_COUNT > 0)
|
||||
static int samples_to_host_outputs[NUM_USB_CHAN_OUT]; /* Device outputs */
|
||||
int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; /* Audio transmitted to host i.e. dev inputs */
|
||||
#endif
|
||||
static int samples_from_host_streams[NUM_USB_CHAN_OUT]; /* Peak samples for audio stream from host */
|
||||
|
||||
static int samples_mixer_outputs[MAX_MIX_COUNT]; /* Peak samples out of the mixer */
|
||||
xc_ptr samples_mixer_outputs_ptr;
|
||||
|
||||
#if 0
|
||||
#pragma xta command "add exclusion mixer1_rate_change"
|
||||
#pragma xta command "analyse path mixer1_req mixer1_req"
|
||||
@@ -87,18 +90,15 @@ static inline void ComputeMixerLevel(int sample, int i)
|
||||
int y;
|
||||
xc_ptr ptr;
|
||||
|
||||
|
||||
x = abs(sample);
|
||||
|
||||
/* y = samples_to_host_outputs[i] */
|
||||
asm("ldaw %0, dp[samples_to_host_outputs]":"=r"(ptr):); /* Might want to hoist this */
|
||||
asm("ldw %0, %1[%2]":"=r"(y):"r"(ptr),"r"(i));
|
||||
/* y = samples_mixer_outputs[i] */
|
||||
read_via_xc_ptr_indexed(y, samples_mixer_outputs_ptr, i);
|
||||
|
||||
if(x > y)
|
||||
{
|
||||
/* samples_to_host_outputs[i] = x; */
|
||||
write_via_xc_ptr_indexed(ptr,i,y);
|
||||
//asm("stw %0, %1[%2]"::"r"(y),"r"(ptr),"r"(i));
|
||||
write_via_xc_ptr_indexed(samples_mixer_outputs_ptr,i,x);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -205,8 +205,10 @@ static inline void getSamplesFromHost(chanend c, xc_ptr samples, int base, unsig
|
||||
#if defined (LEVEL_METER_HOST) || defined(LEVEL_METER_LEDS)
|
||||
/* Compute peak level data */
|
||||
x = abs(sample);
|
||||
if(x > samples_to_host_streams[i])
|
||||
samples_to_host_streams[i] = x;
|
||||
if(x > samples_from_host_streams[i])
|
||||
{
|
||||
samples_from_host_streams[i] = x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(OUT_VOLUME_IN_MIXER) && !defined(OUT_VOLUME_AFTER_MIX)
|
||||
@@ -278,13 +280,20 @@ static inline void getSamplesFromDevice(chanend c, xc_ptr samples, int base)
|
||||
{
|
||||
int sample;
|
||||
int x;
|
||||
int old_x;
|
||||
sample = inuint(c);
|
||||
|
||||
#if defined (LEVEL_METER_HOST) || defined(LEVEL_METER_LEDS)
|
||||
/* Compute peak level data */
|
||||
x = abs(sample);
|
||||
if(x > samples_to_host_inputs[i])
|
||||
samples_to_host_inputs[i] = x;
|
||||
|
||||
// old_x = samples_to_host_inputs[i]
|
||||
read_via_xc_ptr_indexed(old_x, samples_to_host_inputs_ptr, i);
|
||||
if(x > old_x)
|
||||
{
|
||||
//samples_to_host_inputs[i] = x;
|
||||
write_via_xc_ptr_indexed(samples_to_host_inputs_ptr, i, x);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(IN_VOLUME_IN_MIXER) && !defined(IN_VOLUME_AFTER_MIX)
|
||||
@@ -300,7 +309,6 @@ static inline void getSamplesFromDevice(chanend c, xc_ptr samples, int base)
|
||||
|
||||
static int mixer1_mix2_flag = (DEFAULT_FREQ > 96000);
|
||||
|
||||
|
||||
#pragma unsafe arrays
|
||||
static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2)
|
||||
{
|
||||
@@ -387,12 +395,13 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2)
|
||||
break;
|
||||
#endif
|
||||
|
||||
/* Peak samples of stream from host to device (via USB) */
|
||||
case GET_STREAM_LEVELS:
|
||||
index = inuint(c_mix_ctl);
|
||||
chkct(c_mix_ctl, XS1_CT_END);
|
||||
outuint(c_mix_ctl, samples_to_host_streams[index]);
|
||||
outuint(c_mix_ctl, samples_from_host_streams[index]);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
samples_to_host_streams[index] = 0;
|
||||
samples_from_host_streams[index] = 0;
|
||||
break;
|
||||
|
||||
case GET_INPUT_LEVELS:
|
||||
@@ -401,23 +410,32 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2)
|
||||
#ifdef LEVEL_METER_LEDS
|
||||
/* Level LEDS process reseting samples_to_host_inputs
|
||||
* Other side makes sure we don't miss a peak */
|
||||
//val = samples_to_host_inputs_buff[index];
|
||||
//samples_to_host_inputs_buff[index] = 0;
|
||||
/* Access funcs used to avoid disjointness check */
|
||||
read_via_xc_ptr_indexed(val, samples_to_host_inputs_buff, index);
|
||||
write_via_xc_ptr_indexed(samples_to_host_inputs_buff, index, 0);
|
||||
#else
|
||||
/* We dont have a level LEDs process, so reset ourselves */
|
||||
read_via_xc_ptr_indexed(val, samples_to_host_inputs, index);
|
||||
write_via_xc_ptr_indexed(samples_to_host_inputs, index, 0);
|
||||
//val = samples_to_host_inputs[index];
|
||||
//samples_to_host_inputs[index] = 0;
|
||||
/* Access funcs used to avoid disjointness check */
|
||||
read_via_xc_ptr_indexed(val, samples_to_host_inputs_ptr, index);
|
||||
write_via_xc_ptr_indexed(samples_to_host_inputs_ptr, index, 0);
|
||||
#endif
|
||||
outuint(c_mix_ctl, val);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
break;
|
||||
|
||||
#if MAX_MIX_COUNT > 0
|
||||
#if (MAX_MIX_COUNT > 0)
|
||||
/* Peak samples of the mixer outputs */
|
||||
case GET_OUTPUT_LEVELS:
|
||||
index = inuint(c_mix_ctl);
|
||||
chkct(c_mix_ctl, XS1_CT_END);
|
||||
read_via_xc_ptr_indexed(val, samples_to_host_outputs, index);
|
||||
write_via_xc_ptr_indexed(samples_to_host_outputs, index, mix);
|
||||
read_via_xc_ptr_indexed(val, samples_mixer_outputs, index);
|
||||
write_via_xc_ptr_indexed(samples_mixer_outputs, index, 0);
|
||||
//val = samples_mixer_outputs[index];
|
||||
//samples_mixer_outputs[index] = 0;
|
||||
outuint(c_mix_ctl, val);
|
||||
outct(c_mix_ctl, XS1_CT_END);
|
||||
break;
|
||||
@@ -689,9 +707,11 @@ void mixer(chanend c_mix_in, chanend c_mix_out, chanend c_mix_ctl)
|
||||
multIn = array_to_xc_ptr((multIn_array,unsigned[]));
|
||||
samples = array_to_xc_ptr((samples_array,unsigned[]));
|
||||
samples_to_host_map = array_to_xc_ptr((samples_to_host_map_array,unsigned[]));
|
||||
|
||||
samples_to_device_map = array_to_xc_ptr((samples_to_device_map_array,unsigned[]));
|
||||
|
||||
samples_to_host_inputs_ptr = array_to_xc_ptr((samples_to_host_inputs, unsigned[]));
|
||||
samples_mixer_outputs_ptr = array_to_xc_ptr((samples_mixer_outputs, unsigned[]));
|
||||
|
||||
#if MAX_MIX_COUNT >0
|
||||
mix_mult = array_to_xc_ptr((mix_mult_array,unsigned[]));
|
||||
#ifndef FAST_MIXER
|
||||
|
||||
Reference in New Issue
Block a user