MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / AISetDSPSampleRate

Function AISetDSPSampleRate

src/dolphin/src/ai/ai.c:92–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void AISetDSPSampleRate(u32 rate)
93{
94 u32 state;
95 s32 oldInts;
96 u8 left;
97 u8 right;
98 u32 sampleRate;
99
100 if (rate == AIGetDSPSampleRate())
101 {
102 return;
103 }
104
105 __AIRegs[0] &= ~0x40;
106 if (rate == 0)
107 {
108 left = AIGetStreamVolLeft();
109 right = AIGetStreamVolRight();
110 state = AIGetStreamPlayState();
111 sampleRate = AIGetStreamSampleRate();
112 AISetStreamVolLeft(0);
113 AISetStreamVolRight(0);
114 oldInts = OSDisableInterrupts();
115 __AI_SRC_INIT();
116 __AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20;
117 __AIRegs[0] = (__AIRegs[0] & ~2) | (sampleRate * 2);
118 __AIRegs[0] = (__AIRegs[0] & ~1) | state;
119 __AIRegs[0] |= 0x40;
120 OSRestoreInterrupts(oldInts);
121 AISetStreamVolLeft(left);
122 AISetStreamVolRight(right);
123 }
124}
125
126u32 AIGetDSPSampleRate()
127{

Callers 1

AIInitFunction · 0.85

Calls 8

AIGetDSPSampleRateFunction · 0.85
AIGetStreamVolLeftFunction · 0.85
AIGetStreamVolRightFunction · 0.85
AIGetStreamPlayStateFunction · 0.85
AIGetStreamSampleRateFunction · 0.85
AISetStreamVolLeftFunction · 0.85
AISetStreamVolRightFunction · 0.85
OSDisableInterruptsFunction · 0.85

Tested by

no test coverage detected