From 20347c2eb9ab5b09b9b28bf1f4584a5d0ff1335c Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Tue, 6 Jul 2010 21:16:56 +0000 Subject: added jack-transport enable/disable button to Transport --- muse/ChangeLog | 3 +++ muse/muse/driver/jack.cpp | 18 +++++++++--------- muse/muse/sync.cpp | 2 +- muse/muse/sync.h | 2 +- muse/muse/transport.cpp | 21 +++++++++++++++------ muse/muse/transport.h | 2 ++ muse/muse/widgets/midisyncimpl.cpp | 4 ++-- 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/muse/ChangeLog b/muse/ChangeLog index 44125d7b..eafb17d4 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,6 @@ +06.07.2010 + * Added: Button in transport to enable/disable jack transport. (rj) + * Fixed: Dropdown Snap and Type in arranger toolbar no longer steal focus, annoyed the helloutame (rj) 22.06.2010 * Fixed: Crashes loading a song while another is loaded. Or worse, it loads but saving corrupts the file! (T356) - Song::clear(): Clear all midi port devices. Delete Jack midi devices, and remove all ALSA midi device routes. diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp index 3d0d021d..c22a3252 100644 --- a/muse/muse/driver/jack.cpp +++ b/muse/muse/driver/jack.cpp @@ -293,7 +293,7 @@ static int processSync(jack_transport_state_t state, jack_position_t* pos, void* if (JACK_DEBUG) printf("processSync()\n"); - if(!useJackTransport) + if(!useJackTransport.value()) return 1; int audioState = Audio::STOP; @@ -1498,7 +1498,7 @@ unsigned int JackAudioDevice::getCurFrame() if (JACK_DEBUG) printf("JackAudioDevice::getCurFrame pos.frame:%d\n", pos.frame); - if(!useJackTransport) + if(!useJackTransport.value()) return (unsigned int)dummyPos; return pos.frame; @@ -1510,7 +1510,7 @@ unsigned int JackAudioDevice::getCurFrame() int JackAudioDevice::framePos() const { - //if(!useJackTransport) + //if(!useJackTransport.value()) //{ // if (JACK_DEBUG) // printf("JackAudioDevice::framePos dummyPos:%d\n", dummyPos); @@ -1730,7 +1730,7 @@ void JackAudioDevice::unregisterPort(void* p) int JackAudioDevice::getState() { // If we're not using Jack's transport, just return current state. - if(!useJackTransport) + if(!useJackTransport.value()) { //pos.valid = jack_position_bits_t(0); //pos.frame = audio->pos().frame(); @@ -1825,7 +1825,7 @@ void JackAudioDevice::startTransport() // If we're not using Jack's transport, just pass PLAY and current frame along // as if processSync was called. - if(!useJackTransport) + if(!useJackTransport.value()) { //dummyState = Audio::START_PLAY; @@ -1859,7 +1859,7 @@ void JackAudioDevice::stopTransport() dummyState = Audio::STOP; - if(!useJackTransport) + if(!useJackTransport.value()) { //dummyState = Audio::STOP; return; @@ -1883,7 +1883,7 @@ void JackAudioDevice::seekTransport(unsigned frame) printf("JackAudioDevice::seekTransport() frame:%d\n", frame); dummyPos = frame; - if(!useJackTransport) + if(!useJackTransport.value()) { // If we're not using Jack's transport, just pass the current state and new frame along // as if processSync was called. @@ -1925,7 +1925,7 @@ void JackAudioDevice::seekTransport(const Pos &p) printf("JackAudioDevice::seekTransport() frame:%d\n", p.frame()); dummyPos = p.frame(); - if(!useJackTransport) + if(!useJackTransport.value()) { // If we're not using Jack's transport, just pass the current state and new frame along // as if processSync was called. @@ -2000,7 +2000,7 @@ int JackAudioDevice::setMaster(bool f) int r = 0; if(f) { - if(useJackTransport) + if(useJackTransport.value()) { // Make Muse the Jack timebase master. Do it unconditionally (second param = 0). r = jack_set_timebase_callback(_client, 0, (JackTimebaseCallback) timebase_callback, 0); diff --git a/muse/muse/sync.cpp b/muse/muse/sync.cpp index 0fbfa144..330fa49d 100644 --- a/muse/muse/sync.cpp +++ b/muse/muse/sync.cpp @@ -38,7 +38,7 @@ BValue extSyncFlag(0, "extSync"); // false - MASTER, true - SLAVE //bool acceptMTC = false; //bool acceptMC = true; //bool acceptMMC = true; -bool volatile useJackTransport = true; +BValue useJackTransport(1,"useJackTransport"); bool volatile jackTransportMaster = true; static MTC mtcCurTime; diff --git a/muse/muse/sync.h b/muse/muse/sync.h index 21150ea6..d6a08f0d 100644 --- a/muse/muse/sync.h +++ b/muse/muse/sync.h @@ -144,7 +144,7 @@ extern BValue extSyncFlag; //extern bool acceptMC; //extern bool acceptMMC; extern int volatile curMidiSyncInPort; -extern bool volatile useJackTransport; +extern BValue useJackTransport; extern bool volatile jackTransportMaster; extern unsigned int syncSendFirstClockDelay; // In milliseconds. diff --git a/muse/muse/transport.cpp b/muse/muse/transport.cpp index 7444765e..0442dc53 100644 --- a/muse/muse/transport.cpp +++ b/muse/muse/transport.cpp @@ -42,10 +42,10 @@ static const char* fforwardTransportText = QT_TR_NOOP("Click this button to forw //--------------------------------------------------------- static QToolButton* newButton(QWidget* parent, const QString& s, - const QString& tt, bool toggle=false) + const QString& tt, bool toggle=false, int height=25) { QToolButton* button = new QToolButton(parent); - button->setFixedHeight(25); + button->setFixedHeight(height); button->setText(s); button->setToggleButton(toggle); QToolTip::add(button, tt); @@ -339,22 +339,27 @@ Transport::Transport(QWidget*, const char* name) //----------------------------------------------------- QVBox* button1 = new QVBox(this); - button1->setMargin(3); + button1->setMargin(1); - quantizeButton = newButton(button1, tr("AC"), tr("quantize during record"), true); - clickButton = newButton(button1, tr("Click"), tr("metronom click on/off"), true); + quantizeButton = newButton(button1, tr("AC"), tr("quantize during record"), true,19); + clickButton = newButton(button1, tr("Click"), tr("metronom click on/off"), true,19); clickButton->setAccel(shortcuts[SHRT_TOGGLE_METRO].key); - syncButton = newButton(button1, tr("Sync"), tr("external sync on/off"), true); + syncButton = newButton(button1, tr("Sync"), tr("external sync on/off"), true,19); + jackTransportButton = newButton(button1, tr("Jack"), tr("Jack transport sync on/off"), true,19); quantizeButton->setOn(song->quantize()); clickButton->setOn(song->click()); syncButton->setOn(extSyncFlag.value()); + jackTransportButton->setOn(useJackTransport.value()); connect(quantizeButton, SIGNAL(toggled(bool)), song, SLOT(setQuantize(bool))); connect(clickButton, SIGNAL(toggled(bool)), song, SLOT(setClick(bool))); + connect(syncButton, SIGNAL(toggled(bool)), &extSyncFlag, SLOT(setValue(bool))); + connect(jackTransportButton, SIGNAL(toggled(bool)),&useJackTransport, SLOT(setValue(bool))); connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(syncChanged(bool))); + connect(&useJackTransport, SIGNAL(valueChanged(bool)), SLOT(jackSyncChanged(bool))); connect(song, SIGNAL(quantizeChanged(bool)), this, SLOT(setQuantizeFlag(bool))); connect(song, SIGNAL(clickChanged(bool)), this, SLOT(setClickFlag(bool))); @@ -626,6 +631,10 @@ void Transport::syncChanged(bool flag) forwardAction->setEnabled(!flag); } +void Transport::jackSyncChanged(bool flag) + { + jackTransportButton->setOn(flag); + } //--------------------------------------------------------- // stopToggled //--------------------------------------------------------- diff --git a/muse/muse/transport.h b/muse/muse/transport.h index 9708bd4c..32f8f9d4 100644 --- a/muse/muse/transport.h +++ b/muse/muse/transport.h @@ -81,6 +81,7 @@ class Transport : public QWidget QToolButton* quantizeButton; QToolButton* clickButton; QToolButton* syncButton; + QToolButton* jackTransportButton; QToolButton* buttons[6]; // transport buttons QLabel* l2; QLabel* l3; @@ -100,6 +101,7 @@ class Transport : public QWidget void setCycleMode(int); void songChanged(int); void syncChanged(bool); + void jackSyncChanged(bool); void setRecord(bool flag); void stopToggled(bool); void playToggled(bool); diff --git a/muse/muse/widgets/midisyncimpl.cpp b/muse/muse/widgets/midisyncimpl.cpp index 3a3b687b..62df6dda 100644 --- a/muse/muse/widgets/midisyncimpl.cpp +++ b/muse/muse/widgets/midisyncimpl.cpp @@ -406,7 +406,7 @@ void MidiSyncConfig::songChanged(int flags) jackTransportMasterCheckbox->blockSignals(true); syncDelaySpinBox->blockSignals(true); extSyncCheckbox->setChecked(extSyncFlag.value()); - useJackTransportCheckbox->setChecked(useJackTransport); + useJackTransportCheckbox->setChecked(useJackTransport.value()); jackTransportMasterCheckbox->setChecked(jackTransportMaster); //jackTransportMasterCheckbox->setEnabled(useJackTransport); syncDelaySpinBox->setValue(syncSendFirstClockDelay); @@ -782,7 +782,7 @@ void MidiSyncConfig::apply() // if(extSyncFlag.value()) // song->setMasterFlag(false); //extSyncFlag.blockSignals(false); - useJackTransport = useJackTransportCheckbox->isChecked(); + useJackTransport.setValue(useJackTransportCheckbox->isChecked()); // if(useJackTransport) jackTransportMaster = jackTransportMasterCheckbox->isChecked(); // else -- cgit v1.2.3