half of the solution for #2012, for testing

This commit is contained in:
fgerlits 2006-11-22 16:41:34 +00:00
parent 9cd9d86218
commit 4b1ea1e069
5 changed files with 65 additions and 2 deletions

View File

@ -1163,6 +1163,32 @@ GLiveSupport :: removeFromSchedule(Ptr<const UniqueId>::Ref scheduleEntryId)
}
/*------------------------------------------------------------------------------
* Preload the item in the output audio player.
*----------------------------------------------------------------------------*/
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: preload(Ptr<const Playable>::Ref playable)
throw ()
{
Ptr<const std::string>::Ref uri = playable->getUri();
if (uri) {
try {
outputPlayer->preload(*uri);
} catch (std::invalid_argument) {
std::cerr << "gLiveSupport: invalid argument in preload("
<< *uri
<< ")" << std::endl;
} catch (std::runtime_error) {
std::cerr << "gLiveSupport: runtime error in preload("
<< *uri
<< ")" << std::endl;
}
}
}
/*------------------------------------------------------------------------------
* Play a Playable object using the output audio player.
*----------------------------------------------------------------------------*/

View File

@ -870,6 +870,16 @@ class GLiveSupport : public LocalizedConfigurable,
removeFromSchedule(Ptr<const UniqueId>::Ref scheduleEntryId)
throw (XmlRpcException);
/**
* Preload the item in the output audio player.
* This is to shorten the time a playlist takes to start.
*
* @param playable the Playable object to be preloaded.
*/
void
preload(Ptr<const Playable>::Ref playable)
throw ();
/**
* Play a Playable object using the output audio player.
*

View File

@ -197,6 +197,10 @@ void
LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
{
addItem(treeModel->append(), playable);
if (treeModel->children().size() == 1) {
preloadNextItem();
}
}
@ -268,6 +272,22 @@ LiveModeWindow :: popTop(void) throw ()
}
/*------------------------------------------------------------------------------
* Preload the item at the top of the window.
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: preloadNextItem(void) throw ()
{
Ptr<Playable>::Ref playable;
Gtk::TreeModel::iterator iter = treeModel->children().begin();
if (iter) {
playable = (*iter)[modelColumns.playableColumn];
gLiveSupport->preload(playable);
}
}
/*------------------------------------------------------------------------------
* Find the selected row.
*----------------------------------------------------------------------------*/

View File

@ -341,6 +341,13 @@ class LiveModeWindow : public GuiWindow
Ptr<Playable>::Ref
popTop(void) throw ();
/**
* Preload the item at the top of the window.
* This is to shorten the time a playlist takes to start.
*/
void
preloadNextItem() throw ();
/**
* Update the cue player display to show a stopped state.
*/

View File

@ -466,11 +466,11 @@ MasterPanelWindow :: updateLiveModeWindow(Ptr<Playable>::Ref playable)
liveModeButton));
}
liveModeWindow->present();
if (playable) {
liveModeWindow->addItem(playable);
}
liveModeWindow->present();
}