diff --git a/AV.cc b/AV.cc index 3a110ce..6acd312 100644 --- a/AV.cc +++ b/AV.cc @@ -224,11 +224,11 @@ void AV::Sound::play() loop(1); } -void AV::Sound::pause() +void AV::Sound::resume() { if (m_ss != NULL) { - m_av.stopSound(this); + m_av.playSound(this); } } @@ -236,7 +236,6 @@ void AV::Sound::stop() { if (m_ss != NULL) { - rewind(); m_av.stopSound(this); } } @@ -246,6 +245,7 @@ void AV::Sound::loop(int times) if (m_ss != NULL) { m_loop_count = times; + rewind(); m_av.playSound(this); } } diff --git a/AV.h b/AV.h index abcb05c..2e9e73a 100644 --- a/AV.h +++ b/AV.h @@ -21,7 +21,7 @@ class AV bool load(FileLoader & fileLoader, const FileLoader::Path & path); void play(); - void pause(); + void resume(); void stop(); void loop(int times); void rewind(); diff --git a/ag.cc b/ag.cc index 5acba29..dd28833 100644 --- a/ag.cc +++ b/ag.cc @@ -319,8 +319,8 @@ namespace ag lua_setfield(L, -2, "id"); lua_pushcfunction(L, sound::play); lua_setfield(L, -2, "play"); - lua_pushcfunction(L, sound::pause); - lua_setfield(L, -2, "pause"); + lua_pushcfunction(L, sound::resume); + lua_setfield(L, -2, "resume"); lua_pushcfunction(L, sound::stop); lua_setfield(L, -2, "stop"); lua_pushcfunction(L, sound::loop); @@ -1645,7 +1645,7 @@ namespace ag return 0; } - int pause(lua_State * L) + int resume(lua_State * L) { int argc = lua_gettop(L); if (argc == 1 && lua_istable(L, 1)) @@ -1653,7 +1653,7 @@ namespace ag refptr snd = getSound(L, 1); if (!snd.isNull()) { - snd->pause(); + snd->resume(); } } return 0; diff --git a/ag.h b/ag.h index ce548d0..36b073b 100644 --- a/ag.h +++ b/ag.h @@ -110,7 +110,7 @@ namespace ag { refptr getSound(lua_State * L, int index); int play(lua_State * L); - int pause(lua_State * L); + int resume(lua_State * L); int stop(lua_State * L); int loop(lua_State * L); int loopForever(lua_State * L); diff --git a/lib/hit_pins.mp3 b/lib/hit_pins.mp3 new file mode 100644 index 0000000..16b59df Binary files /dev/null and b/lib/hit_pins.mp3 differ diff --git a/tests/cratestack.lua b/tests/cratestack.lua index 1895c3a..c981ab0 100644 --- a/tests/cratestack.lua +++ b/tests/cratestack.lua @@ -42,10 +42,10 @@ function key_down_event(key) ag.clearEventHandler("mouse_motion") elseif (key == "p") then if (playing) then - iris:pause() + iris:stop() playing = false else - iris:play() + iris:resume() playing = true end end