]> Chaos Git - corbenik/ctrulib.git/commitdiff
CSND: add some capture commands
authorfincs <fincs.alt1@gmail.com>
Mon, 5 Jan 2015 18:36:41 +0000 (19:36 +0100)
committerfincs <fincs.alt1@gmail.com>
Tue, 20 Jan 2015 16:55:26 +0000 (17:55 +0100)
libctru/include/3ds/services/csnd.h
libctru/source/services/csnd.c

index 786c09de6e73d11d266c665726d1ff15a286a49f..7984d1a4fd2a2c0551bb3e84f786abb7c9ae87dd 100644 (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_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);
index 25b788f40a65856139adb1d2b712f4439b6466b0..185c39257d775e1fd1837704a784c2899e61814f 100644 (file)
@@ -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)))