From 3aed203a76beaab192e5bc10d453fd3df28102dc Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 15 Apr 2014 16:16:43 +0200 Subject: Move libao initialisation code to audio thread. --- dgedit/player.cc | 20 ++++++++++---------- 1 file 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) { -- cgit v1.2.3