mirror of
https://github.com/CTurt/dsgmLib.git
synced 2025-06-19 07:05:37 -04:00
Improvements to the sound handling
Still not great though
This commit is contained in:
parent
4f10b3023e
commit
afcb086c93
Binary file not shown.
@ -408,6 +408,7 @@ void player_create(playerObjectInstance *me) {
|
|||||||
else {
|
else {
|
||||||
DSGM_DrawText(DSGM_TOP, 1, 5, "Room_2");
|
DSGM_DrawText(DSGM_TOP, 1, 5, "Room_2");
|
||||||
}
|
}
|
||||||
|
|
||||||
DSGM_PlaySound(FlatOutLies);
|
DSGM_PlaySound(FlatOutLies);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,14 +478,5 @@ void player_loop(playerObjectInstance *me) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void player_touch(playerObjectInstance *me) {
|
void player_touch(playerObjectInstance *me) {
|
||||||
//mmStop();
|
|
||||||
//DSGM_Sounds[FlatOutLies].loaded = false;
|
|
||||||
//DSGM_PlaySound(FlatOutLies);
|
|
||||||
//mmLoad(DSGM_Sounds[FlatOutLies].ID);
|
|
||||||
//swiWaitForVBlank();
|
|
||||||
//mmStart(DSGM_Sounds[FlatOutLies].ID, MM_PLAY_LOOP);
|
|
||||||
|
|
||||||
DSGM_GotoNextRoom(false);
|
DSGM_GotoNextRoom(false);
|
||||||
/*if(DSGM_currentRoom == Room_1) DSGM_SwitchRoom(Room_2, false);
|
|
||||||
else if(DSGM_currentRoom == Room_2) DSGM_SwitchRoom(Room_1, false);*/
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define DSGM_MAX_SOUNDS 32
|
#define DSGM_MAX_SOUND_EFFECT_INSTANCES 32
|
||||||
#define DSGM_RESERVED_STREAMS 1
|
#define DSGM_RESERVED_STREAMS 1
|
||||||
|
|
||||||
#define DSGM_SOUND_STREAM 0
|
#define DSGM_SOUND_STREAM 0
|
||||||
@ -28,8 +28,10 @@ typedef struct {
|
|||||||
|
|
||||||
extern int DSGM_soundStreamCount;
|
extern int DSGM_soundStreamCount;
|
||||||
|
|
||||||
extern DSGM_SoundInstance DSGM_soundInstances[DSGM_MAX_SOUNDS];
|
extern DSGM_SoundInstance DSGM_soundStreamInstance;
|
||||||
extern int DSGM_soundInstanceCount;
|
|
||||||
|
extern DSGM_SoundInstance DSGM_soundEffectInstances[DSGM_MAX_SOUND_EFFECT_INSTANCES];
|
||||||
|
extern int DSGM_soundEffectInstanceCount;
|
||||||
|
|
||||||
void DSGM_InitSoundFull(int soundStreamCount);
|
void DSGM_InitSoundFull(int soundStreamCount);
|
||||||
void DSGM_ResetSound(void);
|
void DSGM_ResetSound(void);
|
||||||
|
BIN
lib/libdsgm.a
BIN
lib/libdsgm.a
Binary file not shown.
@ -85,9 +85,9 @@ void DSGM_LoopRoom(DSGM_Room *room) {
|
|||||||
DSGM_ValidateRoom();
|
DSGM_ValidateRoom();
|
||||||
|
|
||||||
//+1?
|
//+1?
|
||||||
for(sound = 0; sound < DSGM_soundInstanceCount; sound++) {
|
for(sound = 0; sound < DSGM_soundEffectInstanceCount; sound++) {
|
||||||
DSGM_SetSoundInstanceVolumeFull(&DSGM_soundInstances[sound], DSGM_soundInstances[sound].volume);
|
DSGM_SetSoundInstanceVolumeFull(&DSGM_soundEffectInstances[sound], DSGM_soundEffectInstances[sound].volume);
|
||||||
DSGM_SetSoundInstancePanningFull(&DSGM_soundInstances[sound], DSGM_soundInstances[sound].panning);
|
DSGM_SetSoundInstancePanningFull(&DSGM_soundEffectInstances[sound], DSGM_soundEffectInstances[sound].panning);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(screen = 0; screen < 2; screen++) {
|
for(screen = 0; screen < 2; screen++) {
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
int DSGM_soundStreamCount = 0;
|
int DSGM_soundStreamCount = 0;
|
||||||
|
|
||||||
DSGM_SoundInstance DSGM_soundInstances[DSGM_MAX_SOUNDS];
|
DSGM_SoundInstance DSGM_soundStreamInstance;
|
||||||
int DSGM_soundInstanceCount = 0;
|
|
||||||
|
DSGM_SoundInstance DSGM_soundEffectInstances[DSGM_MAX_SOUND_EFFECT_INSTANCES];
|
||||||
|
int DSGM_soundEffectInstanceCount = 0;
|
||||||
|
|
||||||
void DSGM_InitSoundFull(int soundStreamCount) {
|
void DSGM_InitSoundFull(int soundStreamCount) {
|
||||||
mmInitDefault("nitro:/soundbank.bin");
|
mmInitDefault("nitro:/soundbank.bin");
|
||||||
@ -11,29 +13,33 @@ void DSGM_InitSoundFull(int soundStreamCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DSGM_ResetSound(void) {
|
void DSGM_ResetSound(void) {
|
||||||
/*mmStop();
|
mmStop();
|
||||||
mmEffectCancelAll();
|
mmEffectCancelAll();
|
||||||
|
|
||||||
int i;
|
if(DSGM_soundStreamInstance.sound) {
|
||||||
for(i = 0; i < DSGM_soundInstanceCount; i++) {
|
mmUnload(DSGM_soundStreamInstance.sound->ID);
|
||||||
if(DSGM_soundInstances[i].sound->type == DSGM_SOUND_STREAM) {
|
DSGM_soundStreamInstance.sound->loaded = false;
|
||||||
// MaxMod is broken :(
|
|
||||||
//mmUnload(DSGM_soundInstances[i].sound->ID);
|
|
||||||
//DSGM_soundInstances[i].sound->loaded = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//mmUnloadEffect(DSGM_soundInstances[i].sound->ID - DSGM_soundStreamCount);
|
|
||||||
//DSGM_soundInstances[i].sound->loaded = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DSGM_soundInstanceCount = 0;*/
|
int i;
|
||||||
|
for(i = 0; i < DSGM_soundEffectInstanceCount; i++) {
|
||||||
|
mmUnloadEffect(DSGM_soundEffectInstances[i].sound->ID - DSGM_soundStreamCount);
|
||||||
|
DSGM_soundEffectInstances[i].sound->loaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DSGM_soundEffectInstanceCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSGM_SoundInstance *DSGM_AddSoundInstance(DSGM_Sound *sound) {
|
DSGM_SoundInstance *DSGM_AddSoundInstance(DSGM_Sound *sound) {
|
||||||
// still playing?
|
if(sound->type == DSGM_SOUND_STREAM) {
|
||||||
if(DSGM_soundInstanceCount == DSGM_MAX_SOUNDS) DSGM_soundInstanceCount = sound->type == DSGM_SOUND_STREAM ? 0 : DSGM_RESERVED_STREAMS;
|
DSGM_soundStreamInstance.sound = sound;
|
||||||
return &DSGM_soundInstances[DSGM_soundInstanceCount++];
|
return &DSGM_soundStreamInstance;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(DSGM_soundEffectInstanceCount < DSGM_MAX_SOUND_EFFECT_INSTANCES) DSGM_soundEffectInstanceCount++;
|
||||||
|
DSGM_soundEffectInstances[DSGM_soundEffectInstanceCount - 1].sound = sound;
|
||||||
|
return &DSGM_soundEffectInstances[DSGM_soundEffectInstanceCount - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DSGM_SoundInstance *DSGM_PlaySoundFull(DSGM_Sound *sound) {
|
DSGM_SoundInstance *DSGM_PlaySoundFull(DSGM_Sound *sound) {
|
||||||
|
Loading…
Reference in New Issue
Block a user