[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/kmid
From: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas () gmail ! com>
Date: 2010-08-01 7:13:00
Message-ID: 20100801071300.9746DAC783 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1157849 by pedrol:
alsa backend fix: tempoChanged() signal
dbus signal: tempoEvent()
M +11 -10 alsa/alsamidiobject.cpp
M +9 -4 src/kmid2.cpp
M +1 -0 src/kmid2.h
M +8 -9 src/kmid_part.cpp
M +1 -0 src/kmid_part.h
--- trunk/extragear/multimedia/kmid/alsa/alsamidiobject.cpp #1157848:1157849
@@ -55,6 +55,7 @@
m_initialTempo(0),
m_playlistIndex(-1),
m_tempoFactor(1.0),
+ m_lastTempo(0),
m_tick(0),
m_duration(0),
m_lastBeat(0),
@@ -108,6 +109,7 @@
int m_initialTempo;
int m_playlistIndex;
qreal m_tempoFactor;
+ qreal m_lastTempo;
qint64 m_tick;
Song m_song;
QStringList m_loadingMessages;
@@ -188,8 +190,14 @@
if ( !SequencerEvent::isConnectionChange(ev) &&
(d->m_state == PlayingState) )
switch(ev->getSequencerType()) {
- case SND_SEQ_EVENT_ECHO:
+ case SND_SEQ_EVENT_ECHO: {
emit tick(ev->getTick());
+ qreal rtempo = currentTempo();
+ if (rtempo != d->m_lastTempo) {
+ emit tempoChanged(rtempo);
+ d->m_lastTempo = rtempo;
+ }
+ }
break;
case SND_SEQ_EVENT_USR8:
emit beat(ev->getRaw32(0), ev->getRaw8(4), ev->getRaw8(5));
@@ -197,13 +205,6 @@
case SND_SEQ_EVENT_TIMESIGN:
emit timeSignatureChanged(ev->getRaw8(0), ::pow(2, ev->getRaw8(1)));
break;
- case SND_SEQ_EVENT_TEMPO: {
- qreal rtempo = 0.0;
- const TempoEvent* te = static_cast<const TempoEvent*>(ev);
- if (te != NULL) rtempo = 6e7 / te->getValue() * d->m_tempoFactor;
- emit tempoChanged(rtempo);
- }
- break;
case SND_SEQ_EVENT_USR_VAR0: {
VariableEvent *ve = static_cast<VariableEvent*>(ev);
if (ve != NULL && ve->getData() != NULL && ve->getLength() > 0) {
@@ -415,6 +416,7 @@
d->m_out->sendResetMessage();
d->m_out->resetControllers();
d->m_lastBeat = 0;
+ d->m_lastTempo = 0;
}
d->m_player->start();
updateState( PlayingState );
@@ -684,9 +686,8 @@
if (!d->m_song.isEmpty()) {
d->m_song.sort();
addSongPadding();
- if (d->m_initialTempo == 0) {
+ if (d->m_initialTempo == 0)
d->m_initialTempo = 500000;
- }
d->m_song.setFileName(fileName);
d->m_player->setSong(&d->m_song);
d->setQueueTempo();
--- trunk/extragear/multimedia/kmid/src/kmid2.cpp #1157848:1157849
@@ -121,6 +121,8 @@
SLOT(slotTimeSignatureEvent(int,int)));
connect(m_midiobj, SIGNAL(beat(int,int,int)),
SLOT(slotBeat(int,int,int)));
+ connect(m_midiobj, SIGNAL(tempoChanged(qreal)),
+ SLOT(slotTempoChanged(qreal)));
/* DBus signals from MIDIObject ones */
connect( m_midiobj, SIGNAL(midiText(int,const QString&)),
@@ -680,7 +682,6 @@
if (rtempo != m_rtempo) {
m_rtempo = rtempo;
m_labelTempo->setText(QString("%1 bpm").arg(rtempo, 5, 'f', 1));
- emit tempoEvent(rtempo);
}
}
@@ -756,10 +757,8 @@
void KMid2::slotTick(qint64 time)
{
- if (!m_seeking) {
+ if (!m_seeking)
m_timeSlider->setSliderPosition(time);
- updateTempoLabel();
- }
emit tick(time);
}
@@ -1745,3 +1744,9 @@
return m_midiobj->currentSource();
return QString();
}
+
+void KMid2::slotTempoChanged(qreal tempo)
+{
+ updateTempoLabel();
+ emit tempoEvent(tempo);
+}
--- trunk/extragear/multimedia/kmid/src/kmid2.h #1157848:1157849
@@ -164,6 +164,7 @@
void slotSoftSynthErrors(const QString& pgm, const QStringList& messages);
void slotBackendChanged(int index);
void slotDockVolLocationChanged ( Qt::DockWidgetArea area );
+ void slotTempoChanged(qreal);
signals:
void playerStateChanged(int state);
--- trunk/extragear/multimedia/kmid/src/kmid_part.cpp #1157848:1157849
@@ -69,8 +69,7 @@
m_autoStart(true),
m_volfactor(1.0),
m_playerReady(false),
- m_playPending(false),
- m_tempo(0.0)
+ m_playPending(false)
{
if (parentWidget != 0)
m_view = new KMidPartView(parentWidget);
@@ -101,7 +100,6 @@
bool m_playerReady;
bool m_playPending;
QMutex m_connmutex;
- double m_tempo;
};
KMidPart::KMidPart( QWidget *parentWidget, QObject *parent, const QVariantList& args )
@@ -288,6 +286,8 @@
SLOT(slotFinished()));
connect(d->m_midiobj, SIGNAL(currentSourceChanged(QString)),
SLOT(slotSourceChanged(QString)));
+ connect(d->m_midiobj, SIGNAL(tempoChanged(qreal)),
+ SLOT(slotTempoChanged(qreal)));
connect(d->m_midiobj, SIGNAL(beat(int,int,int)),
SIGNAL(beat(int,int,int)));
connect(d->m_midiobj, SIGNAL(timeSignatureChanged(int,int)),
@@ -417,12 +417,7 @@
if (d->m_view != 0)
d->m_view->setPosition(ticks);
emit tick(ticks);
- double rtempo = d->m_midiobj->currentTempo();
- if (rtempo != d->m_tempo) {
- d->m_tempo = rtempo;
- emit tempoEvent(rtempo);
}
-}
void KMidPart::slotFinished()
{
@@ -527,7 +522,6 @@
QMutexLocker locker(&d->m_connmutex);
if (d->m_view != 0)
d->m_view->setPosition(0);
- d->m_tempo = 0;
if (d->m_autoStart) {
if (d->m_playerReady) {
locker.unlock();
@@ -653,3 +647,8 @@
return d->m_midiobj->currentSource();
return QString();
}
+
+void KMidPart::slotTempoChanged(qreal tempo)
+{
+ emit tempoEvent(tempo);
+}
--- trunk/extragear/multimedia/kmid/src/kmid_part.h #1157848:1157849
@@ -372,6 +372,7 @@
void slotTick(qint64);
void slotFinished();
void slotSourceChanged(QString);
+ void slotTempoChanged(qreal);
protected:
virtual bool openFile();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic