Skip to content

Commit

Permalink
ac97: Disable pi/mc reads
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Jan 15, 2025
1 parent 0eddb3e commit 92adeca
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hw/audio/ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,19 @@ static void voice_set_active(AC97LinkState *s, int bm_index, int on)
{
switch (bm_index) {
case PI_INDEX:
#ifndef XBOX
AUD_set_active_in(s->voice_pi, on);
#endif
break;

case PO_INDEX:
AUD_set_active_out(s->voice_po, on);
break;

case MC_INDEX:
#ifndef XBOX
AUD_set_active_in(s->voice_mc, on);
#endif
break;

case SO_INDEX:
Expand Down Expand Up @@ -294,6 +298,7 @@ static void open_voice(AC97LinkState *s, int index, int freq)
s->invalid_freq[index] = 0;
switch (index) {
case PI_INDEX:
#ifndef XBOX
s->voice_pi = AUD_open_in(
&s->card,
s->voice_pi,
Expand All @@ -302,6 +307,7 @@ static void open_voice(AC97LinkState *s, int index, int freq)
pi_callback,
&as
);
#endif
break;

case PO_INDEX:
Expand All @@ -316,6 +322,7 @@ static void open_voice(AC97LinkState *s, int index, int freq)
break;

case MC_INDEX:
#ifndef XBOX
s->voice_mc = AUD_open_in(
&s->card,
s->voice_mc,
Expand All @@ -324,6 +331,7 @@ static void open_voice(AC97LinkState *s, int index, int freq)
mc_callback,
&as
);
#endif
break;

case SO_INDEX:
Expand All @@ -333,7 +341,9 @@ static void open_voice(AC97LinkState *s, int index, int freq)
s->invalid_freq[index] = freq;
switch (index) {
case PI_INDEX:
#ifndef XBOX
AUD_close_in(&s->card, s->voice_pi);
#endif
s->voice_pi = NULL;
break;

Expand All @@ -343,7 +353,9 @@ static void open_voice(AC97LinkState *s, int index, int freq)
break;

case MC_INDEX:
#ifndef XBOX
AUD_close_in(&s->card, s->voice_mc);
#endif
s->voice_mc = NULL;
break;

Expand All @@ -357,17 +369,21 @@ static void reset_voices(AC97LinkState *s, uint8_t active[LAST_INDEX])
{
uint16_t freq;

#ifndef XBOX
freq = mixer_load(s, AC97_PCM_LR_ADC_Rate);
open_voice(s, PI_INDEX, freq);
AUD_set_active_in(s->voice_pi, active[PI_INDEX]);
#endif

freq = mixer_load(s, AC97_PCM_Front_DAC_Rate);
open_voice(s, PO_INDEX, freq);
AUD_set_active_out(s->voice_po, active[PO_INDEX]);

#ifndef XBOX
freq = mixer_load(s, AC97_MIC_ADC_Rate);
open_voice(s, MC_INDEX, freq);
AUD_set_active_in(s->voice_mc, active[MC_INDEX]);
#endif
}

static void get_volume(uint16_t vol, uint16_t mask, int inverse,
Expand Down Expand Up @@ -408,7 +424,9 @@ static void update_volume_in(AC97LinkState *s)
get_volume(mixer_load(s, AC97_Record_Gain_Mute), 0x0f, 0,
&mute, &lvol, &rvol);

#ifndef XBOX
AUD_set_volume_in(s->voice_pi, mute, lvol, rvol);
#endif
}

static void set_volume(AC97LinkState *s, int index, uint32_t val)
Expand Down Expand Up @@ -972,6 +990,10 @@ static int read_audio(AC97LinkState *s, AC97BusMasterRegs *r,
int to_copy = 0;
SWVoiceIn *voice = (r - s->bm_regs) == MC_INDEX ? s->voice_mc : s->voice_pi;

#ifdef XBOX
return 0;
#endif

temp = MIN(temp, max);

if (!temp) {
Expand Down

0 comments on commit 92adeca

Please sign in to comment.