diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-15 16:16:43 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-15 16:16:43 +0200 |
commit | 3aed203a76beaab192e5bc10d453fd3df28102dc (patch) | |
tree | 562cf37307b5e4c7bcd00eff67336d94cd3c5f57 | |
parent | ea89897c315a03a29d6e3121128dd3af3713a7dd (diff) |
Move libao initialisation code to audio thread.
-rw-r--r-- | dgedit/player.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/dgedit/player.cc b/dgedit/player.cc index 782020b..b916920 100644 --- a/dgedit/player.cc +++ b/dgedit/player.cc @@ -40,16 +40,6 @@ Player::Player() pcm_data = NULL; pcm_size = 0; - ao_initialize(); - - ao_sample_format sf; - sf.bits = 16; - sf.rate = 44100; - sf.channels = 1; - sf.byte_format = AO_FMT_NATIVE; - - dev = ao_open_live(ao_default_driver_id(), &sf, 0); - connect(&report_timer, SIGNAL(timeout()), this, SLOT(reportTimeout())); report_timer.start(50); // Update 25 times per second } @@ -62,6 +52,16 @@ Player::~Player() void Player::run() { + ao_initialize(); + + ao_sample_format sf; + sf.bits = 16; + sf.rate = 44100; + sf.channels = 1; + sf.byte_format = AO_FMT_NATIVE; + + dev = ao_open_live(ao_default_driver_id(), &sf, 0); + short s[BUFSZ]; while(true) { if(playing) { |