From d605427efc9e95568d1bfcb4b4482f6740e1fa92 Mon Sep 17 00:00:00 2001 From: maroy Date: Tue, 11 Jan 2005 17:26:03 +0000 Subject: [PATCH] added getVolume() and setVolume() to HelixPlayer --- .../playlistExecutor/src/HelixPlayer.cxx | 39 ++++++++++++++++++- .../playlistExecutor/src/HelixPlayer.h | 20 +++++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx b/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx index d93c93f38..e091a7f9d 100644 --- a/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx +++ b/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $ ------------------------------------------------------------------------------*/ @@ -38,6 +38,7 @@ #include "LiveSupport/Core/TimeConversion.h" #include "HelixEventHandlerThread.h" #include "HelixPlayer.h" +#include using namespace LiveSupport::Core; @@ -329,6 +330,42 @@ HelixPlayer :: close(void) throw () } +/*------------------------------------------------------------------------------ + * Get the volume of the player. + *----------------------------------------------------------------------------*/ +unsigned int +HelixPlayer :: getVolume(void) throw () +{ + IHXAudioPlayer * audioPlayer = 0; + player->QueryInterface(IID_IHXAudioPlayer, (void**) &audioPlayer); + if (!audioPlayer) { + std::cerr << "can't get IHXAudioPlayer interface" << std::endl; + return 0; + } + + IHXVolume * ihxVolume = audioPlayer->GetAudioVolume(); + return ihxVolume->GetVolume(); +} + + +/*------------------------------------------------------------------------------ + * Set the volume of the player. + *----------------------------------------------------------------------------*/ +void +HelixPlayer :: setVolume(unsigned int volume) throw () +{ + IHXAudioPlayer * audioPlayer = 0; + player->QueryInterface(IID_IHXAudioPlayer, (void**) &audioPlayer); + if (!audioPlayer) { + std::cerr << "can't get IHXAudioPlayer interface" << std::endl; + return; + } + + IHXVolume * ihxVolume = audioPlayer->GetAudioVolume(); + ihxVolume->SetVolume(volume); +} + + /*------------------------------------------------------------------------------ * A global function needed by the Helix library, this will return the * access path to shared objects. diff --git a/livesupport/modules/playlistExecutor/src/HelixPlayer.h b/livesupport/modules/playlistExecutor/src/HelixPlayer.h index 878c25594..d79ea0190 100644 --- a/livesupport/modules/playlistExecutor/src/HelixPlayer.h +++ b/livesupport/modules/playlistExecutor/src/HelixPlayer.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $ ------------------------------------------------------------------------------*/ @@ -91,7 +91,7 @@ using namespace LiveSupport::Core; * * * @author $Author: maroy $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class HelixPlayer : virtual public Configurable, virtual public AudioPlayerInterface, @@ -310,6 +310,22 @@ class HelixPlayer : virtual public Configurable, */ virtual Ptr::Ref getPlaylength(void) throw (); + + /** + * Get the volume of the player. + * + * @return the volume, from 1 to 100. + */ + virtual unsigned int + getVolume(void) throw (); + + /** + * Set the volume of the player. + * + * @param volume the new volume, from 1 to 100. + */ + virtual void + setVolume(unsigned int volume) throw (); };