2014-08-26 22:53:00 +02:00
|
|
|
#pragma once
|
2015-01-02 23:41:48 +01:00
|
|
|
#include <3ds/types.h>
|
|
|
|
|
2015-01-01 20:04:31 +01:00
|
|
|
#define CSND_NUM_CHANNELS 32
|
2014-04-22 01:12:56 +02:00
|
|
|
#define CSND_SHAREDMEM_DEFAULT 0x10004000
|
|
|
|
|
2014-12-31 16:56:34 +01:00
|
|
|
#define CSND_TIMER(n) (0x3FEC3FC / ((u32)(n)))
|
|
|
|
|
2014-08-25 23:11:53 +02:00
|
|
|
typedef enum{
|
2014-12-31 16:56:34 +01:00
|
|
|
CSND_LOOP_DISABLE,
|
|
|
|
CSND_LOOP_ENABLE,
|
2014-08-25 23:11:53 +02:00
|
|
|
} CSND_LOOPING;
|
|
|
|
|
|
|
|
typedef enum{
|
2014-12-31 16:56:34 +01:00
|
|
|
CSND_ENCODING_PCM8,
|
|
|
|
CSND_ENCODING_PCM16,
|
|
|
|
CSND_ENCODING_IMA_ADPCM,
|
|
|
|
CSND_ENCODING_PSG, // Similar to DS?
|
2014-08-25 23:11:53 +02:00
|
|
|
} CSND_ENCODING;
|
|
|
|
|
2015-01-01 20:04:31 +01:00
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
u32 value[3];
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u8 active;
|
|
|
|
u8 _pad1;
|
|
|
|
u16 _pad2;
|
|
|
|
s16 adpcmSample;
|
|
|
|
u8 adpcmIndex;
|
|
|
|
u8 _pad3;
|
|
|
|
u32 samplePAddr;
|
|
|
|
};
|
|
|
|
} CSND_ChnInfo;
|
|
|
|
|
2014-12-31 16:56:34 +01:00
|
|
|
// See here regarding CSND shared-mem commands, etc: http://3dbrew.org/wiki/CSND_Shared_Memory
|
2014-07-23 07:23:20 +02:00
|
|
|
|
2015-01-01 20:04:31 +01:00
|
|
|
extern vu32* csndSharedMem;
|
|
|
|
extern u32 csndSharedMemSize;
|
|
|
|
extern u32 csndChannels; // Bitmask of channels that are allowed for usage
|
|
|
|
|
2014-12-31 16:56:34 +01:00
|
|
|
Result csndInit(void);
|
|
|
|
Result csndExit(void);
|
2014-04-22 01:12:56 +02:00
|
|
|
|
2014-12-31 17:16:16 +01:00
|
|
|
void csndWriteChnCmd(int cmdid, u8 *cmdparams);
|
2015-01-01 16:23:09 +01:00
|
|
|
Result csndExecChnCmds(bool waitDone);
|
2014-12-31 17:16:16 +01:00
|
|
|
|
|
|
|
void CSND_ChnSetPlayStateR(u32 channel, u32 value);
|
|
|
|
void CSND_ChnSetPlayState(u32 channel, u32 value);
|
|
|
|
void CSND_ChnSetLoop(u32 channel, u32 physaddr, u32 size);
|
2015-01-01 13:56:51 +01:00
|
|
|
void CSND_ChnSetVol(u32 channel, u16 left, u16 right);
|
2014-12-31 17:16:16 +01:00
|
|
|
void CSND_ChnSetTimer(u32 channel, u32 timer);
|
2015-01-01 13:56:51 +01:00
|
|
|
void CSND_ChnConfig(u32 channel, u32 looping, u32 encoding, u32 timer, u32 unk0, u32 unk1, u32 physaddr0, u32 physaddr1, u32 totalbytesize);
|
2014-12-31 17:16:16 +01:00
|
|
|
|
2015-01-01 16:23:09 +01:00
|
|
|
Result CSND_UpdateChnInfo(bool waitDone);
|
2014-12-31 17:16:16 +01:00
|
|
|
|
|
|
|
Result csndChnPlaySound(u32 channel, u32 looping, u32 encoding, u32 samplerate, u32 *vaddr0, u32 *vaddr1, u32 totalbytesize, u32 unk0, u32 unk1);
|
|
|
|
|
2015-01-01 20:04:31 +01:00
|
|
|
CSND_ChnInfo* csndChnGetInfo(u32 channel); // Requires previous CSND_UpdateChnInfo()
|
|
|
|
|
|
|
|
Result csndChnGetState(u32 channel, u32 *out);
|
|
|
|
Result csndChnIsPlaying(u32 channel, u8 *status);
|