summaryrefslogtreecommitdiff
path: root/muse2/muse/seqmsg.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2012-10-20 04:10:19 +0000
committerTim E. Real <termtech@rogers.com>2012-10-20 04:10:19 +0000
commitc4aca7b81e76e0f098ac0f855599bdf1e3cf1e22 (patch)
tree177c77d19a5867866cff997c01a187fc54530759 /muse2/muse/seqmsg.cpp
parent5821f678ca1c95a97170588a77303e2f14e4dbdb (diff)
Improved: Midi initializations. New settings options, can be 'quiet'. Complete rewrite of initializations coding.
Improved: Midi controller graphs: Control selector 'S' popup now stay-open, AND NOW with multi-coloured dots. Bonus! Pianoroll and drum edit 'Ctrl' buttons ALSO now popup this very same menu. Improved: 'Old' drum track 'drum controllers' display and operation: Fixed several problems.
Diffstat (limited to 'muse2/muse/seqmsg.cpp')
-rw-r--r--muse2/muse/seqmsg.cpp75
1 files changed, 74 insertions, 1 deletions
diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp
index f60a2d51..fcffc332 100644
--- a/muse2/muse/seqmsg.cpp
+++ b/muse2/muse/seqmsg.cpp
@@ -39,6 +39,8 @@
#include "arranger.h"
#include "plugin.h"
#include "driver/jackmidi.h"
+#include "midi_warn_init_pending_impl.h"
+#include "gconfig.h"
namespace MusECore {
@@ -1114,11 +1116,82 @@ void Audio::msgResetMidiDevices()
// msgInitMidiDevices
//---------------------------------------------------------
-void Audio::msgInitMidiDevices()
+void Audio::msgInitMidiDevices(bool force)
{
+ //
+ // test for explicit instrument initialization
+ //
+
+ if(!force && MusEGlobal::config.warnInitPending)
+ {
+ bool found = false;
+ if(MusEGlobal::song->click())
+ {
+ MidiPort* mp = &MusEGlobal::midiPorts[MusEGlobal::clickPort];
+ if(mp->device() &&
+ (mp->device()->openFlags() & 1) &&
+ mp->instrument() && !mp->instrument()->midiInit()->empty() &&
+ !mp->initSent())
+ found = true;
+ }
+
+ if(!found)
+ {
+ for(int i = 0; i < MIDI_PORTS; ++i)
+ {
+ MidiPort* mp = &MusEGlobal::midiPorts[i];
+ if(mp->device() && (mp->device()->openFlags() & 1) &&
+ mp->instrument() && !mp->instrument()->midiInit()->empty() &&
+ !mp->initSent())
+ {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if(found)
+ {
+ MusEGui::MidiWarnInitPendingDialog dlg;
+ int rv = dlg.exec();
+ bool warn = !dlg.dontAsk();
+ if(warn != MusEGlobal::config.warnInitPending)
+ {
+ MusEGlobal::config.warnInitPending = warn;
+ //MusEGlobal::muse->changeConfig(true); // Save settings? No, wait till close.
+ }
+ if(rv != QDialog::Accepted)
+ {
+ if(MusEGlobal::config.midiSendInit)
+ MusEGlobal::config.midiSendInit = false;
+ //return;
+ }
+ else
+ {
+ if(!MusEGlobal::config.midiSendInit)
+ MusEGlobal::config.midiSendInit = true;
+ }
+ }
+ }
+
+// We can either try to do it in one cycle with one message,
+// or by idling the sequencer (gaining safe access to all structures)
+// for as much time as we need.
+// Here we COULD get away with the audio 'hiccup' that idling causes,
+// because it's unlikely someone would initialize during play...
+// But no midi is processed, so let's switch this only if requiring
+// large numbers of init values causes a problem later...
+#if 1
AudioMsg msg;
msg.id = SEQM_INIT_DEVICES;
+ msg.a = force;
sendMessage(&msg, false);
+#else
+ msgIdle(true);
+ initDevices(force);
+ msgIdle(false);
+#endif
+
}
//---------------------------------------------------------