mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
WIP: Script-Creator!
This commit is contained in:
+7
-14
@@ -24,8 +24,7 @@ typedef struct _WavHeader {
|
||||
} WavHeader;
|
||||
static_assert(sizeof(WavHeader) == 44, "WavHeader size is not 44 bytes.");
|
||||
|
||||
sound::sound(const string& path, int channel, bool toloop)
|
||||
{
|
||||
sound::sound(const string& path, int channel, bool toloop) {
|
||||
|
||||
ndspSetOutputMode(NDSP_OUTPUT_STEREO);
|
||||
ndspSetOutputCount(2); // Num of buffers
|
||||
@@ -58,8 +57,7 @@ sound::sound(const string& path, int channel, bool toloop)
|
||||
|
||||
if (wavHeader.totallength == 0 ||
|
||||
(wavHeader.channels != 1 && wavHeader.channels != 2) ||
|
||||
(wavHeader.bits_per_sample != 8 && wavHeader.bits_per_sample != 16))
|
||||
{
|
||||
(wavHeader.bits_per_sample != 8 && wavHeader.bits_per_sample != 16)) {
|
||||
// Unsupported WAV file.
|
||||
printf("Corrupted wav file.\n");
|
||||
fclose(fp);
|
||||
@@ -104,8 +102,7 @@ sound::sound(const string& path, int channel, bool toloop)
|
||||
chnl = channel;
|
||||
}
|
||||
|
||||
sound::~sound()
|
||||
{
|
||||
sound::~sound() {
|
||||
waveBuf.data_vaddr = 0;
|
||||
waveBuf.nsamples = 0;
|
||||
waveBuf.looping = false;
|
||||
@@ -117,17 +114,13 @@ sound::~sound()
|
||||
}
|
||||
}
|
||||
|
||||
void sound::play()
|
||||
{
|
||||
if (!data)
|
||||
return;
|
||||
void sound::play() {
|
||||
if (!data) return;
|
||||
DSP_FlushDataCache(data, dataSize);
|
||||
ndspChnWaveBufAdd(chnl, &waveBuf);
|
||||
}
|
||||
|
||||
void sound::stop()
|
||||
{
|
||||
if (!data)
|
||||
return;
|
||||
void sound::stop() {
|
||||
if (!data) return;
|
||||
ndspChnWaveBufClear(chnl);
|
||||
}
|
||||
Reference in New Issue
Block a user