[Project64] Cleanup Audio.cpp
This commit is contained in:
parent
03a41c7cd3
commit
089b036cfe
|
@ -17,7 +17,6 @@ CAudio::CAudio()
|
||||||
|
|
||||||
CAudio::~CAudio()
|
CAudio::~CAudio()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::Reset()
|
void CAudio::Reset()
|
||||||
|
@ -32,31 +31,32 @@ void CAudio::Reset()
|
||||||
|
|
||||||
DWORD CAudio::GetLength()
|
DWORD CAudio::GetLength()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||||
DWORD TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
|
DWORD TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
|
||||||
if (TimeLeft > 0)
|
if (TimeLeft > 0)
|
||||||
{
|
{
|
||||||
Res = (TimeLeft / m_CountsPerByte);
|
Res = (TimeLeft / m_CountsPerByte);
|
||||||
}
|
}
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done (res = %d, TimeLeft = %d)",Res, TimeLeft);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Done (res = %d, TimeLeft = %d)", Res, TimeLeft);
|
||||||
return (Res+3)&~3;
|
return (Res + 3)&~3;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CAudio::GetStatus()
|
DWORD CAudio::GetStatus()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": m_Status = %X",m_Status);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": m_Status = %X", m_Status);
|
||||||
return m_Status;
|
return m_Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::LenChanged()
|
void CAudio::LenChanged()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)",g_Reg->AI_LEN_REG);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)", g_Reg->AI_LEN_REG);
|
||||||
if (g_Reg->AI_LEN_REG != 0)
|
if (g_Reg->AI_LEN_REG != 0)
|
||||||
{
|
{
|
||||||
if (g_Reg->AI_LEN_REG >= 0x40000)
|
if (g_Reg->AI_LEN_REG >= 0x40000)
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Ignoring Write, To Large (%X)",g_Reg->AI_LEN_REG);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_Status |= ai_busy;
|
m_Status |= ai_busy;
|
||||||
DWORD AudioLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt);
|
DWORD AudioLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt);
|
||||||
if (m_SecondBuff == 0)
|
if (m_SecondBuff == 0)
|
||||||
|
@ -81,7 +81,7 @@ void CAudio::LenChanged()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Reset Timer to 0");
|
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Reset Timer to 0");
|
||||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
||||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
||||||
m_SecondBuff = 0;
|
m_SecondBuff = 0;
|
||||||
|
@ -92,18 +92,18 @@ void CAudio::LenChanged()
|
||||||
{
|
{
|
||||||
g_Plugins->Audio()->AiLenChanged();
|
g_Plugins->Audio()->AiLenChanged();
|
||||||
}
|
}
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done");
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::InterruptTimerDone()
|
void CAudio::InterruptTimerDone()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||||
m_Status &= ~ai_full;
|
m_Status &= ~ai_full;
|
||||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||||
g_Reg->CheckInterrupts();
|
g_Reg->CheckInterrupts();
|
||||||
if (m_SecondBuff != 0)
|
if (m_SecondBuff != 0)
|
||||||
{
|
{
|
||||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt,m_SecondBuff * m_CountsPerByte,false);
|
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, m_SecondBuff * m_CountsPerByte, false);
|
||||||
m_SecondBuff = 0;
|
m_SecondBuff = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -114,17 +114,17 @@ void CAudio::InterruptTimerDone()
|
||||||
{
|
{
|
||||||
g_System->SyncToAudio();
|
g_System->SyncToAudio();
|
||||||
}
|
}
|
||||||
WriteTrace(TraceAudio,__FUNCTION__ ": Done");
|
WriteTrace(TraceAudio, __FUNCTION__ ": Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::BusyTimerDone()
|
void CAudio::BusyTimerDone()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
m_Status &= ~ai_busy;
|
m_Status &= ~ai_busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::SetViIntr ( DWORD VI_INTR_TIME )
|
void CAudio::SetViIntr(DWORD VI_INTR_TIME)
|
||||||
{
|
{
|
||||||
double CountsPerSecond = (DWORD)((double)VI_INTR_TIME * m_FramesPerSecond);
|
double CountsPerSecond = (DWORD)((double)VI_INTR_TIME * m_FramesPerSecond);
|
||||||
if (m_BytesPerSecond != 0 && (g_System->AiCountPerBytes() == 0))
|
if (m_BytesPerSecond != 0 && (g_System->AiCountPerBytes() == 0))
|
||||||
|
@ -133,10 +133,9 @@ void CAudio::SetViIntr ( DWORD VI_INTR_TIME )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAudio::SetFrequency(DWORD Dacrate, DWORD System)
|
||||||
void CAudio::SetFrequency (DWORD Dacrate, DWORD System)
|
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X",Dacrate,System,g_Reg->AI_BITRATE_REG);
|
WriteTraceF(TraceAudio, __FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X", Dacrate, System, g_Reg->AI_BITRATE_REG);
|
||||||
DWORD Frequency;
|
DWORD Frequency;
|
||||||
|
|
||||||
switch (System)
|
switch (System)
|
||||||
|
|
|
@ -21,14 +21,14 @@ public:
|
||||||
CAudio();
|
CAudio();
|
||||||
~CAudio();
|
~CAudio();
|
||||||
|
|
||||||
DWORD GetLength ();
|
DWORD GetLength();
|
||||||
DWORD GetStatus ();
|
DWORD GetStatus();
|
||||||
void LenChanged ();
|
void LenChanged();
|
||||||
void InterruptTimerDone();
|
void InterruptTimerDone();
|
||||||
void BusyTimerDone ();
|
void BusyTimerDone();
|
||||||
void Reset ();
|
void Reset();
|
||||||
void SetViIntr ( DWORD VI_INTR_TIME );
|
void SetViIntr(DWORD VI_INTR_TIME);
|
||||||
void SetFrequency ( DWORD Dacrate, DWORD System );
|
void SetFrequency(DWORD Dacrate, DWORD System);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWORD m_SecondBuff;
|
DWORD m_SecondBuff;
|
||||||
|
|
Loading…
Reference in New Issue