[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-02 10:40:01
Message-ID: 20100802104001.695E6AC7A9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1158242 by pedrol:
Fix in ALSA sequencer backend for initial MIDI program changes with locked MIDI \
channels and MIDI reset messages.
M +10 -0 ChangeLog
M +10 -1 alsa/alsamidiobject.cpp
M +1 -0 alsa/alsamidiobject.h
M +18 -4 alsa/alsamidioutput.cpp
M +2 -1 alsa/alsamidioutput.h
--- trunk/extragear/multimedia/kmid/ChangeLog #1158241:1158242
@@ -1,3 +1,13 @@
+2010-08-02 Pedro Lopez-Cabanillas
+ * Fix in ALSA sequencer backend for initial MIDI program changes with
+ locked MIDI channels and MIDI reset messages.
+
+2010-08-01 Pedro Lopez-Cabanillas
+ * DBus interfaces org.kde.KMid and org.kde.KMidPart offered by the main
+ program and the kpart respectively.
+ * libkmidbackend new methods: songProperties() and channelProperties(),
+ soversion bumped to 1.0.0
+
2010-07-26 Pedro Lopez-Cabanillas
* vumeter widget: fixed drawing errors and CPU waste
--- trunk/extragear/multimedia/kmid/alsa/alsamidiobject.cpp #1158241:1158242
@@ -27,12 +27,12 @@
#include <alsaevent.h>
#include <alsaqueue.h>
+#include <KIO/NetAccess>
#include <QTextStream>
#include <QTextCodec>
#include <QTime>
#include <QMutex>
#include <QMutexLocker>
-#include <KIO/NetAccess>
using namespace drumstick;
@@ -417,6 +417,7 @@
d->setQueueTempo();
d->m_out->sendResetMessage();
d->m_out->resetControllers();
+ sendInitialProgramChanges();
d->m_lastBeat = 0;
d->m_lastTempo = 0;
}
@@ -862,6 +863,14 @@
return QVariant();
}
+ void ALSAMIDIObject::sendInitialProgramChanges()
+ {
+ for (int i = 0; i < MIDI_CHANNELS; ++i) {
+ int patch(d->m_channelPatches[i]);
+ d->m_out->sendInitialProgram(i, patch);
}
+ }
+}
+
#include "alsamidiobject.moc"
--- trunk/extragear/multimedia/kmid/alsa/alsamidiobject.h #1158241:1158242
@@ -70,6 +70,7 @@
QString channelLabel(int channel);
QVariant songProperty(const QString& key);
QVariant channelProperty(int channel, const QString& key);
+ void sendInitialProgramChanges();
public Q_SLOTS:
void setTickInterval(qint32 interval);
--- trunk/extragear/multimedia/kmid/alsa/alsamidioutput.cpp #1158241:1158242
@@ -52,6 +52,7 @@
m_volume[chan] = 100;
m_muted[chan] = false;
m_locked[chan] = false;
+ m_lockedpgm[chan] = 0;
}
m_runtimeAlsaDrivers = getRuntimeALSADriverNumber();
}
@@ -67,6 +68,7 @@
QString m_currentOutput;
QStringList m_outputDevices;
int m_lastpgm[MIDI_CHANNELS];
+ int m_lockedpgm[MIDI_CHANNELS];
qreal m_volumeShift[MIDI_CHANNELS];
int m_volume[MIDI_CHANNELS];
bool m_muted[MIDI_CHANNELS];
@@ -116,9 +118,9 @@
void transformProgramEvent(SequencerEvent *ev)
{
ProgramChangeEvent *event = static_cast<ProgramChangeEvent*>(ev);
- if (m_mapper != NULL && m_mapper->isOK()) {
int channel = event->getChannel();
m_lastpgm[channel] = event->getValue();
+ if (m_mapper != NULL && m_mapper->isOK()) {
int pgm = m_mapper->patch(channel, m_lastpgm[channel]);
if (pgm >= 0 && pgm < 128)
event->setValue(pgm);
@@ -318,6 +320,8 @@
if (channel >= 0 && channel < MIDI_CHANNELS) {
if (d->m_locked[channel] != lock) {
d->m_locked[channel] = lock;
+ if (lock)
+ d->m_lockedpgm[channel] = d->m_lastpgm[channel];
emit lockedChanged( channel, lock );
}
}
@@ -365,16 +369,17 @@
sendSysexEvent(d->m_resetMessage);
}
- void ALSAMIDIOutput::sendEvent(SequencerEvent *ev)
+ void ALSAMIDIOutput::sendEvent(SequencerEvent *ev, bool discardable)
{
QMutexLocker locker(&d->m_outMutex);
d->transformEvent(ev);
bool discard(false);
if (SequencerEvent::isChannel(ev)) {
ChannelEvent *cev = static_cast<ChannelEvent*>(ev);
- discard = d->m_muted[ cev->getChannel() ] ||
+ discard = discardable &&
+ ( d->m_muted[ cev->getChannel() ] ||
( (cev->getSequencerType() == SND_SEQ_EVENT_PGMCHANGE)
- && d->m_locked[ cev->getChannel() ] );
+ && d->m_locked[ cev->getChannel() ] ) );
}
if (!discard) {
ev->setSource(d->m_portId);
@@ -442,6 +447,15 @@
return 0;
}
+ void ALSAMIDIOutput::sendInitialProgram(int chan, int program)
+ {
+ int pgm(d->m_locked[chan] ? d->m_lockedpgm[chan] : program);
+ if (pgm > -1) {
+ ProgramChangeEvent ev(chan, pgm);
+ sendEvent(&ev, false);
}
+ }
+}
+
#include "alsamidioutput.moc"
--- trunk/extragear/multimedia/kmid/alsa/alsamidioutput.h #1158241:1158242
@@ -71,7 +71,8 @@
void sendChannelPressure(int chan, int value);
void sendPitchBend(int chan, int value);
void sendSysexEvent(const QByteArray& data);
- void sendEvent(SequencerEvent *ev);
+ void sendEvent(SequencerEvent *ev, bool discardable = true);
+ void sendInitialProgram(int channel, int value);
private:
class ALSAMIDIOutputPrivate;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic