Verified Commit 087e8508 authored by RobLoach's avatar RobLoach
Browse files

Update

parent c1903430
......@@ -49,7 +49,7 @@ SOURCES_C += $(wildcard \
# stb_vorbis
#SOURCES_C += $(CORE_DIR)/vendor/stb/stb_vorbis.c
FLAGS += -DHAVE_STB_VORBIS
FLAGS += -I$(CORE_DIR)/libretro-deps
FLAGS += -I$(CORE_DIR)/vendor/libretro-deps
# zlib
SOURCES_C += \
......
......@@ -14,6 +14,7 @@ namespace Audio {
SoundData::SoundData(const std::string& filename) {
// Load the file.
ChaiLove* app = ChaiLove::getInstance();
sourceFile = filename;
// Load the file.
int size = 0;
......@@ -65,13 +66,17 @@ SoundData& SoundData::setVolume(float volume) {
}
void SoundData::unload() {
std::cout << "Unload audio_mixer_stop" << sourceFile << std::endl;
if (m_voice != NULL) {
audio_mixer_stop(m_voice);
m_voice = NULL;
}
std::cout << "Unload audio_mixer_destroy" << sourceFile << std::endl;
if (isLoaded()) {
audio_mixer_destroy(m_sound);
m_sound = NULL;
}
std::cout << "Unload audio_mixer_destroy done" << sourceFile << std::endl;
}
bool SoundData::play() {
......
......@@ -73,6 +73,8 @@ class SoundData {
// The audio callback for when a sound finishes.
static void audioCallback(audio_mixer_sound_t* sound, unsigned reason);
std::string sourceFile;
};
} // namespace Audio
......
......@@ -2,6 +2,10 @@
var theSound = love.sound.newSoundData("assets/jump.wav")
assert_not(theSound.is_var_null(), "love.sound.newSoundData()")
// newSoundData() with OGG
var theOgg = love.sound.newSoundData("assets/chailove.ogg")
assert_not(theOgg.is_var_null(), " - ogg")
// getVolume()
assert_equal(theSound.getVolume(), 1.0f, "SoundData.getVolume()")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment