added getVolume() and setVolume() to HelixPlayer

This commit is contained in:
maroy 2005-01-11 17:26:03 +00:00
parent 6c02912c69
commit d605427efc
2 changed files with 56 additions and 3 deletions

View File

@ -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 <hxausvc.h>
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.

View File

@ -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;
* </pre></code>
*
* @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<posix_time::time_duration>::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 ();
};