added first (primitive) "play this" function to Scratchpad (DJ Bag)
This commit is contained in:
parent
4e2d6b14a9
commit
cae9c68173
6 changed files with 107 additions and 15 deletions
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.6 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.7 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -144,6 +144,10 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
*getResourceUstring("deleteMenuItem"),
|
||||
sigc::mem_fun(*this,
|
||||
&DjBagWindow::onDeleteItem)));
|
||||
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||
*getResourceUstring("playMenuItem"),
|
||||
sigc::mem_fun(*this,
|
||||
&DjBagWindow::onPlayItem)));
|
||||
audioClipMenu->accelerate(*this);
|
||||
|
||||
// create the right-click entry context menu for playlists
|
||||
|
@ -174,7 +178,11 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
*getResourceUstring("deleteMenuItem"),
|
||||
sigc::mem_fun(*this,
|
||||
&DjBagWindow::onDeleteItem)));
|
||||
audioClipMenu->accelerate(*this);
|
||||
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
|
||||
*getResourceUstring("playMenuItem"),
|
||||
sigc::mem_fun(*this,
|
||||
&DjBagWindow::onPlayItem)));
|
||||
playlistMenu->accelerate(*this);
|
||||
|
||||
// show
|
||||
showContents();
|
||||
|
@ -518,3 +526,23 @@ DjBagWindow :: onSchedulePlaylist(void) throw ()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the Play menu item selected from the entry conext menu
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
DjBagWindow :: onPlayItem(void) throw ()
|
||||
{
|
||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||
treeView.get_selection();
|
||||
|
||||
if (refSelection) {
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
|
||||
gLiveSupport->play(playable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.4 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.5 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -67,8 +67,8 @@ using namespace LiveSupport::Core;
|
|||
* The DJ Bag window, showing recent and relevant audio clips and
|
||||
* playlists.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.4 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.5 $
|
||||
*/
|
||||
class DjBagWindow : public Gtk::Window, public LocalizedObject
|
||||
{
|
||||
|
@ -79,8 +79,8 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
|||
* The columns model needed by Gtk::TreeView.
|
||||
* Lists one clip per row.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.4 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.5 $
|
||||
*/
|
||||
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
|
@ -220,6 +220,13 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
|
|||
virtual void
|
||||
onSchedulePlaylist(void) throw ();
|
||||
|
||||
/**
|
||||
* Signal handler for the "play item" menu item selected
|
||||
* from the entry context menu.
|
||||
*/
|
||||
virtual void
|
||||
onPlayItem(void) throw ();
|
||||
|
||||
/**
|
||||
* Delete an item from the storage and remove it from the dj bag.
|
||||
*
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.20 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.21 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -41,12 +41,14 @@
|
|||
#include "LiveSupport/Storage/StorageClientFactory.h"
|
||||
#include "LiveSupport/SchedulerClient/SchedulerClientFactory.h"
|
||||
#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
|
||||
#include "LiveSupport/Core/TimeConversion.h"
|
||||
|
||||
#include "MasterPanelWindow.h"
|
||||
#include "GLiveSupport.h"
|
||||
|
||||
|
||||
using namespace boost;
|
||||
using namespace boost::posix_time;
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Authentication;
|
||||
|
@ -565,3 +567,45 @@ GLiveSupport :: deletePlayable(Ptr<Playable>::Ref playable)
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Play a Playable object using the audio player.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: play(Ptr<Playable>::Ref playable)
|
||||
throw (XmlRpcException,
|
||||
std::runtime_error)
|
||||
{
|
||||
Ptr<AudioClip>::Ref tempAudioClip;
|
||||
Ptr<Playlist>::Ref tempPlaylist;
|
||||
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
||||
|
||||
switch (playable->getType()) {
|
||||
case Playable::AudioClipType:
|
||||
tempAudioClip = storage->acquireAudioClip(sessionId,
|
||||
playable->getId());
|
||||
audioPlayer->open(*tempAudioClip->getUri());
|
||||
audioPlayer->start();
|
||||
while (audioPlayer->isPlaying()) {
|
||||
TimeConversion::sleep(sleepT);
|
||||
}
|
||||
audioPlayer->close();
|
||||
storage->releaseAudioClip(sessionId, tempAudioClip);
|
||||
break;
|
||||
|
||||
case Playable::PlaylistType:
|
||||
tempPlaylist = storage->acquirePlaylist(sessionId,
|
||||
playable->getId());
|
||||
audioPlayer->openAndStart(tempPlaylist);
|
||||
while (audioPlayer->isPlaying()) {
|
||||
TimeConversion::sleep(sleepT);
|
||||
}
|
||||
audioPlayer->close();
|
||||
storage->releasePlaylist(sessionId, tempPlaylist);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.20 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.21 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -99,8 +99,8 @@ class MasterPanelWindow;
|
|||
* <code>schedulerClientFactory</code> elements see their
|
||||
* respective documentation.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.20 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.21 $
|
||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||
* @see AuthenticationClientFactory
|
||||
* @see StorageClientFactory
|
||||
|
@ -507,6 +507,17 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
deletePlayable(Ptr<Playable>::Ref playable)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
* Play a Playable object using the audio player.
|
||||
*
|
||||
* @param playable the Playable object to play.
|
||||
* @exception XmlRpcException in case of XML-RPC errors.
|
||||
* @exception std::runtime_error in case of audio player errors.
|
||||
*/
|
||||
virtual void
|
||||
play(Ptr<Playable>::Ref playable)
|
||||
throw (XmlRpcException,
|
||||
std::runtime_error);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ hu:table
|
|||
addToPlaylistMenuItem:string { "_Hozzáad Playlist-hez" }
|
||||
schedulePlaylistMenuItem:string { "_Playlist időzítése" }
|
||||
deleteMenuItem:string { "_Töröl" }
|
||||
playMenuItem:string { "Le_játszâs" }
|
||||
}
|
||||
|
||||
playlistListWindow:table
|
||||
|
|
|
@ -46,6 +46,7 @@ root:table
|
|||
addToPlaylistMenuItem:string { "_Add To Playlist" }
|
||||
schedulePlaylistMenuItem:string { "_Schedule Playlist" }
|
||||
deleteMenuItem:string { "_Delete" }
|
||||
playMenuItem:string { "_Play" }
|
||||
}
|
||||
|
||||
playlistListWindow:table
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue