diff --git a/libctru/include/3ds/services/csnd.h b/libctru/include/3ds/services/csnd.h index 786c09d..7984d1a 100644 --- a/libctru/include/3ds/services/csnd.h +++ b/libctru/include/3ds/services/csnd.h @@ -91,6 +91,11 @@ void CSND_ChnSetAdpcmState(u32 channel, int block, int sample, int index); void CSND_ChnSetAdpcmReload(u32 channel, bool reload); 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 csndChnPlaySound(int chn, u32 flags, u32 sampleRate, void* data0, void* data1, u32 size); diff --git a/libctru/source/services/csnd.c b/libctru/source/services/csnd.c index 25b788f..185c392 100644 --- a/libctru/source/services/csnd.c +++ b/libctru/source/services/csnd.c @@ -350,6 +350,51 @@ Result CSND_UpdateChnInfo(bool 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) { if (!(csndChannels & BIT(chn)))