Index: alsa/alsamidiobject.cpp =================================================================== --- alsa/alsamidiobject.cpp (revision 1134128) +++ alsa/alsamidiobject.cpp (revision 1134129) @@ -176,88 +176,86 @@ void ALSAMIDIObject::handleSequencerEvent(SequencerEvent* ev) { - if (SequencerEvent::isConnectionChange(ev)) - d->m_out->reloadDeviceList(); - else - if (d->m_state == PlayingState) - switch(ev->getSequencerType()) { - case SND_SEQ_EVENT_ECHO: - emit tick(ev->getTick()); - break; - case SND_SEQ_EVENT_USR8: - emit beat(ev->getRaw32(0), ev->getRaw8(4), ev->getRaw8(5)); - break; - case SND_SEQ_EVENT_TIMESIGN: - emit timeSignatureChanged(ev->getRaw8(0), ::pow(2, ev->getRaw8(1))); - break; - case SND_SEQ_EVENT_TEMPO: { - qreal rtempo = 0.0; - const TempoEvent* te = static_cast<const TempoEvent*>(ev); - if (te != NULL) rtempo = 6e7 / te->getValue() * d->m_tempoFactor; - emit tempoChanged(rtempo); + if ( !SequencerEvent::isConnectionChange(ev) && + (d->m_state == PlayingState) ) + switch(ev->getSequencerType()) { + case SND_SEQ_EVENT_ECHO: + emit tick(ev->getTick()); + break; + case SND_SEQ_EVENT_USR8: + emit beat(ev->getRaw32(0), ev->getRaw8(4), ev->getRaw8(5)); + break; + case SND_SEQ_EVENT_TIMESIGN: + emit timeSignatureChanged(ev->getRaw8(0), ::pow(2, ev->getRaw8(1))); + break; + case SND_SEQ_EVENT_TEMPO: { + qreal rtempo = 0.0; + const TempoEvent* te = static_cast<const TempoEvent*>(ev); + if (te != NULL) rtempo = 6e7 / te->getValue() * d->m_tempoFactor; + emit tempoChanged(rtempo); + } + break; + case SND_SEQ_EVENT_USR_VAR0: { + VariableEvent *ve = static_cast<VariableEvent*>(ev); + if (ve != NULL && ve->getData() != NULL && ve->getLength() > 0) { + QByteArray ba(ve->getData(), ve->getLength()); + QString s; + if (d->m_codec == NULL) + s = QString::fromAscii(ba); + else + s = d->m_codec->toUnicode(ba); + s.remove(QRegExp("[/\\\\]+")); + s.remove(QRegExp("[\r\n]+")); + emit midiText(Song::Lyric, s); } - break; - case SND_SEQ_EVENT_USR_VAR0: { - VariableEvent *ve = static_cast<VariableEvent*>(ev); - if (ve != NULL && ve->getData() != NULL && ve->getLength() > 0) { - QByteArray ba(ve->getData(), ve->getLength()); - QString s; - if (d->m_codec == NULL) - s = QString::fromAscii(ba); - else - s = d->m_codec->toUnicode(ba); - s.remove(QRegExp("[/\\\\]+")); - s.remove(QRegExp("[\r\n]+")); - emit midiText(Song::Lyric, s); - } - } - break; - case SND_SEQ_EVENT_NOTEOFF: { - d->m_out->sendEvent(ev); - const NoteOffEvent* n = static_cast<const NoteOffEvent*>(ev); - emit midiNoteOff(n->getChannel(), n->getKey(), n->getVelocity()); - } - break; - case SND_SEQ_EVENT_NOTEON: { - d->m_out->sendEvent(ev); - const NoteOnEvent* n = static_cast<const NoteOnEvent*>(ev); - emit midiNoteOn(n->getChannel(), n->getKey(), n->getVelocity()); - } - break; - case SND_SEQ_EVENT_KEYPRESS: { - d->m_out->sendEvent(ev); - const KeyPressEvent* n = static_cast<const KeyPressEvent*>(ev); - emit midiKeyPressure(n->getChannel(), n->getKey(), n->getVelocity()); - } - break; - case SND_SEQ_EVENT_CONTROLLER: - case SND_SEQ_EVENT_CONTROL14: { - d->m_out->sendEvent(ev); - const ControllerEvent* n = static_cast<const ControllerEvent*>(ev); - emit midiController(n->getChannel(), n->getParam(), n->getValue()); - } - break; - case SND_SEQ_EVENT_PGMCHANGE: { - d->m_out->sendEvent(ev); - const ProgramChangeEvent* p = static_cast<const ProgramChangeEvent*>(ev); - emit midiProgram(p->getChannel(), p->getValue()); - } - break; - case SND_SEQ_EVENT_CHANPRESS: { - d->m_out->sendEvent(ev); - const ChanPressEvent* n = static_cast<const ChanPressEvent*>(ev); - emit midiChannelPressure(n->getChannel(), n->getValue()); - } - break; - case SND_SEQ_EVENT_PITCHBEND: { - d->m_out->sendEvent(ev); - const PitchBendEvent* n = static_cast<const PitchBendEvent*>(ev); - emit midiPitchBend(n->getChannel(), n->getValue()); - } - break; - default: + } + break; + case SND_SEQ_EVENT_NOTEOFF: { d->m_out->sendEvent(ev); + const NoteOffEvent* n = static_cast<const NoteOffEvent*>(ev); + emit midiNoteOff(n->getChannel(), n->getKey(), n->getVelocity()); } + break; + case SND_SEQ_EVENT_NOTEON: { + d->m_out->sendEvent(ev); + const NoteOnEvent* n = static_cast<const NoteOnEvent*>(ev); + emit midiNoteOn(n->getChannel(), n->getKey(), n->getVelocity()); + } + break; + case SND_SEQ_EVENT_KEYPRESS: { + d->m_out->sendEvent(ev); + const KeyPressEvent* n = static_cast<const KeyPressEvent*>(ev); + emit midiKeyPressure(n->getChannel(), n->getKey(), n->getVelocity()); + } + break; + case SND_SEQ_EVENT_CONTROLLER: + case SND_SEQ_EVENT_CONTROL14: { + d->m_out->sendEvent(ev); + const ControllerEvent* n = static_cast<const ControllerEvent*>(ev); + emit midiController(n->getChannel(), n->getParam(), n->getValue()); + } + break; + case SND_SEQ_EVENT_PGMCHANGE: { + d->m_out->sendEvent(ev); + const ProgramChangeEvent* p = static_cast<const ProgramChangeEvent*>(ev); + emit midiProgram(p->getChannel(), p->getValue()); + } + break; + case SND_SEQ_EVENT_CHANPRESS: { + d->m_out->sendEvent(ev); + const ChanPressEvent* n = static_cast<const ChanPressEvent*>(ev); + emit midiChannelPressure(n->getChannel(), n->getValue()); + } + break; + case SND_SEQ_EVENT_PITCHBEND: { + d->m_out->sendEvent(ev); + const PitchBendEvent* n = static_cast<const PitchBendEvent*>(ev); + emit midiPitchBend(n->getChannel(), n->getValue()); + } + break; + default: + d->m_out->sendEvent(ev); + } delete ev; }