aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/audio/sdl/source.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-06-05 09:09:38 +0800
committerchai <chaifix@163.com>2018-06-05 09:09:38 +0800
commiteeeb5f4f6be70b0c4a8a4a214a282187bf5e2eb4 (patch)
tree3c270397e391f5f2b3f20251d3042afdab4ff731 /src/libjin/audio/sdl/source.cpp
parent2700c776f033968a0ce139db4fdb307e9d993225 (diff)
lls bind
Diffstat (limited to 'src/libjin/audio/sdl/source.cpp')
-rw-r--r--src/libjin/audio/sdl/source.cpp74
1 files changed, 39 insertions, 35 deletions
diff --git a/src/libjin/audio/sdl/source.cpp b/src/libjin/audio/sdl/source.cpp
index 3686a92..1a5c5d1 100644
--- a/src/libjin/audio/sdl/source.cpp
+++ b/src/libjin/audio/sdl/source.cpp
@@ -239,43 +239,46 @@ Manager::get()->pushCommand(cmd); \
while (!commands.empty())
{
cmd = commands.front();
- source = cmd->source;
- if (source != nullptr && cmd != nullptr)
+ if (cmd != nullptr)
{
- switch (cmd->action)
+ source = cmd->source;
+ if (source != nullptr)
{
- case Command::Action::Play:
- removeSource(source);
- pushSource(source);
- source->status.state = PLAYING;
- source->status.pos = 0; // rewind
- break;
- case Command::Action::Stop:
- manager->removeSource(source);
- source->status.state = STOPPED;
- source->status.pos = 0; // rewind
- break;
- case Command::Action::Pause:
- manager->removeSource(source);
- source->status.state = PAUSED;
- break;
- case Command::Action::Resume:
- manager->removeSource(source);
- manager->pushSource(source);
- source->status.state = PLAYING;
- break;
- case Command::Action::Rewind:
- source->status.state = PLAYING;
- source->status.pos = 0;
- break;
- case Command::Action::SetVolume:
- //float cmd->parameter._float;
- break;
- case Command::Action::SetLoop:
- source->status.loop = cmd->parameter._boolean;
- break;
- /*case Command::Action::SetRate:
- */
+ switch (cmd->action)
+ {
+ case Command::Action::Play:
+ removeSource(source);
+ pushSource(source);
+ source->status.state = PLAYING;
+ source->status.pos = 0; // rewind
+ break;
+ case Command::Action::Stop:
+ manager->removeSource(source);
+ source->status.state = STOPPED;
+ source->status.pos = 0; // rewind
+ break;
+ case Command::Action::Pause:
+ manager->removeSource(source);
+ source->status.state = PAUSED;
+ break;
+ case Command::Action::Resume:
+ manager->removeSource(source);
+ manager->pushSource(source);
+ source->status.state = PLAYING;
+ break;
+ case Command::Action::Rewind:
+ source->status.state = PLAYING;
+ source->status.pos = 0;
+ break;
+ case Command::Action::SetVolume:
+ //float cmd->parameter._float;
+ break;
+ case Command::Action::SetLoop:
+ source->status.loop = cmd->parameter._boolean;
+ break;
+ /*case Command::Action::SetRate:
+ */
+ }
}
}
commands.pop();
@@ -352,6 +355,7 @@ Manager::get()->pushCommand(cmd); \
{
Command* cmd = commandsPool.top();
commandsPool.pop();
+ return cmd;
}
return new Command();
}