Save resources if SPDIF or MIXER not enabled

This commit is contained in:
Russell
2011-11-21 11:35:28 +00:00
parent 697f68344b
commit af0d46800d
5 changed files with 26 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ extern void device_reboot(void);
/* I2S delivery thread */
#pragma unsafe arrays
unsigned deliver(chanend c_out, chanend c_spd_out, unsigned divide, chanend ?c_dig_rx)
unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_dig_rx)
{
unsigned sample;
#if NUM_USB_CHAN_OUT > 0
@@ -515,7 +515,9 @@ static unsigned dummy_deliver(chanend c_out) {
void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config)
{
#ifdef SPDIF
chan c_spdif_out;
#endif
unsigned curSamFreq = DEFAULT_FREQ;
unsigned mClk;
unsigned divide;
@@ -589,7 +591,13 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config)
outuint(c_spdif_out, mClk);
#endif
curSamFreq = deliver(c_mix_out, c_spdif_out, divide, c_dig_rx);
curSamFreq = deliver(c_mix_out,
#ifdef SPDIF
c_spdif_out,
#else
null,
#endif
divide, c_dig_rx);
// Currently no more audio will happen after this point
if (curSamFreq == AUDIO_STOP_FOR_DFU)