summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2007-05-23 12:02:39 +0000
committerWerner Schweer <ws.seh.de>2007-05-23 12:02:39 +0000
commitd47e67d43f4675d022d728029c9a8da0a9bacd92 (patch)
tree77c13779963402d5d8508419a2d7d4fb60fad4b2
parent58460c8f7531bed9271135701370a006cad3e69a (diff)
more midi import fixes
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/doc/man/de/installation.tex21
-rw-r--r--muse/muse/importmidi.cpp63
-rw-r--r--muse/muse/midi.cpp21
-rw-r--r--muse/muse/midi.h3
-rw-r--r--muse/muse/midievent.h3
-rw-r--r--muse/synti/mus/mus.cpp3
7 files changed, 47 insertions, 69 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 389cff53..f6882672 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,5 @@
+23.5. (ws)
+ - midi import fixes
19.04 (ws)
- disable routing buttons in mixer strip when in off state
- fixed crash when removing track from mixer
diff --git a/muse/doc/man/de/installation.tex b/muse/doc/man/de/installation.tex
index e65751e3..4b45531c 100644
--- a/muse/doc/man/de/installation.tex
+++ b/muse/doc/man/de/installation.tex
@@ -15,10 +15,12 @@
echo snd-seq >> /etc/modules
\stoptyping
+ (Nachtrag: im aktuellen Ubuntu 04.07 ("festy") wird das Sequencer
+ Modul standardmäßig geladen)
\subsection{Realtime Clock}
- Normalen Programmen ist der Zugriff auf die Echtzeituhr
+ Normalen Programmen ist der Zugriff auf die Echtzeituhr
(RTC = "realtime clock") von Linux
verwehrt. \M\ benötigt jedoch eine genaue Uhr, um ein exaktes
Miditiming erzeugen zu können.
@@ -35,7 +37,6 @@
Auflösungen einstellen.
Um dies zu Erlauben geben wir ein:
-
\starttyping
sudo bash
echo 1024 > /proc/sys/dev/rtc/max-user-freq
@@ -44,3 +45,19 @@
Durch den Eintrag in der Datei {\tt /etc/sysctl.conf} erfolgt diese
Einstellung nun auch nach jedem Systemstart.
+
+ \subsection{Realtime Rechte}
+
+ Um Prozesse mit Echtzeit Privilegien starten zu können ergänzen
+ wir die Datei {\tt /etc/security/limits.conf} um folgende Zeilen:
+
+ \starttyping
+ @audio - rtprio 99
+ @audio - memlock 200000
+ @audio - nice -10
+ \stoptyping
+
+ \subsection{Low Latency Kernel}
+ \subsubsection{Interrupt Thread Prioritäten}
+
+
diff --git a/muse/muse/importmidi.cpp b/muse/muse/importmidi.cpp
index 9a9dee8c..d7b1ba7d 100644
--- a/muse/muse/importmidi.cpp
+++ b/muse/muse/importmidi.cpp
@@ -165,7 +165,7 @@ void MusE::importMidi(const QString &file)
mixer1->clear();
if (mixer2)
mixer2->clear();
-//===========================================================
+ //===========================================================
//
// close all toplevel windows
//
@@ -276,8 +276,6 @@ void MusE::importMidi(const QString &file)
track->blockSignals(false);
}
setWindowTitle(QString("MusE: Song: ") + path);
-//===========================================================
-
seqStart();
audio->msgSeek(song->cPos());
}
@@ -290,7 +288,6 @@ void MusE::importMidi(const QString &file)
//---------------------------------------------------------
// addMidiFile
-// return true on error
//---------------------------------------------------------
void MusE::addMidiFile(const QString name)
@@ -315,7 +312,6 @@ void MusE::addMidiFile(const QString name)
int division = mf.division();
MidiOutPort* outPort = 0;
-// MidiInPort* inPort = 0;
if (song->midiOutPorts()->empty()) {
outPort = new MidiOutPort();
@@ -342,25 +338,6 @@ void MusE::addMidiFile(const QString name)
}
}
- if (config.createDefaultMidiInput) {
-#if 0
- inPort = new MidiInPort();
- inPort->setDefaultName();
- song->insertTrack0(inPort, -1);
- if (config.connectToAllMidiDevices) {
- QList<PortName> ol = midiDriver->inputPorts();
- for (std::list<PortName>::iterator ip = ol->begin(); ip != ol->end(); ++ip) {
- Route src(ip->name, 0, Route::MIDIPORT);
- inPort->inRoutes()->push_back(src);
- }
- }
- else if (!config.defaultMidiInputDevice.isEmpty()) {
- Route src(config.defaultMidiInputDevice, 0, Route::MIDIPORT);
- inPort->inRoutes()->push_back(src);
- }
-#endif
- }
-
//
// if midi file is GM/GS/XG this overrides the preferred
// instrument setting
@@ -403,9 +380,10 @@ void MusE::addMidiFile(const QString name)
// - combine note on/off events
// - calculate tick value for internal resolution
//
- for (iMidiFileTrack t = etl->begin(); t != etl->end(); ++t) {
- MidiEventList* el = &((*t)->events);
- if (el->empty())
+
+ foreach(const MidiFileTrack* t, *etl) {
+ const MidiEventList& el = t->events;
+ if (el.empty())
continue;
//
// if we split the track, SYSEX and META events go into
@@ -417,18 +395,16 @@ void MusE::addMidiFile(const QString name)
// check if there are any events for channel in track:
//
iMidiEvent i;
- for (i = el->begin(); i != el->end(); ++i) {
+ for (i = el.begin(); i != el.end(); ++i) {
MidiEvent ev = *i;
- if (ev.type() != ME_SYSEX
- && ev.type() != ME_META
- && ev.channel() == channel)
+ if (ev.type() != ME_SYSEX && ev.type() != ME_META && ev.channel() == channel)
break;
}
- if (i == el->end())
+ if (i == el.end())
continue;
MidiTrack* track = new MidiTrack();
- if ((*t)->isDrumTrack)
+ if (t->isDrumTrack)
track->setUseDrumMap(true);
//TODOB track->outRoutes()->push_back(Route(outPort->channel(channel), -1, Route::TRACK));
// if (inPort && config.connectToAllMidiTracks) {
@@ -439,7 +415,7 @@ void MusE::addMidiFile(const QString name)
// }
EventList* mel = track->events();
- buildMidiEventList(mel, el, track, division, first);
+ buildMidiEventList(mel, &el, track, channel, division, first);
first = false;
for (iEvent i = mel->begin(); i != mel->end(); ++i) {
@@ -453,22 +429,6 @@ void MusE::addMidiFile(const QString name)
track->addControllerVal(ctrl, event.tick(), val);
}
}
- if (channel == 9) {
- track->setUseDrumMap(true);
- //
- // remap drum pitch with drumInmap
- //
-#if 0 //TODO
- EventList* tevents = track->events();
- for (iEvent i = tevents->begin(); i != tevents->end(); ++i) {
- Event ev = i->second;
- if (ev.isNote()) {
- int pitch = drumInmap[ev.pitch()];
- ev.setPitch(pitch);
- }
- }
-#endif
- }
processTrack(track);
if (track->name().isEmpty())
track->setDefaultName();
@@ -480,9 +440,8 @@ void MusE::addMidiFile(const QString name)
// (SYSEX or META)
//
MidiTrack* track = new MidiTrack();
-// addRoute(Route(track, -1, Route::TRACK), Route(track));
EventList* mel = track->events();
- buildMidiEventList(mel, el, track, division, true);
+ buildMidiEventList(mel, &el, track, 0, division, true);
processTrack(track);
if (track->name().isEmpty())
track->setDefaultName();
diff --git a/muse/muse/midi.cpp b/muse/muse/midi.cpp
index 141550fc..b93bf1c9 100644
--- a/muse/muse/midi.cpp
+++ b/muse/muse/midi.cpp
@@ -44,30 +44,30 @@
extern void dump(const unsigned char* p, int n);
-unsigned const char gmOnMsg[] = {
+unsigned const char gmOnMsg[] = {
0x7e, // Non-Real Time header
0x7f, // ID of target device (7f = all devices)
- 0x09,
- 0x01
+ 0x09,
+ 0x01
};
-unsigned const char gsOnMsg[] = {
+unsigned const char gsOnMsg[] = {
0x41, // roland id
0x10, // Id of target device (default = 10h for roland)
0x42, // model id (42h = gs devices)
0x12, // command id (12h = data set)
0x40, // address & value
0x00,
- 0x7f,
- 0x00,
+ 0x7f,
+ 0x00,
0x41 // checksum?
};
-unsigned const char xgOnMsg[] = {
+unsigned const char xgOnMsg[] = {
0x43, // yamaha id
0x10, // device number (0)
0x4c, // model id
0x00, // address (high, mid, low)
- 0x00,
- 0x7e,
+ 0x00,
+ 0x7e,
0x00 // data
};
unsigned const int gmOnMsgLen = sizeof(gmOnMsg);
@@ -196,7 +196,7 @@ QString nameSysex(unsigned int len, const unsigned char* buf)
// generally: how to handle incomplete messages?
//---------------------------------------------------------
-void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* track,
+void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* track, int channel,
int div, bool addSysexMeta)
{
QString tname;
@@ -208,7 +208,6 @@ void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* trac
int datal = 0;
int dataType = 0; // 0 : disabled, 0x20000 : rpn, 0x30000 : nrpn
- int channel = 0;
EventList mel;
int metaChannel = -1;
for (iMidiEvent i = el->begin(); i != el->end(); ++i) {
diff --git a/muse/muse/midi.h b/muse/muse/midi.h
index 13d5ddcb..09d6a1e9 100644
--- a/muse/muse/midi.h
+++ b/muse/muse/midi.h
@@ -55,7 +55,8 @@ class EventList;
class MidiTrack;
class MidiEventList;
-extern void buildMidiEventList(EventList* mel, const MidiEventList* el, MidiTrack* track, int division, bool);
+extern void buildMidiEventList(EventList* mel, const MidiEventList* el, MidiTrack* track,
+ int channel, int division, bool);
#endif
diff --git a/muse/muse/midievent.h b/muse/muse/midievent.h
index d3dd4800..780c7ce6 100644
--- a/muse/muse/midievent.h
+++ b/muse/muse/midievent.h
@@ -23,7 +23,6 @@
#include <set>
#include "evdata.h"
-// #include <ext/mt_allocator.h>
#include "midi.h"
@@ -89,7 +88,7 @@ class MidiEvent {
// typedef std::multiset<MidiEvent, std::less<MidiEvent>,
// __gnu_cxx::__mt_alloc<MidiEvent> > MPEL;
-class MidiEventList : public std::multiset<MidiEvent, std::less<MidiEvent> >
+class MidiEventList : public std::multiset<MidiEvent, std::less<MidiEvent> >
{
public:
};
diff --git a/muse/synti/mus/mus.cpp b/muse/synti/mus/mus.cpp
index 794c3c51..3100ae5c 100644
--- a/muse/synti/mus/mus.cpp
+++ b/muse/synti/mus/mus.cpp
@@ -50,7 +50,8 @@ static int processAudio(jack_nframes_t nFrames, void*)
int nch = mess->channels();
for (int i = 0; i < nch; ++i) {
outBuffer[i] = (float*)jack_port_get_buffer(outPorts[i], nFrames);
- memset(outBuffer[i], 0, sizeof(float) * nFrames);
+ jack_midi_clear_buffer(outBuffer[i], nFrames);
+ // memset(outBuffer[i], 0, sizeof(float) * nFrames);
}
while(mess->eventsPending())
mess->processEvent(mess->receiveEvent());