diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-05-13 13:47:52 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-05-13 13:47:52 +0200 |
commit | 1395a966d7de7375efad53f6dbbe709a22c307d5 (patch) | |
tree | 84a59b2f72a0b348aa2e45175f610849a4dc0cb0 | |
parent | 5ecfc48d057a78b193b0f4f9c67e18240ad4e42c (diff) |
Only initialise/deinitialise once.
-rw-r--r-- | src/player.cc | 14 |
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() |