From a07696751d8de8a4aaf90b6eed056e19a0ce2d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C3=96nnerby?= Date: Tue, 13 Jan 2009 15:57:42 +0000 Subject: [PATCH] Fixed: audioengine now remembers volume between tracks. --- src/core/audio/Player.cpp | 4 ++-- src/core/audio/Transport.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index a43c60a10..ff7b9b48b 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -125,9 +125,9 @@ double Player::Volume(){ } void Player::SetVolume(double volume){ + boost::mutex::scoped_lock lock(this->mutex); + this->volume = volume; if(this->output){ - boost::mutex::scoped_lock lock(this->mutex); - this->volume = volume; this->output->SetVolume(this->volume); } } diff --git a/src/core/audio/Transport.cpp b/src/core/audio/Transport.cpp index 6a1144fea..bb83c0814 100644 --- a/src/core/audio/Transport.cpp +++ b/src/core/audio/Transport.cpp @@ -67,6 +67,7 @@ void Transport::Start(utfstring url){ if(!player || player->url!=url){ // Or create a new player player = Player::Create(url); + player->SetVolume(this->volume); } // Add to the players @@ -128,7 +129,9 @@ double Transport::Volume(){ void Transport::SetVolume(double volume){ this->volume = volume; if(this->currentPlayer){ - this->currentPlayer->SetVolume(volume); + for(PlayerList::iterator player=this->players.begin();player!=this->players.end();++player){ + (*player)->SetVolume(volume); + } } }