summaryrefslogtreecommitdiff
path: root/muse2/muse/helper.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-12-22 00:13:14 +0000
committerFlorian Jung <flo@windfisch.org>2011-12-22 00:13:14 +0000
commitb1b88156cb2adf84e752449f2bc803754b520f8c (patch)
tree3d70291cf9671beb4253b23f026212e3350ab004 /muse2/muse/helper.cpp
parent1057d7190242cdf9248671b316a398db805f5f56 (diff)
parent1fe51e45eebbfc2ac198ed4778c9afdb9eaf2ed0 (diff)
merged with trunk again (you're committing faster than i can merge ;) )
Diffstat (limited to 'muse2/muse/helper.cpp')
-rw-r--r--muse2/muse/helper.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp
index 144d876d..a0d85133 100644
--- a/muse2/muse/helper.cpp
+++ b/muse2/muse/helper.cpp
@@ -453,9 +453,10 @@ QString getUniqueUntitledName()
// -------------------------------------------------------------------------------------------------------
// populateMidiPorts()
-// This version creats separate devices for input and output ports.
+// This version creats separate devices for Jack midi input and outputs.
// It does not attempt to pair them together.
// -------------------------------------------------------------------------------------------------------
+
void populateMidiPorts()
{
if(!MusEGlobal::checkAudioDevice())
@@ -464,6 +465,8 @@ void populateMidiPorts()
MusECore::MidiDevice* dev = 0;
int port_num = 0;
+
+ int jack_midis_found = 0;
// If Jack is running, prefer Jack midi devices over ALSA.
if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::JACK_AUDIO)
@@ -475,6 +478,7 @@ void populateMidiPorts()
dev = MusECore::MidiJackDevice::createJackMidiDevice(*i, 1);
if(dev)
{
+ ++jack_midis_found;
//printf("populateMidiPorts Created jack writeable device: %s\n", dev->name().toLatin1().constData());
//dev->setOpenFlags(1);
MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[port_num], dev);
@@ -492,6 +496,7 @@ void populateMidiPorts()
dev = MusECore::MidiJackDevice::createJackMidiDevice(*i, 2);
if(dev)
{
+ ++jack_midis_found;
//printf("populateMidiPorts Created jack readable device: %s\n", dev->name().toLatin1().constData());
//dev->setOpenFlags(2);
MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[port_num], dev);
@@ -503,9 +508,13 @@ void populateMidiPorts()
}
}
}
- else
+ //else
// If Jack is not running, use ALSA devices.
- if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::DUMMY_AUDIO)
+ //if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::DUMMY_AUDIO)
+ // Try to do the user a favour: If we still have no Jack devices, even if Jack is running, fill with ALSA.
+ // It is possible user has Jack running on ALSA back-end but without midi support.
+ // IE. They use Jack for audio but use ALSA for midi!
+ if(MusEGlobal::audioDevice->deviceType() == MusECore::AudioDevice::DUMMY_AUDIO || jack_midis_found == 0)
{
for(MusECore::iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i)
{