CSND: add some capture commands

This commit is contained in:
fincs 2015-01-05 19:36:41 +01:00
parent 69ee2f97c5
commit 3fafe70f3b
2 changed files with 50 additions and 0 deletions

View File

@ -91,6 +91,11 @@ void CSND_ChnSetAdpcmState(u32 channel, int block, int sample, int index);
void CSND_ChnSetAdpcmReload(u32 channel, bool reload); void CSND_ChnSetAdpcmReload(u32 channel, bool reload);
void CSND_ChnConfig(u32 flags, u32 physaddr0, u32 physaddr1, u32 totalbytesize); void CSND_ChnConfig(u32 flags, u32 physaddr0, u32 physaddr1, u32 totalbytesize);
void CSND_CapEnable(u32 capUnit, bool enable);
void CSND_CapSetBit(u32 capUnit, int bit, bool state); // Sets bit0..2 in the CNT register, purpose currently unknown
void CSND_CapSetTimer(u32 capUnit, u32 timer);
void CSND_CapSetBuffer(u32 capUnit, u32 paddr, u32 size);
Result CSND_UpdateChnInfo(bool waitDone); Result CSND_UpdateChnInfo(bool waitDone);
Result csndChnPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data1, u32 size); Result csndChnPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data1, u32 size);

View File

@ -350,6 +350,51 @@ Result CSND_UpdateChnInfo(bool waitDone)
return csndExecChnCmds(waitDone); return csndExecChnCmds(waitDone);
} }
void CSND_CapEnable(u32 capUnit, bool enable)
{
u32 cmdparams[0x18>>2];
memset(cmdparams, 0, 0x18);
cmdparams[0] = capUnit;
cmdparams[1] = enable ? 1 : 0;
csndWriteChnCmd(0x100, (u8*)&cmdparams);
}
void CSND_CapSetBit(u32 capUnit, int bit, bool state)
{
u32 cmdparams[0x18>>2];
memset(cmdparams, 0, 0x18);
cmdparams[0] = capUnit;
cmdparams[1] = state ? 1 : 0;
csndWriteChnCmd(0x101 + bit, (u8*)&cmdparams);
}
void CSND_CapSetTimer(u32 capUnit, u32 timer)
{
u32 cmdparams[0x18>>2];
memset(cmdparams, 0, 0x18);
cmdparams[0] = capUnit;
cmdparams[1] = timer & 0xFFFF;
csndWriteChnCmd(0x104, (u8*)&cmdparams);
}
void CSND_CapSetBuffer(u32 capUnit, u32 paddr, u32 size)
{
u32 cmdparams[0x18>>2];
memset(cmdparams, 0, 0x18);
cmdparams[0] = capUnit;
cmdparams[1] = paddr;
cmdparams[2] = size;
csndWriteChnCmd(0x105, (u8*)&cmdparams);
}
Result csndChnPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data1, u32 size) Result csndChnPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data1, u32 size)
{ {
if (!(csndChannels & BIT(chn))) if (!(csndChannels & BIT(chn)))