[mythtv] PATCH: MythMusic Cycle Visualizer when song changes
DanM
dan at milkcarton.com
Fri Mar 28 17:31:32 EST 2003
Attached is a patch for MythMusic which changes the visualizer when the
song changes (Either automaticly when the previous song ends, or the
user presses the "Next" button. Its mainly useful if you have
VisualMode=Random or a list
(VisualMode=Goom,StereoScope,BumpScope,etc). This patch is built on my
previous patch (Which sets the visualizer to start automaticly if
VisualModeDelay=0).
Accompining (sp?) this patch is a setting in mythmusic-settings.txt:
# Change Visual when song changes?
VisualCycleOnSongChange=1
If you want/need me to build the patch on a clean playbackbox.cpp let me
know.
-dan
-------------- next part --------------
? mythmusic_visualizer_cycle.diff
Index: mythmusic/playbackbox.cpp
===================================================================
RCS file: /var/lib/cvs/mythmusic/mythmusic/playbackbox.cpp,v
retrieving revision 1.31
diff -u -d -r1.31 playbackbox.cpp
--- mythmusic/playbackbox.cpp 25 Mar 2003 20:12:06 -0000 1.31
+++ mythmusic/playbackbox.cpp 29 Mar 2003 02:21:10 -0000
@@ -90,7 +90,7 @@
seekbar = new QSlider(Qt::Horizontal, this);
seekbar->setFocusPolicy(NoFocus);
seekbar->setTracking(false);
- seekbar->blockSignals(true);
+ seekbar->blockSignals(true);
vbox2->addWidget(seekbar);
@@ -98,9 +98,9 @@
MythToolButton *prevfileb = new MythToolButton(this);
prevfileb->setAutoRaise(true);
- prevfileb->setIconSet(scalePixmap((const char **)prevfile_pix));
+ prevfileb->setIconSet(scalePixmap((const char **)prevfile_pix));
connect(prevfileb, SIGNAL(clicked()), this, SLOT(previous()));
-
+
MythToolButton *prevb = new MythToolButton(this);
prevb->setAutoRaise(true);
prevb->setIconSet(scalePixmap((const char **)prev_pix));
@@ -201,7 +201,7 @@
{
// There may be a better key press
// mapping, but I have a pretty
- // serious flu at the moment and
+ // serious flu at the moment and
// I can't think of one
prevfileb->setAccel(Key_Up);
@@ -224,9 +224,9 @@
rateup->setAccel(Key_U);
rateup->setFocusPolicy( QWidget::NoFocus);
ratedn->setAccel(Key_D);
- ratedn->setFocusPolicy( QWidget::NoFocus);
+ ratedn->setFocusPolicy( QWidget::NoFocus);
}
-
+
randomize->setAccel(Key_1);
randomize->setFocusPolicy( QWidget::NoFocus);
repeat->setAccel(Key_2);
@@ -347,7 +347,8 @@
}
visual_mode_timer = new QTimer();
- if(visual_mode_delay > 0)
+ // -1 means no visualization
+ if(visual_mode_delay > -1)
{
visual_mode_timer->start(visual_mode_delay * 1000);
connect(prevfileb, SIGNAL(clicked()), this, SLOT(resetTimer()));
@@ -691,7 +692,7 @@
pause();
return;
}
-
+
if (!sourceurl.isLocalFile()) {
StreamInput streaminput(sourceurl);
streaminput.setup();
@@ -752,17 +753,21 @@
isplaying = true;
curMeta->setLastPlay();
- curMeta->incPlayCount();
-
+ curMeta->incPlayCount();
+
playlist_timer->start(1, true);
-
+
gContext->LCDswitchToChannel(curMeta->Artist(), curMeta->Title(), "");
}
}
void PlaybackBox::visEnable()
{
- if (!visualizer_is_active && isplaying)
+ int cycle_visualizer = gContext->GetNumSetting("VisualCycleOnSongChange", 0);
+
+ // Turn on the visualizer if its not on Or Cycle it if its on, and the user wants to
+ // change the visulizer when each song changes
+ if ( (!visualizer_is_active && isplaying) || (visualizer_is_active && cycle_visualizer) )
{
visual_mode_timer->stop();
mainvisual->setVisual("Blank");
@@ -905,7 +910,7 @@
{
if(plist->count() < 1)
return;
-
+
listlock.lock();
if (isplaying == true)
@@ -915,14 +920,19 @@
if (shuffleindex >= (int)plist->count())
shuffleindex = 0;
-
+
playlistindex = playlistorder[shuffleindex];
curMeta = &(*plist->at(playlistindex));
listlock.unlock();
-
play();
+
+ //Call visEnable to cycle the visualizer IF: Its currently on, and the user wants
+ // to cycle the visualizer when the song changes
+ int cycle_visualizer = gContext->GetNumSetting("VisualCycleOnSongChange", 0);
+ if (visualizer_is_active && cycle_visualizer)
+ visEnable();
}
void PlaybackBox::nextAuto()
More information about the mythtv-dev
mailing list