added pause/stop functionality to Scratchpad
This commit is contained in:
parent
162ea44857
commit
d793343c37
11 changed files with 290 additions and 51 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/include/LiveSupport/PlaylistExecutor/AudioPlayerInterface.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/include/LiveSupport/PlaylistExecutor/AudioPlayerInterface.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -68,7 +68,7 @@ using namespace LiveSupport::Core;
|
||||||
* A generic interface for playing audio files.
|
* A generic interface for playing audio files.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
class AudioPlayerInterface
|
class AudioPlayerInterface
|
||||||
{
|
{
|
||||||
|
@ -135,18 +135,31 @@ class AudioPlayerInterface
|
||||||
/**
|
/**
|
||||||
* Start playing.
|
* Start playing.
|
||||||
* This call will start playing the active playlist, which was
|
* This call will start playing the active playlist, which was
|
||||||
* set by a previous call to playThis().
|
* set by a previous call to open().
|
||||||
* Playing can be stopped by calling stop().
|
* Playing can be stopped by calling stop().
|
||||||
*
|
*
|
||||||
* @exception std::logic_error if there was no previous call to
|
* @exception std::logic_error if there was no previous call to
|
||||||
* playThis().
|
* playThis().
|
||||||
* @see #playThis
|
* @see #open
|
||||||
* @see #stop
|
* @see #stop
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
start(void) throw (std::logic_error)
|
start(void) throw (std::logic_error)
|
||||||
= 0;
|
= 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause the player.
|
||||||
|
* Playing can be resumed by calling start().
|
||||||
|
*
|
||||||
|
* @exception std::logic_error if there was no previous call to
|
||||||
|
* open().
|
||||||
|
* @see #open
|
||||||
|
* @see #start
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
pause(void) throw (std::logic_error)
|
||||||
|
= 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell if we're currently playing.
|
* Tell if we're currently playing.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/AudioPlayerFactoryTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/AudioPlayerFactoryTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -147,7 +147,7 @@ AudioPlayerFactoryTest :: simplePlayTest(void)
|
||||||
{
|
{
|
||||||
Ptr<AudioPlayerFactory>::Ref audioPlayerFactory;
|
Ptr<AudioPlayerFactory>::Ref audioPlayerFactory;
|
||||||
Ptr<AudioPlayerInterface>::Ref audioPlayer;
|
Ptr<AudioPlayerInterface>::Ref audioPlayer;
|
||||||
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
Ptr<time_duration>::Ref sleepT;
|
||||||
|
|
||||||
audioPlayerFactory = AudioPlayerFactory::getInstance();
|
audioPlayerFactory = AudioPlayerFactory::getInstance();
|
||||||
audioPlayer = audioPlayerFactory->getAudioPlayer();
|
audioPlayer = audioPlayerFactory->getAudioPlayer();
|
||||||
|
@ -160,6 +160,15 @@ AudioPlayerFactoryTest :: simplePlayTest(void)
|
||||||
CPPUNIT_ASSERT(!audioPlayer->isPlaying());
|
CPPUNIT_ASSERT(!audioPlayer->isPlaying());
|
||||||
audioPlayer->start();
|
audioPlayer->start();
|
||||||
CPPUNIT_ASSERT(audioPlayer->isPlaying());
|
CPPUNIT_ASSERT(audioPlayer->isPlaying());
|
||||||
|
|
||||||
|
sleepT.reset(new time_duration(seconds(8)));
|
||||||
|
TimeConversion::sleep(sleepT);
|
||||||
|
audioPlayer->pause();
|
||||||
|
sleepT.reset(new time_duration(seconds(1)));
|
||||||
|
TimeConversion::sleep(sleepT);
|
||||||
|
audioPlayer->start();
|
||||||
|
|
||||||
|
sleepT.reset(new time_duration(microseconds(10)));
|
||||||
while (audioPlayer->isPlaying()) {
|
while (audioPlayer->isPlaying()) {
|
||||||
TimeConversion::sleep(sleepT);
|
TimeConversion::sleep(sleepT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.16 $
|
Version : $Revision: 1.17 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -329,6 +329,20 @@ HelixPlayer :: start(void) throw (std::logic_error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Pause the player
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
HelixPlayer :: pause(void) throw (std::logic_error)
|
||||||
|
{
|
||||||
|
if (player->GetSourceCount() == 0) {
|
||||||
|
throw std::logic_error("HelixPlayer::open() not called yet");
|
||||||
|
}
|
||||||
|
player->Pause();
|
||||||
|
playing = false; // Is this what we want?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Tell if we're playing
|
* Tell if we're playing
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.14 $
|
Version : $Revision: 1.15 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -112,7 +112,7 @@ using namespace LiveSupport::Core;
|
||||||
* </pre></code>
|
* </pre></code>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.14 $
|
* @version $Revision: 1.15 $
|
||||||
*/
|
*/
|
||||||
class HelixPlayer : virtual public Configurable,
|
class HelixPlayer : virtual public Configurable,
|
||||||
virtual public AudioPlayerInterface,
|
virtual public AudioPlayerInterface,
|
||||||
|
@ -338,6 +338,18 @@ class HelixPlayer : virtual public Configurable,
|
||||||
virtual void
|
virtual void
|
||||||
start(void) throw (std::logic_error);
|
start(void) throw (std::logic_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause the player.
|
||||||
|
* Playing can be resumed by calling start().
|
||||||
|
*
|
||||||
|
* @exception std::logic_error if there was no previous call to
|
||||||
|
* open().
|
||||||
|
* @see #open
|
||||||
|
* @see #start
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
pause(void) throw (std::logic_error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell if we're currently playing.
|
* Tell if we're currently playing.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.8 $
|
Version : $Revision: 1.9 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -70,6 +70,10 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
set_title(*getResourceUstring("windowTitle"));
|
set_title(*getResourceUstring("windowTitle"));
|
||||||
playButton.reset(new Gtk::Button(
|
playButton.reset(new Gtk::Button(
|
||||||
*getResourceUstring("playButtonLabel")));
|
*getResourceUstring("playButtonLabel")));
|
||||||
|
pauseButton.reset(new Gtk::Button(
|
||||||
|
*getResourceUstring("pauseButtonLabel")));
|
||||||
|
stopButton.reset(new Gtk::Button(
|
||||||
|
*getResourceUstring("stopButtonLabel")));
|
||||||
closeButton.reset(new Gtk::Button(
|
closeButton.reset(new Gtk::Button(
|
||||||
*getResourceUstring("closeButtonLabel")));
|
*getResourceUstring("closeButtonLabel")));
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
|
@ -82,7 +86,23 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
playButton->set_relief(Gtk::RELIEF_NORMAL);
|
playButton->set_relief(Gtk::RELIEF_NORMAL);
|
||||||
// Register the signal handler for the button getting clicked.
|
// Register the signal handler for the button getting clicked.
|
||||||
playButton->signal_clicked().connect(sigc::mem_fun(*this,
|
playButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&DjBagWindow::onPlayItem));
|
&DjBagWindow::onPlayButtonClicked));
|
||||||
|
|
||||||
|
// set up the pause button
|
||||||
|
pauseButton->set_name("pauseButton");
|
||||||
|
pauseButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT);
|
||||||
|
pauseButton->set_relief(Gtk::RELIEF_NORMAL);
|
||||||
|
// Register the signal handler for the button getting clicked.
|
||||||
|
pauseButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onPauseButtonClicked));
|
||||||
|
|
||||||
|
// set up the stop button
|
||||||
|
stopButton->set_name("stopButton");
|
||||||
|
stopButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT);
|
||||||
|
stopButton->set_relief(Gtk::RELIEF_NORMAL);
|
||||||
|
// Register the signal handler for the button getting clicked.
|
||||||
|
stopButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&DjBagWindow::onStopButtonClicked));
|
||||||
|
|
||||||
// set up the close button
|
// set up the close button
|
||||||
closeButton->set_name("closeButton");
|
closeButton->set_name("closeButton");
|
||||||
|
@ -111,6 +131,14 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
playButtonBox.set_border_width(5);
|
playButtonBox.set_border_width(5);
|
||||||
playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD);
|
playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD);
|
||||||
|
|
||||||
|
playButtonBox.pack_start(*pauseButton, Gtk::PACK_SHRINK);
|
||||||
|
playButtonBox.set_border_width(5);
|
||||||
|
playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD);
|
||||||
|
|
||||||
|
playButtonBox.pack_start(*stopButton, Gtk::PACK_SHRINK);
|
||||||
|
playButtonBox.set_border_width(5);
|
||||||
|
playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD);
|
||||||
|
|
||||||
buttonBox.pack_start(*closeButton, Gtk::PACK_SHRINK);
|
buttonBox.pack_start(*closeButton, Gtk::PACK_SHRINK);
|
||||||
buttonBox.set_border_width(5);
|
buttonBox.set_border_width(5);
|
||||||
buttonBox.set_layout(Gtk::BUTTONBOX_END);
|
buttonBox.set_layout(Gtk::BUTTONBOX_END);
|
||||||
|
@ -555,8 +583,59 @@ DjBagWindow :: onPlayItem(void) throw ()
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
|
||||||
gLiveSupport->play(playable);
|
try {
|
||||||
|
gLiveSupport->playAudio(playable);
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
std::cerr << "GLiveSupport::playAudio() error:" << std::endl
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
std::cerr << "GLiveSupport::playAudio() error:" << std::endl
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the Play button getting clicked
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DjBagWindow :: onPlayButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
onPlayItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the Pause button getting clicked
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DjBagWindow :: onPauseButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
gLiveSupport->pauseAudio();
|
||||||
|
} catch (std::logic_error &e) {
|
||||||
|
std::cerr << "GLiveSupport::pauseAudio() error:" << std::endl
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the Stop button getting clicked
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DjBagWindow :: onStopButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
gLiveSupport->stopAudio();
|
||||||
|
} catch (XmlRpcException &e) {
|
||||||
|
std::cerr << "GLiveSupport::stopAudio() error:" << std::endl
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
} catch (std::logic_error &e) {
|
||||||
|
std::cerr << "GLiveSupport::stopAudio() error:" << std::endl
|
||||||
|
<< e.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -68,7 +68,7 @@ using namespace LiveSupport::Core;
|
||||||
* playlists.
|
* playlists.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
class DjBagWindow : public Gtk::Window, public LocalizedObject
|
class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
* Lists one clip per row.
|
* Lists one clip per row.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||||
{
|
{
|
||||||
|
@ -152,6 +152,16 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Button>::Ref playButton;
|
Ptr<Gtk::Button>::Ref playButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pause button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref pauseButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stop button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref stopButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The box containing the close button.
|
* The box containing the close button.
|
||||||
*/
|
*/
|
||||||
|
@ -174,6 +184,24 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Menu>::Ref playlistMenu;
|
Ptr<Gtk::Menu>::Ref playlistMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the play button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onPlayButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the pause button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onPauseButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the stop button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onStopButtonClicked(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for the close button clicked.
|
* Signal handler for the close button clicked.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.22 $
|
Version : $Revision: 1.23 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -477,7 +477,7 @@ GLiveSupport :: addToPlaylist(Ptr<const UniqueId>::Ref id)
|
||||||
openPlaylistForEditing();
|
openPlaylistForEditing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// for some wierd reason, the storage functions won't accept
|
// for some weird reason, the storage functions won't accept
|
||||||
// Ptr<const UniqueId>::Ref, just a non-const version
|
// Ptr<const UniqueId>::Ref, just a non-const version
|
||||||
Ptr<UniqueId>::Ref uid(new UniqueId(id->getId()));
|
Ptr<UniqueId>::Ref uid(new UniqueId(id->getId()));
|
||||||
|
|
||||||
|
@ -572,40 +572,85 @@ GLiveSupport :: deletePlayable(Ptr<Playable>::Ref playable)
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
LiveSupport :: GLiveSupport ::
|
LiveSupport :: GLiveSupport ::
|
||||||
GLiveSupport :: play(Ptr<Playable>::Ref playable)
|
GLiveSupport :: playAudio(Ptr<Playable>::Ref playable)
|
||||||
throw (XmlRpcException,
|
throw (XmlRpcException,
|
||||||
std::runtime_error)
|
std::invalid_argument,
|
||||||
|
std::logic_error,
|
||||||
|
std::runtime_error)
|
||||||
{
|
{
|
||||||
Ptr<AudioClip>::Ref tempAudioClip;
|
if (audioPlayerIsPaused) {
|
||||||
Ptr<Playlist>::Ref tempPlaylist;
|
audioPlayer->start();
|
||||||
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
audioPlayerIsPaused = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stopAudio(); // stop the audio player and release old resources
|
||||||
|
|
||||||
switch (playable->getType()) {
|
switch (playable->getType()) {
|
||||||
case Playable::AudioClipType:
|
case Playable::AudioClipType:
|
||||||
tempAudioClip = storage->acquireAudioClip(sessionId,
|
itemPlayingNow = storage->acquireAudioClip(sessionId,
|
||||||
playable->getId());
|
playable->getId());
|
||||||
audioPlayer->open(*tempAudioClip->getUri());
|
audioPlayer->open(*itemPlayingNow->getUri());
|
||||||
audioPlayer->start();
|
audioPlayer->start();
|
||||||
while (audioPlayer->isPlaying()) {
|
|
||||||
TimeConversion::sleep(sleepT);
|
|
||||||
}
|
|
||||||
audioPlayer->close();
|
|
||||||
storage->releaseAudioClip(sessionId, tempAudioClip);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Playable::PlaylistType:
|
case Playable::PlaylistType:
|
||||||
tempPlaylist = storage->acquirePlaylist(sessionId,
|
itemPlayingNow = storage->acquirePlaylist(sessionId,
|
||||||
playable->getId());
|
playable->getId());
|
||||||
audioPlayer->openAndStart(tempPlaylist);
|
audioPlayer->openAndStart(itemPlayingNow->getPlaylist());
|
||||||
while (audioPlayer->isPlaying()) {
|
|
||||||
TimeConversion::sleep(sleepT);
|
|
||||||
}
|
|
||||||
audioPlayer->close();
|
|
||||||
storage->releasePlaylist(sessionId, tempPlaylist);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default: // this never happens
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audioPlayerIsPaused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Stop the audio player.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveSupport :: GLiveSupport ::
|
||||||
|
GLiveSupport :: stopAudio(void)
|
||||||
|
throw (XmlRpcException,
|
||||||
|
std::logic_error)
|
||||||
|
{
|
||||||
|
audioPlayer->close();
|
||||||
|
|
||||||
|
if (itemPlayingNow) {
|
||||||
|
switch (itemPlayingNow->getType()) {
|
||||||
|
case Playable::AudioClipType:
|
||||||
|
storage->releaseAudioClip(sessionId,
|
||||||
|
itemPlayingNow->getAudioClip());
|
||||||
|
itemPlayingNow.reset();
|
||||||
|
break;
|
||||||
|
case Playable::PlaylistType:
|
||||||
|
storage->releasePlaylist(sessionId,
|
||||||
|
itemPlayingNow->getPlaylist());
|
||||||
|
itemPlayingNow.reset();
|
||||||
|
break;
|
||||||
|
default: // this never happens
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
audioPlayerIsPaused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Pause the audio player.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveSupport :: GLiveSupport ::
|
||||||
|
GLiveSupport :: pauseAudio(void)
|
||||||
|
throw (std::logic_error)
|
||||||
|
{
|
||||||
|
if (audioPlayer->isPlaying()) {
|
||||||
|
audioPlayer->pause();
|
||||||
|
audioPlayerIsPaused = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.21 $
|
Version : $Revision: 1.22 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -100,7 +100,7 @@ class MasterPanelWindow;
|
||||||
* respective documentation.
|
* respective documentation.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.21 $
|
* @version $Revision: 1.22 $
|
||||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||||
* @see AuthenticationClientFactory
|
* @see AuthenticationClientFactory
|
||||||
* @see StorageClientFactory
|
* @see StorageClientFactory
|
||||||
|
@ -182,6 +182,16 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
*/
|
*/
|
||||||
Ptr<Playlist>::Ref editedPlaylist;
|
Ptr<Playlist>::Ref editedPlaylist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The playlist or audio clip that is being played (may be null).
|
||||||
|
*/
|
||||||
|
Ptr<Playable>::Ref itemPlayingNow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the audio player has been paused.
|
||||||
|
*/
|
||||||
|
bool audioPlayerIsPaused;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a supportedLanguages configuration element,
|
* Read a supportedLanguages configuration element,
|
||||||
* and fill the supportedLanguages map with its contents.
|
* and fill the supportedLanguages map with its contents.
|
||||||
|
@ -511,13 +521,37 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
* Play a Playable object using the audio player.
|
* Play a Playable object using the audio player.
|
||||||
*
|
*
|
||||||
* @param playable the Playable object to play.
|
* @param playable the Playable object to play.
|
||||||
* @exception XmlRpcException in case of XML-RPC errors.
|
* @exception XmlRpcException in case of storage server errors.
|
||||||
|
* @exception std::invalid_argument in case of audio player errors.
|
||||||
|
* @exception std::logic_error in case of audio player errors.
|
||||||
* @exception std::runtime_error in case of audio player errors.
|
* @exception std::runtime_error in case of audio player errors.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
play(Ptr<Playable>::Ref playable)
|
playAudio(Ptr<Playable>::Ref playable)
|
||||||
throw (XmlRpcException,
|
throw (XmlRpcException,
|
||||||
std::runtime_error);
|
std::invalid_argument,
|
||||||
|
std::logic_error,
|
||||||
|
std::runtime_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop the audio player.
|
||||||
|
*
|
||||||
|
* @exception XmlRpcException in case of storage server errors.
|
||||||
|
* @exception std::logic_error in case of audio player errors.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
stopAudio(void)
|
||||||
|
throw (XmlRpcException,
|
||||||
|
std::logic_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause the audio player.
|
||||||
|
*
|
||||||
|
* @exception std::logic_error in case of audio player errors.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
pauseAudio(void)
|
||||||
|
throw (std::logic_error);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.13 $
|
Version : $Revision: 1.14 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -177,6 +177,7 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
MasterPanelWindow :: ~MasterPanelWindow (void) throw ()
|
MasterPanelWindow :: ~MasterPanelWindow (void) throw ()
|
||||||
{
|
{
|
||||||
resetTimer();
|
resetTimer();
|
||||||
|
gLiveSupport->stopAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,10 @@ hu:table
|
||||||
|
|
||||||
typeColumnLabel:string { "típus" }
|
typeColumnLabel:string { "típus" }
|
||||||
titleColumnLabel:string { "cím" }
|
titleColumnLabel:string { "cím" }
|
||||||
closeButtonLabel:string { "bezár" }
|
|
||||||
playButtonLabel:string { "lejátszás" }
|
playButtonLabel:string { "lejátszás" }
|
||||||
|
pauseButtonLabel:string { "szünet" }
|
||||||
|
stopButtonLabel:string { "stop" }
|
||||||
|
closeButtonLabel:string { "bezár" }
|
||||||
|
|
||||||
upMenuItem:string { "_Fel" }
|
upMenuItem:string { "_Fel" }
|
||||||
downMenuItem:string { "_Le" }
|
downMenuItem:string { "_Le" }
|
||||||
|
|
|
@ -38,8 +38,10 @@ root:table
|
||||||
|
|
||||||
typeColumnLabel:string { "type" }
|
typeColumnLabel:string { "type" }
|
||||||
titleColumnLabel:string { "title" }
|
titleColumnLabel:string { "title" }
|
||||||
closeButtonLabel:string { "close" }
|
|
||||||
playButtonLabel:string { "play" }
|
playButtonLabel:string { "play" }
|
||||||
|
pauseButtonLabel:string { "pause" }
|
||||||
|
stopButtonLabel:string { "stop" }
|
||||||
|
closeButtonLabel:string { "close" }
|
||||||
|
|
||||||
upMenuItem:string { "Move _Up" }
|
upMenuItem:string { "Move _Up" }
|
||||||
downMenuItem:string { "Move D_own" }
|
downMenuItem:string { "Move D_own" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue