From 5b205da5d042feb64161e24b61c50271c31d2292 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Mon, 17 Jan 2011 16:20:51 +0000 Subject: fixed panic button and init crash --- muse2/ChangeLog | 3 +++ muse2/muse/arranger/arranger.cpp | 1 + muse2/muse/midi.cpp | 6 ++++-- muse2/muse/midiport.cpp | 27 +++++++++++++++++++-------- muse2/muse/midiport.h | 2 +- muse2/muse/widgets/projectcreateimpl.cpp | 2 +- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 08bb4df0..d915ee97 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,6 @@ +17.01.2011 + - fixed: panic button (rj) + - fixed: initialization crash when loading a new project (rj) 15.01.2011: - fixed: bug were wave track appeared to be rec enabled but no file was created. (rj) - made create project dialog optional, also some minor tweaks to the dialog (rj) diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 834b9613..38583d48 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -933,6 +933,7 @@ void Arranger::clear() delete w; trackInfo->addWidget(0, 2); selected = 0; + midiTrackInfo->setTrack(0); } void Arranger::wheelEvent(QWheelEvent* ev) diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index e339f29b..87e9ff32 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -636,8 +636,10 @@ void Audio::panic() if (port == 0) // ?? continue; for (int chan = 0; chan < MIDI_CHANNELS; ++chan) { - port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_ALL_SOUNDS_OFF, 0)); - port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_RESET_ALL_CTRL, 0)); + if (debugMsg) + printf("send all sound of to midi port %d channel %d\n", i, chan); + port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_ALL_SOUNDS_OFF, 0), true); + port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_RESET_ALL_CTRL, 0), true); } } } diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index 16cfd429..66da871a 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -664,7 +664,7 @@ int MidiPort::limitValToInstrCtlRange(int ctl, int val) // return true, if event cannot be delivered //--------------------------------------------------------- -bool MidiPort::sendEvent(const MidiPlayEvent& ev) +bool MidiPort::sendEvent(const MidiPlayEvent& ev, bool forceSend) { if (ev.type() == ME_CONTROLLER) { @@ -708,8 +708,12 @@ bool MidiPort::sendEvent(const MidiPlayEvent& ev) // return false; // } // printf("set HW Ctrl State ch:%d 0x%x 0x%x\n", ev.channel(), ev.dataA(), ev.dataB()); - if(!setHwCtrlState(ev.channel(), da, db)) - return false; + if(!setHwCtrlState(ev.channel(), da, db)) { + if (debugMsg) + printf("setHwCtrlState failed\n"); + if (!forceSend) + return false; + } } else if (ev.type() == ME_PITCHBEND) @@ -719,19 +723,26 @@ bool MidiPort::sendEvent(const MidiPlayEvent& ev) //if (hwCtrlState(ev.channel(), CTRL_PITCH) == ev.dataA()) // return false; - if(!setHwCtrlState(ev.channel(), CTRL_PITCH, da)) - return false; + if(!setHwCtrlState(ev.channel(), CTRL_PITCH, da)) { + if (!forceSend) + return false; + } } else if (ev.type() == ME_PROGRAM) { - if(!setHwCtrlState(ev.channel(), CTRL_PROGRAM, ev.dataA())) + if(!setHwCtrlState(ev.channel(), CTRL_PROGRAM, ev.dataA())) { + if (!forceSend) return false; + } } - if (!_device) - return true; + if (!_device) { + if (debugMsg) + printf("no device for this midi port\n"); + return true; + } return _device->putEvent(ev); } diff --git a/muse2/muse/midiport.h b/muse2/muse/midiport.h index 7ee83cc9..0fa33a11 100644 --- a/muse2/muse/midiport.h +++ b/muse2/muse/midiport.h @@ -116,7 +116,7 @@ class MidiPort { void sendMMCStop(int devid = -1); void sendMMCDeferredPlay(int devid = -1); - bool sendEvent(const MidiPlayEvent&); + bool sendEvent(const MidiPlayEvent&, bool forceSend = false ); AutomationType automationType(int channel) { return _automationType[channel]; } void setAutomationType(int channel, AutomationType t) { _automationType[channel] = t; diff --git a/muse2/muse/widgets/projectcreateimpl.cpp b/muse2/muse/widgets/projectcreateimpl.cpp index c7aa0fdb..d455c917 100644 --- a/muse2/muse/widgets/projectcreateimpl.cpp +++ b/muse2/muse/widgets/projectcreateimpl.cpp @@ -49,7 +49,7 @@ void ProjectCreateImpl::updateDirectoryPath() } else { if (!projectNameEdit->text().isEmpty()) name = projectNameEdit->text() + ".med"; - storageDirEdit->setText(directoryPath + projectNameEdit->text() + name); + storageDirEdit->setText(directoryPath +"/" + name); } } -- cgit v1.2.3