summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-11-10 11:11:58 +0000
committerWerner Schweer <ws.seh.de>2006-11-10 11:11:58 +0000
commitbdc48d562c8a90536ec9bda17d7722f019da40e9 (patch)
treea912093a476c4ed8435f0c5d3e5710d6fbf967e0
parent34de91a9bd25d150509912607543235cbee9fa9d (diff)
midi activity leds in midi input strip
-rw-r--r--muse/CMakeLists.txt11
-rw-r--r--muse/ChangeLog3
-rw-r--r--muse/all.h1
-rw-r--r--muse/muse/driver/alsamidi.cpp14
-rw-r--r--muse/muse/midiinport.cpp20
-rw-r--r--muse/muse/midiinport.h2
-rw-r--r--muse/muse/mixer/mstrip.cpp61
-rw-r--r--muse/muse/mixer/mstrip.h6
-rw-r--r--muse/muse/muse.qrc2
-rw-r--r--muse/muse/route.h4
-rw-r--r--muse/muse/xpm/activeoff.svg120
-rw-r--r--muse/muse/xpm/activeon.svg120
12 files changed, 329 insertions, 35 deletions
diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt
index f8e3b5bc..973ccae4 100644
--- a/muse/CMakeLists.txt
+++ b/muse/CMakeLists.txt
@@ -55,11 +55,6 @@ option ( ENABLE_VST "enable VST/win support" OFF)
option ( ENABLE_FLUID "enable fluidsynth softsynth plugins" ON)
option ( ENABLE_ZYNADDSUBFX "enable zyaddsubfx softsynth plugin" ON)
-set(QT_MIN_VERSION "4.2.0")
-set(QT_USE_QTXML TRUE)
-set(QT_USE_QTDESIGNER TRUE)
-set(QT_USE_QTNSPLUGIN TRUE)
-
##
## Just print a notice if this is OS X
##
@@ -76,6 +71,12 @@ endif (APPLE)
## look for Qt4
##
+set(QT_MIN_VERSION "4.2.0")
+set(QT_USE_QTXML TRUE)
+set(QT_USE_QTDESIGNER TRUE)
+set(QT_USE_QTNSPLUGIN TRUE)
+set(QT_USE_QTSVG TRUE)
+
find_package(Qt4)
if (NOT QT4_FOUND)
diff --git a/muse/ChangeLog b/muse/ChangeLog
index e25be625..d330e606 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,6 @@
+10.11 (ws)
+ - replaced meter in midi input strip by activity "leds" for all
+ midi channels
8.11 (ws)
- removed the suboptimal "MidiChannel" concept. MidiChannels are
now merged with MidiTracks.
diff --git a/muse/all.h b/muse/all.h
index e731b9b9..c074560c 100644
--- a/muse/all.h
+++ b/muse/all.h
@@ -115,6 +115,7 @@
#include <QtGui/QStyleFactory>
#include <QtGui/QDockWidget>
#include <QtGui/QDesktopServices>
+#include <QtSvg/QSvgRenderer>
#endif
diff --git a/muse/muse/driver/alsamidi.cpp b/muse/muse/driver/alsamidi.cpp
index ba3f303c..1df1199b 100644
--- a/muse/muse/driver/alsamidi.cpp
+++ b/muse/muse/driver/alsamidi.cpp
@@ -654,6 +654,9 @@ bool AlsaMidi::putEvent(snd_seq_event_t* event)
void AlsaMidi::updateConnections()
{
+ //
+ // add connections
+ //
while (!addCon.isEmpty()) {
PortRoute pr = addCon.get();
MidiOutPortList* opl = song->midiOutPorts();
@@ -686,18 +689,19 @@ void AlsaMidi::updateConnections()
}
}
}
+ //
+ // remove connections
+ //
while (!removeCon.isEmpty()) {
PortRoute pr = removeCon.get();
foreach(MidiInPort* iport, *(song->midiInPorts())) {
Port dst = iport->alsaPort();
-
if (dst == pr.dst) {
RouteList* irl = iport->inRoutes();
for (iRoute r = irl->begin(); r != irl->end(); ++r) {
-/*TODO*/ if (/*(!r->disconnected) &&*/ (r->src.port == pr.src)) {
+ if (r->src.port == pr.src) {
iport->inRoutes()->erase(r);
-// printf("remove in connection\n");
break;
}
}
@@ -707,13 +711,11 @@ void AlsaMidi::updateConnections()
foreach(MidiOutPort* oport, *(song->midiOutPorts())) {
Port src = oport->alsaPort();
-
if (src == pr.src) {
RouteList* orl = oport->outRoutes();
for (iRoute r = orl->begin(); r != orl->end(); ++r) {
- if (/*(!r->disconnected) &&*/ (r->dst.port == pr.dst)) {
+ if (r->dst.port == pr.dst) {
orl->erase(r);
-// printf("remove out connection\n");
break;
}
}
diff --git a/muse/muse/midiinport.cpp b/muse/muse/midiinport.cpp
index f340cb94..1035bf14 100644
--- a/muse/muse/midiinport.cpp
+++ b/muse/muse/midiinport.cpp
@@ -26,6 +26,7 @@
#include "driver/mididev.h"
#include "driver/audiodev.h"
#include "audio.h"
+#include "gconfig.h"
#include "midiinport.h"
@@ -40,6 +41,8 @@ MidiInPort::MidiInPort()
recordRead = 0;
recordWrite = 0;
recordCount = 0;
+ for (int i = 0; i < MIDI_CHANNELS; ++i)
+ activity[i] = 0;
}
//---------------------------------------------------------
@@ -171,12 +174,14 @@ void MidiInPort::eventReceived(snd_seq_event_t* ev)
pipeline()->apply(audio->curTickPos(), audio->nextTickPos(), &il, &ol);
//
- // update midi meter
+ // update midi activity
// notify gui of new events
//
+ int hold = config.guiRefresh / 5 + 1; // hold for >= 1/5 sec
+
for (iMidiEvent i = ol.begin(); i != ol.end(); ++i) {
if (i->type() == ME_NOTEON)
- addMidiMeter(i->dataB());
+ activity[i->channel()] += hold;
song->putEvent(*i);
if (recordCount == RECORD_FIFO_SIZE) {
printf("MusE: eventReceived(): fifo overflow\n");
@@ -232,3 +237,14 @@ void MidiInPort::getEvents(unsigned, unsigned, int ch, MidiEventList* dst)
}
}
+//---------------------------------------------------------
+// checkActivity
+//---------------------------------------------------------
+
+bool MidiInPort::checkActivity(int channel)
+ {
+ if (activity[channel])
+ --activity[channel];
+ return activity[channel] != 0;
+ }
+
diff --git a/muse/muse/midiinport.h b/muse/muse/midiinport.h
index a5d72804..4a7b8bf1 100644
--- a/muse/muse/midiinport.h
+++ b/muse/muse/midiinport.h
@@ -37,6 +37,7 @@ class MidiInPort : public MidiTrackBase {
int recordRead, recordWrite;
volatile int recordCount;
int tmpRecordCount;
+ int activity[MIDI_CHANNELS];
public:
MidiInPort();
@@ -55,6 +56,7 @@ class MidiInPort : public MidiTrackBase {
virtual void getEvents(unsigned from, unsigned to, int channel, MidiEventList* dst);
void beforeProcess();
void afterProcess();
+ bool checkActivity(int channel);
};
typedef QList<MidiInPort*> MidiInPortList;
diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp
index 49eac1f4..dec6c55d 100644
--- a/muse/muse/mixer/mstrip.cpp
+++ b/muse/muse/mixer/mstrip.cpp
@@ -842,26 +842,45 @@ MidiInPortStrip::MidiInPortStrip(Mixer* m, MidiInPort* t, bool align)
rack->setFixedSize(STRIP_WIDTH, rack->sizeHint().height()+2);
layout->addWidget(rack);
- if (_align)
- // layout->addSpacing(STRIP_WIDTH/2);
- layout->addSpacing(LABEL_HEIGHT);
-
- //---------------------------------------------------
- // slider, label, meter
- //---------------------------------------------------
-
- meter = new Awl::MidiMeter(this);
- meter->setFixedWidth(40);
- layout->addWidget(meter, 100, Qt::AlignRight);
-
//---------------------------------------------------
- // pan, balance
+ // input activity
//---------------------------------------------------
- if (_align) {
- layout->addSpacing(STRIP_WIDTH/2 + STRIP_WIDTH/3);
- layout->addSpacing(LABEL_HEIGHT);
+ layout->addStretch(100);
+
+ QGridLayout* ag = new QGridLayout;
+ ag->setMargin(4);
+ ag->setSpacing(1);
+ QSvgRenderer sr;
+ QPainter painter;
+
+ sr.load(QString(":/xpm/activeon.svg"));
+ QSize aSize(sr.defaultSize());
+ activityOn = new QPixmap(aSize);
+ activityOn->fill(Qt::transparent);
+ painter.begin(activityOn);
+ sr.render(&painter);
+ painter.end();
+
+ sr.load(QString(":/xpm/activeoff.svg"));
+ activityOff = new QPixmap(aSize);
+ activityOff->fill(Qt::transparent);
+ painter.begin(activityOff);
+ sr.render(&painter);
+ painter.end();
+
+ for (int ch = MIDI_CHANNELS-1; ch >= 0; --ch) {
+ QLabel* l = new QLabel(QString("%1").arg(ch+1));
+ QFont f = l->font();
+ f.setPixelSize(8);
+ l->setFont(f);
+ ag->addWidget(l, ch, 0, Qt::AlignCenter);
+ channelActivity[ch] = new QLabel;
+ ag->addWidget(channelActivity[ch], ch, 1, Qt::AlignCenter);
+ channelActivity[ch]->setPixmap(*activityOff);
+ activity[ch] = 0;
}
+ layout->addLayout(ag, Qt::AlignHCenter);
//---------------------------------------------------
// mute, solo
@@ -930,9 +949,13 @@ void MidiInPortStrip::songChanged(int val)
void MidiInPortStrip::heartBeat()
{
- double a = track->meter(0); // fast_log10(track->meter(0)) * .2f;
- meter->setMeterVal(a * 0.008);
- track->setMeter(0, a * 0.8); // hack
+ for (int i = 0; i < MIDI_CHANNELS; ++i) {
+ bool isActive = inport()->checkActivity(i);
+ if (activity[i] != isActive) {
+ channelActivity[i]->setPixmap(isActive ? *activityOn : *activityOff);
+ activity[i] = isActive;
+ }
+ }
}
//---------------------------------------------------------
diff --git a/muse/muse/mixer/mstrip.h b/muse/muse/mixer/mstrip.h
index e4645173..ed3b5255 100644
--- a/muse/muse/mixer/mstrip.h
+++ b/muse/muse/mixer/mstrip.h
@@ -171,9 +171,13 @@ class MidiSyntiStrip : public Strip {
class MidiInPortStrip : public Strip {
Q_OBJECT
- Awl::MidiMeter* meter;
+ bool activity[MIDI_CHANNELS];
+ QPixmap* activityOn;
+ QPixmap* activityOff;
+ QLabel* channelActivity[MIDI_CHANNELS];
QToolButton* iR;
QToolButton* oR;
+ MidiInPort* inport() const { return (MidiInPort*)track; }
private slots:
void muteToggled(bool);
diff --git a/muse/muse/muse.qrc b/muse/muse/muse.qrc
index 9808fae1..7c790440 100644
--- a/muse/muse/muse.qrc
+++ b/muse/muse/muse.qrc
@@ -19,6 +19,8 @@
<file>xpm/recordOff.svg</file>
<file>xpm/greendot.svg</file>
<file>xpm/darkgreendot.svg</file>
+ <file>xpm/activeon.svg</file>
+ <file>xpm/activeoff.svg</file>
<file>xpm/on.svg</file>
<file>xpm/off.svg</file>
<file>xpm/mono.svg</file>
diff --git a/muse/muse/route.h b/muse/muse/route.h
index 037f9e64..531be751 100644
--- a/muse/muse/route.h
+++ b/muse/muse/route.h
@@ -88,8 +88,8 @@ struct Route {
bool disconnected; // if true, do not remove route in graphChanged()
// or removeConnection()
- Route() { disconnected = false; }
- Route(const RouteNode& s, const RouteNode& d) : src(s), dst(d) {}
+ Route() { disconnected = false;}
+ Route(const RouteNode& s, const RouteNode& d) : src(s), dst(d) { disconnected = false;}
bool operator==(const Route& a) const {
return (src==a.src) && (dst==a.dst);
}
diff --git a/muse/muse/xpm/activeoff.svg b/muse/muse/xpm/activeoff.svg
new file mode 100644
index 00000000..8449f988
--- /dev/null
+++ b/muse/muse/xpm/activeoff.svg
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="10"
+ id="svg1307"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/ws/projects/muse/muse/trunk/muse/muse/xpm"
+ sodipodi:docname="activeoff.svg"
+ version="1.0">
+ <defs
+ id="defs1309">
+ <linearGradient
+ id="linearGradient1319">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop1321" />
+ <stop
+ style="stop-color:#1a561c;stop-opacity:1;"
+ offset="1"
+ id="stop1323" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient1370">
+ <stop
+ style="stop-color:#ff271f;stop-opacity:1;"
+ offset="0"
+ id="stop1372" />
+ <stop
+ style="stop-color:#ff0000;stop-opacity:0;"
+ offset="1"
+ id="stop1374" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1370"
+ id="linearGradient1376"
+ x1="-5.6423869"
+ y1="-5.6206923"
+ x2="8.5200005"
+ y2="8.4349537"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1370"
+ id="linearGradient1315"
+ gradientUnits="userSpaceOnUse"
+ x1="-1.8582375"
+ y1="-0.071628742"
+ x2="3.8178029"
+ y2="2.5516095" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1319"
+ id="radialGradient1325"
+ cx="18.5282"
+ cy="0.093760476"
+ fx="18.5282"
+ fy="0.093760476"
+ r="7.8356543"
+ gradientTransform="matrix(-0.515305,-0.68232,0.563264,-0.418808,19.85983,21.47543)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="39.396621"
+ inkscape:cx="11.149585"
+ inkscape:cy="3.4613455"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1680"
+ inkscape:window-height="996"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ width="20px"
+ height="10px" />
+ <metadata
+ id="metadata1312">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient1325);fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path1317"
+ sodipodi:cx="7.3610373"
+ sodipodi:cy="7.3317437"
+ sodipodi:rx="7.3356543"
+ sodipodi:ry="7.2721972"
+ d="M 14.696692 7.3317437 A 7.3356543 7.2721972 0 1 1 0.025382996,7.3317437 A 7.3356543 7.2721972 0 1 1 14.696692 7.3317437 z"
+ transform="matrix(1.301701,0,0,0.625509,0.41813,0.413925)" />
+ </g>
+</svg>
diff --git a/muse/muse/xpm/activeon.svg b/muse/muse/xpm/activeon.svg
new file mode 100644
index 00000000..c6426e54
--- /dev/null
+++ b/muse/muse/xpm/activeon.svg
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="11"
+ id="svg1307"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/ws/projects/muse/muse/trunk/muse/muse/xpm"
+ sodipodi:docname="activeon.svg"
+ version="1.0">
+ <defs
+ id="defs1309">
+ <linearGradient
+ id="linearGradient1319">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop1321" />
+ <stop
+ style="stop-color:#11ff00;stop-opacity:1;"
+ offset="1"
+ id="stop1323" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient1370">
+ <stop
+ style="stop-color:#ff271f;stop-opacity:1;"
+ offset="0"
+ id="stop1372" />
+ <stop
+ style="stop-color:#ff0000;stop-opacity:0;"
+ offset="1"
+ id="stop1374" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1370"
+ id="linearGradient1376"
+ x1="-5.6423869"
+ y1="-5.6206923"
+ x2="8.5200005"
+ y2="8.4349537"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1370"
+ id="linearGradient1315"
+ gradientUnits="userSpaceOnUse"
+ x1="-1.8582375"
+ y1="-0.071628742"
+ x2="3.8178029"
+ y2="2.5516095" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1319"
+ id="radialGradient1325"
+ cx="18.5282"
+ cy="0.093760476"
+ fx="18.5282"
+ fy="0.093760476"
+ r="7.8356543"
+ gradientTransform="matrix(-0.515305,-0.68232,0.563264,-0.418808,19.85983,21.47543)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="39.396621"
+ inkscape:cx="14.970261"
+ inkscape:cy="4.476661"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1680"
+ inkscape:window-height="996"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ width="20px"
+ height="11px" />
+ <metadata
+ id="metadata1312">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient1325);fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path1317"
+ sodipodi:cx="7.3610373"
+ sodipodi:cy="7.3317437"
+ sodipodi:rx="7.3356543"
+ sodipodi:ry="7.2721972"
+ d="M 14.696692 7.3317437 A 7.3356543 7.2721972 0 1 1 0.025382996,7.3317437 A 7.3356543 7.2721972 0 1 1 14.696692 7.3317437 z"
+ transform="matrix(1.29863,0,0,0.691167,0.440736,0.432544)" />
+ </g>
+</svg>