Added function to create new sound from raw buffer

This commit is contained in:
2021-03-26 15:36:11 +01:00
parent 637c5c4677
commit 1623654564
2 changed files with 8 additions and 0 deletions

View File

@@ -134,6 +134,13 @@ void JA_DeleteMusic(JA_Music music) {
delete music;
}
JA_Sound JA_NewSound(Uint8* buffer, Uint32 length) {
JA_Sound sound = new JA_Sound_t();
sound->buffer = buffer;
sound->length = length;
return sound;
}
JA_Sound JA_LoadSound(const char* filename) {
JA_Sound sound = new JA_Sound_t();
SDL_AudioSpec wavSpec;

View File

@@ -17,6 +17,7 @@ void JA_StopMusic();
JA_Music_state JA_GetMusicState();
void JA_DeleteMusic(JA_Music music);
JA_Sound JA_NewSound(Uint8* buffer, Uint32 length);
JA_Sound JA_LoadSound(const char* filename);
int JA_PlaySound(JA_Sound sound, const int loop = 0);
void JA_PauseChannel(const int channel);