replaced AV::Sound::pause() with AV::Sound::resume() -- play and loop now rewind but resume does not
git-svn-id: svn://anubis/anaglym/trunk@291 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
d4d44dea86
commit
5bed8a2dfd
6
AV.cc
6
AV.cc
@ -224,11 +224,11 @@ void AV::Sound::play()
|
|||||||
loop(1);
|
loop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AV::Sound::pause()
|
void AV::Sound::resume()
|
||||||
{
|
{
|
||||||
if (m_ss != NULL)
|
if (m_ss != NULL)
|
||||||
{
|
{
|
||||||
m_av.stopSound(this);
|
m_av.playSound(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,6 @@ void AV::Sound::stop()
|
|||||||
{
|
{
|
||||||
if (m_ss != NULL)
|
if (m_ss != NULL)
|
||||||
{
|
{
|
||||||
rewind();
|
|
||||||
m_av.stopSound(this);
|
m_av.stopSound(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,6 +245,7 @@ void AV::Sound::loop(int times)
|
|||||||
if (m_ss != NULL)
|
if (m_ss != NULL)
|
||||||
{
|
{
|
||||||
m_loop_count = times;
|
m_loop_count = times;
|
||||||
|
rewind();
|
||||||
m_av.playSound(this);
|
m_av.playSound(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
AV.h
2
AV.h
@ -21,7 +21,7 @@ class AV
|
|||||||
bool load(FileLoader & fileLoader,
|
bool load(FileLoader & fileLoader,
|
||||||
const FileLoader::Path & path);
|
const FileLoader::Path & path);
|
||||||
void play();
|
void play();
|
||||||
void pause();
|
void resume();
|
||||||
void stop();
|
void stop();
|
||||||
void loop(int times);
|
void loop(int times);
|
||||||
void rewind();
|
void rewind();
|
||||||
|
8
ag.cc
8
ag.cc
@ -319,8 +319,8 @@ namespace ag
|
|||||||
lua_setfield(L, -2, "id");
|
lua_setfield(L, -2, "id");
|
||||||
lua_pushcfunction(L, sound::play);
|
lua_pushcfunction(L, sound::play);
|
||||||
lua_setfield(L, -2, "play");
|
lua_setfield(L, -2, "play");
|
||||||
lua_pushcfunction(L, sound::pause);
|
lua_pushcfunction(L, sound::resume);
|
||||||
lua_setfield(L, -2, "pause");
|
lua_setfield(L, -2, "resume");
|
||||||
lua_pushcfunction(L, sound::stop);
|
lua_pushcfunction(L, sound::stop);
|
||||||
lua_setfield(L, -2, "stop");
|
lua_setfield(L, -2, "stop");
|
||||||
lua_pushcfunction(L, sound::loop);
|
lua_pushcfunction(L, sound::loop);
|
||||||
@ -1645,7 +1645,7 @@ namespace ag
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pause(lua_State * L)
|
int resume(lua_State * L)
|
||||||
{
|
{
|
||||||
int argc = lua_gettop(L);
|
int argc = lua_gettop(L);
|
||||||
if (argc == 1 && lua_istable(L, 1))
|
if (argc == 1 && lua_istable(L, 1))
|
||||||
@ -1653,7 +1653,7 @@ namespace ag
|
|||||||
refptr<AV::Sound> snd = getSound(L, 1);
|
refptr<AV::Sound> snd = getSound(L, 1);
|
||||||
if (!snd.isNull())
|
if (!snd.isNull())
|
||||||
{
|
{
|
||||||
snd->pause();
|
snd->resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
2
ag.h
2
ag.h
@ -110,7 +110,7 @@ namespace ag
|
|||||||
{
|
{
|
||||||
refptr<AV::Sound> getSound(lua_State * L, int index);
|
refptr<AV::Sound> getSound(lua_State * L, int index);
|
||||||
int play(lua_State * L);
|
int play(lua_State * L);
|
||||||
int pause(lua_State * L);
|
int resume(lua_State * L);
|
||||||
int stop(lua_State * L);
|
int stop(lua_State * L);
|
||||||
int loop(lua_State * L);
|
int loop(lua_State * L);
|
||||||
int loopForever(lua_State * L);
|
int loopForever(lua_State * L);
|
||||||
|
BIN
lib/hit_pins.mp3
Normal file
BIN
lib/hit_pins.mp3
Normal file
Binary file not shown.
@ -42,10 +42,10 @@ function key_down_event(key)
|
|||||||
ag.clearEventHandler("mouse_motion")
|
ag.clearEventHandler("mouse_motion")
|
||||||
elseif (key == "p") then
|
elseif (key == "p") then
|
||||||
if (playing) then
|
if (playing) then
|
||||||
iris:pause()
|
iris:stop()
|
||||||
playing = false
|
playing = false
|
||||||
else
|
else
|
||||||
iris:play()
|
iris:resume()
|
||||||
playing = true
|
playing = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user