Sample shift up after volume macs no longer done in audio(). Now done in mixer(). This allows lower bits to be properly retained for 32bit (and DSD native)

This commit is contained in:
Ross Owen
2014-05-20 17:18:01 +01:00
parent d28a41e6ed
commit ccf7c66588
2 changed files with 10 additions and 9 deletions

View File

@@ -261,9 +261,6 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, unsi
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
{
int tmp = inuint(c_out);
#if defined(OUT_VOLUME_IN_MIXER) && defined(OUT_VOLUME_AFTER_MIX)
tmp<<=3;
#endif
samplesOut[i] = tmp;
}
}
@@ -451,9 +448,6 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, unsi
for(int i = 0; i < NUM_USB_CHAN_OUT; i++)
{
int tmp = inuint(c_out);
#if defined(OUT_VOLUME_IN_MIXER) && defined(OUT_VOLUME_AFTER_MIX)
tmp<<=3;
#endif
samplesOut[i] = tmp;
}
}
@@ -542,7 +536,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, unsi
}
else if(dsdMode == DSD_MODE_DOP)
{
if(!everyOther)
if(!everyOther)
{
dsdSample_l = ((samplesOut[0] & 0xffff00) << 8);
dsdSample_r = ((samplesOut[1] & 0xffff00) << 8);

View File

@@ -214,7 +214,10 @@ static void getSamplesFromHost(chanend c, xc_ptr samples, int base, unsigned und
read_via_xc_ptr_indexed(mult, multOut, i);
{h, l} = macs(mult, sample, 0, 0);
h<<=3;
#if (STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED == 1)
h |= (l >>29)& 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
// Note: We need all 32bits for Native DSD
#endif
write_via_xc_ptr_indexed(multOut, index, val);
write_via_xc_ptr_indexed(samples,base+i,h);
#else
@@ -248,7 +251,11 @@ static void giveSamplesToDevice(chanend c, xc_ptr samples, xc_ptr ptr, xc_ptr mu
#warning OUT Vols in mixer, AFTER mix & map
read_via_xc_ptr_indexed(mult, multOut, i);
{h, l} = macs(mult, sample, 0, 0);
//h <<= 3 done in audio thread
h<<=3; // Shift used to be done in audio thread but now done here incase of 32bit support
#if (STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED == 1)
h |= (l >>29)& 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
// Note: We need all 32bits for Native DSD
#endif
outuint(c, h);
#else
outuint(c, sample);