summaryrefslogtreecommitdiff
path: root/src/player.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.cc')
-rw-r--r--src/player.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/player.cc b/src/player.cc
index 1181841..af3cd7c 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -57,7 +57,12 @@ void Player::run()
{
Selection sel;
- ao_initialize();
+ static int init = 0;
+ if(init == 0)
+ {
+ ao_initialize();
+ }
+ ++init;
ao_sample_format sf;
memset(&sf, 0, sizeof(sf));
@@ -121,7 +126,12 @@ void Player::run()
}
ao_close(dev);
- ao_shutdown();
+
+ --init;
+ if(init == 0)
+ {
+ ao_shutdown();
+ }
}
bool Player::playSelectionDone()