summaryrefslogtreecommitdiff
path: root/arm7/lib/src/SND_capture.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2021-08-31 08:54:33 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2021-08-31 08:54:33 -0400
commitba5f5449a4fb7c36a20ebccb0aa560d88d6a49c0 (patch)
tree63e5cab56041641b85b231f09296d1cecf9e0a1c /arm7/lib/src/SND_capture.c
parentcc891865fa1eb5a823f6a3eeb1746f05addb0d90 (diff)
parent1499e9f8be9458bbf94cbc4dc6d1034f53606cd0 (diff)
Merge branch 'pikalax_work' of github.com:PikalaxALT/pokediamond into pikalax_work
Diffstat (limited to 'arm7/lib/src/SND_capture.c')
-rw-r--r--arm7/lib/src/SND_capture.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arm7/lib/src/SND_capture.c b/arm7/lib/src/SND_capture.c
new file mode 100644
index 00000000..57494b72
--- /dev/null
+++ b/arm7/lib/src/SND_capture.c
@@ -0,0 +1,25 @@
+#include "SND_capture.h"
+
+#include "registers.h"
+
+enum SNDLoop
+{
+ SND_CAP_LOOP = 0,
+ SND_CAP_ONESHOT = 1
+};
+
+void SND_SetupCapture(
+ int idx, int format, void *captureData, int size, BOOL loop, int capCtrlSrc, int capCtrlDst)
+{
+ int off = idx * 8;
+
+ reg_SNDCAPxCNT(idx) = (u8)((format << 3) | ((loop ? SND_CAP_LOOP : SND_CAP_ONESHOT) << 2) |
+ (capCtrlSrc << 1) | capCtrlDst);
+ *(vu32 *)(0x4000510 + off) = (u32)captureData;
+ *(vu16 *)(0x4000514 + off) = (u16)size;
+}
+
+BOOL SND_IsCaptureActive(int idx)
+{
+ return (reg_SNDCAPxCNT(idx) & 0x80) != 0;
+}