StreamADPCM: Convert into a namespace
No need to have a class with only static member functions
This commit is contained in:
parent
e955a3a191
commit
737de5e115
|
@ -375,15 +375,15 @@ static u32 ProcessDTKSamples(short *tempPCM, u32 num_samples)
|
|||
break;
|
||||
}
|
||||
|
||||
NGCADPCM::InitFilter();
|
||||
StreamADPCM::InitFilter();
|
||||
}
|
||||
|
||||
u8 tempADPCM[NGCADPCM::ONE_BLOCK_SIZE];
|
||||
u8 tempADPCM[StreamADPCM::ONE_BLOCK_SIZE];
|
||||
// TODO: What if we can't read from AudioPos?
|
||||
s_inserted_volume->Read(AudioPos, sizeof(tempADPCM), tempADPCM, false);
|
||||
AudioPos += sizeof(tempADPCM);
|
||||
NGCADPCM::DecodeBlock(tempPCM + samples_processed * 2, tempADPCM);
|
||||
samples_processed += NGCADPCM::SAMPLES_PER_BLOCK;
|
||||
StreamADPCM::DecodeBlock(tempPCM + samples_processed * 2, tempADPCM);
|
||||
samples_processed += StreamADPCM::SAMPLES_PER_BLOCK;
|
||||
} while (samples_processed < num_samples);
|
||||
for (unsigned i = 0; i < samples_processed * 2; ++i)
|
||||
{
|
||||
|
@ -1184,7 +1184,7 @@ void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_addr
|
|||
CurrentStart = NextStart;
|
||||
CurrentLength = NextLength;
|
||||
AudioPos = CurrentStart;
|
||||
NGCADPCM::InitFilter();
|
||||
StreamADPCM::InitFilter();
|
||||
g_bStream = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
#include "Common/MathUtil.h"
|
||||
#include "Core/HW/StreamADPCM.h"
|
||||
|
||||
namespace StreamADPCM
|
||||
{
|
||||
|
||||
// STATE_TO_SAVE (not saved yet!)
|
||||
static s32 histl1;
|
||||
static s32 histl2;
|
||||
|
@ -44,7 +47,7 @@ static s16 ADPDecodeSample(s32 bits, s32 q, s32& hist1, s32& hist2)
|
|||
return (s16)cur;
|
||||
}
|
||||
|
||||
void NGCADPCM::InitFilter()
|
||||
void InitFilter()
|
||||
{
|
||||
histl1 = 0;
|
||||
histl2 = 0;
|
||||
|
@ -52,7 +55,7 @@ void NGCADPCM::InitFilter()
|
|||
histr2 = 0;
|
||||
}
|
||||
|
||||
void NGCADPCM::DecodeBlock(s16 *pcm, const u8 *adpcm)
|
||||
void DecodeBlock(s16* pcm, const u8* adpcm)
|
||||
{
|
||||
for (int i = 0; i < SAMPLES_PER_BLOCK; i++)
|
||||
{
|
||||
|
@ -60,3 +63,5 @@ void NGCADPCM::DecodeBlock(s16 *pcm, const u8 *adpcm)
|
|||
pcm[i * 2 + 1] = ADPDecodeSample(adpcm[i + (ONE_BLOCK_SIZE - SAMPLES_PER_BLOCK)] >> 4, adpcm[1], histr1, histr2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,15 +8,16 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class NGCADPCM
|
||||
namespace StreamADPCM
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
ONE_BLOCK_SIZE = 32,
|
||||
SAMPLES_PER_BLOCK = 28
|
||||
};
|
||||
|
||||
static void InitFilter();
|
||||
static void DecodeBlock(s16 *pcm, const u8 *adpcm);
|
||||
enum
|
||||
{
|
||||
ONE_BLOCK_SIZE = 32,
|
||||
SAMPLES_PER_BLOCK = 28
|
||||
};
|
||||
|
||||
void InitFilter();
|
||||
void DecodeBlock(s16* pcm, const u8* adpcm);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue