This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
#include "jsound.h"
|
||||
#include "jfile.h"
|
||||
#include <string>
|
||||
|
||||
Mix_Music *music = NULL;
|
||||
char currentMusic[12];
|
||||
|
||||
bool JS_Init() {
|
||||
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024);
|
||||
Mix_AllocateChannels(8);
|
||||
currentMusic[0] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,6 +25,7 @@ void JS_LoadMusic(const char *musicFilename)
|
||||
|
||||
SDL_RWops *rw = SDL_RWFromMem(buffer, filesize);
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
strcpy(currentMusic, musicFilename);
|
||||
}
|
||||
|
||||
void JS_SetMusicVolume(int volume) {
|
||||
@@ -44,6 +48,10 @@ bool JS_MusicPlaying() {
|
||||
return (Mix_PlayingMusic() == 1);// && (Mix_FadingMusic() != MIX_FADING_OUT);
|
||||
}
|
||||
|
||||
const char* JS_GetMusicName() {
|
||||
return currentMusic;
|
||||
}
|
||||
|
||||
JS_Sound *JS_LoadSound(char *soundFilename) {
|
||||
int filesize = 0;
|
||||
char *buffer = JF_GetBufferFromResource(soundFilename, filesize);
|
||||
|
||||
Reference in New Issue
Block a user