--- qsampler/trunk/src/qsamplerMainForm.ui.h 2005/03/22 12:55:29 484 +++ qsampler/trunk/src/qsamplerMainForm.ui.h 2005/06/17 22:43:56 661 @@ -51,6 +51,10 @@ #include #endif +#ifdef CONFIG_LIBGIG +#include +#endif + // Timer constant stuff. #define QSAMPLER_TIMER_MSECS 200 @@ -218,6 +222,7 @@ // Some child forms are to be created right now. m_pMessages = new qsamplerMessages(this); m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags); + m_pDeviceForm->setMainForm(this); // An important life immutable! // Set message defaults... updateMessagesFont(); updateMessagesLimit(); @@ -287,11 +292,11 @@ ostr << *this; m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); // And the children, and the main windows state,. - m_pOptions->saveWidgetGeometry(m_pDeviceForm); - m_pOptions->saveWidgetGeometry(this); - // Close popup widgets. - if (m_pDeviceForm) - m_pDeviceForm->close(); + m_pOptions->saveWidgetGeometry(m_pDeviceForm); + m_pOptions->saveWidgetGeometry(this); + // Close popup widgets. + if (m_pDeviceForm) + m_pDeviceForm->close(); // Stop client and/or server, gracefully. stopServer(); } @@ -344,29 +349,29 @@ if (!decodeDragFiles(pDropEvent, files)) return; - for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) { + for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) { const QString& sPath = *iter; if (qsamplerChannel::isInstrumentFile(sPath)) { // Try to create a new channel from instrument file... - qsamplerChannel *pChannel = new qsamplerChannel(this); - if (pChannel == NULL) - return; + qsamplerChannel *pChannel = new qsamplerChannel(this); + if (pChannel == NULL) + return; // Start setting the instrument filename... pChannel->setInstrument(sPath, 0); - // Before we show it up, may be we'll - // better ask for some initial values? - if (!pChannel->channelSetup(this)) { - delete pChannel; - return; - } - // Finally, give it to a new channel strip... + // Before we show it up, may be we'll + // better ask for some initial values? + if (!pChannel->channelSetup(this)) { + delete pChannel; + return; + } + // Finally, give it to a new channel strip... if (!createChannelStrip(pChannel)) { - delete pChannel; - return; + delete pChannel; + return; } - // Make that an overall update. - m_iDirtyCount++; - stabilizeForm(); + // Make that an overall update. + m_iDirtyCount++; + stabilizeForm(); } // Otherwise, load an usual session file (LSCP script)... else if (closeSession(true)) loadSessionFile(sPath); @@ -393,7 +398,7 @@ void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent ) { stabilizeForm(); - + editMenu->exec(pEvent->globalPos()); } @@ -623,7 +628,7 @@ m_sFilename = sFilename; updateRecentFiles(sFilename); appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); - + // Make that an overall update. stabilizeForm(); return true; @@ -669,7 +674,7 @@ qsamplerDevice device(this, qsamplerDevice::Audio, piDeviceIDs[iDevice]); // Audio device specification... ts << "# " << device.deviceTypeName() << " " << device.driverName() - << " " << tr("Device") << " " << iDevice << endl; + << " " << tr("Device") << " " << iDevice << endl; ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); qsamplerDeviceParamMap::ConstIterator deviceParam; for (deviceParam = device.params().begin(); @@ -692,8 +697,8 @@ const qsamplerDeviceParam& param = portParam.data(); if (param.fix || param.value.isEmpty()) ts << "# "; ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice - << " " << iPort << " " << portParam.key() - << "='" << param.value << "'" << endl; + << " " << iPort << " " << portParam.key() + << "='" << param.value << "'" << endl; } } // Audio device index/id mapping. @@ -708,8 +713,8 @@ ts << endl; qsamplerDevice device(this, qsamplerDevice::Midi, piDeviceIDs[iDevice]); // MIDI device specification... - ts << "# " << device.deviceTypeName() << " " << device.driverName() - << " " << tr("Device") << " " << iDevice << endl; + ts << "# " << device.deviceTypeName() << " " << device.driverName() + << " " << tr("Device") << " " << iDevice << endl; ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); qsamplerDeviceParamMap::ConstIterator deviceParam; for (deviceParam = device.params().begin(); @@ -751,22 +756,22 @@ if (pChannel) { ts << "# " << tr("Channel") << " " << iChannel << endl; ts << "ADD CHANNEL" << endl; - if (audioDeviceMap.isEmpty()) { - ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel - << " " << pChannel->audioDriver() << endl; - } else { - ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel - << " " << audioDeviceMap[pChannel->audioDevice()] << endl; + if (audioDeviceMap.isEmpty()) { + ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel + << " " << pChannel->audioDriver() << endl; + } else { + ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel + << " " << audioDeviceMap[pChannel->audioDevice()] << endl; } - if (midiDeviceMap.isEmpty()) { - ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel - << " " << pChannel->midiDriver() << endl; - } else { - ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel - << " " << midiDeviceMap[pChannel->midiDevice()] << endl; - } - ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel - << " " << pChannel->midiPort() << endl; + if (midiDeviceMap.isEmpty()) { + ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel + << " " << pChannel->midiDriver() << endl; + } else { + ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel + << " " << midiDeviceMap[pChannel->midiDevice()] << endl; + } + ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel + << " " << pChannel->midiPort() << endl; ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) ts << "ALL"; @@ -871,7 +876,7 @@ tr("Resetting the sampler instance will close\n" "all device and channel configurations.\n\n" "Please note that this operation may cause\n" - "temporary MIDI and Audio disruption\n\n" + "temporary MIDI and Audio disruption.\n\n" "Do you want to reset the sampler engine now?"), tr("Reset"), tr("Cancel")) > 0) return; @@ -896,9 +901,9 @@ { if (m_pOptions == NULL) return; - + bool bRestart = true; - + // Ask user whether he/she want's a complete restart... // (if we're currently up and running) if (bRestart && m_pClient) { @@ -906,7 +911,7 @@ tr("New settings will be effective after\n" "restarting the client/server connection.\n\n" "Please note that this operation may cause\n" - "temporary MIDI and Audio disruption\n\n" + "temporary MIDI and Audio disruption.\n\n" "Do you want to restart the connection now?"), tr("Restart"), tr("Cancel")) == 0); } @@ -949,7 +954,7 @@ delete pChannel; return; } - + // And give it to the strip (will own the channel instance, if successful). if (!createChannelStrip(pChannel)) { delete pChannel; @@ -971,7 +976,7 @@ qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); if (pChannelStrip == NULL) return; - + qsamplerChannel *pChannel = pChannelStrip->channel(); if (pChannel == NULL) return; @@ -993,7 +998,7 @@ // Just delete the channel strip. delete pChannelStrip; - + // Do we auto-arrange? if (m_pOptions && m_pOptions->bAutoArrange) channelsArrange(); @@ -1037,19 +1042,19 @@ // Reset all sampler channels. void qsamplerMainForm::editResetAllChannels (void) { - if (m_pClient == NULL) - return; + if (m_pClient == NULL) + return; - // Invoque the channel strip procedure, + // Invoque the channel strip procedure, // for all channels out there... - m_pWorkspace->setUpdatesEnabled(false); - QWidgetList wlist = m_pWorkspace->windowList(); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); - if (pChannelStrip) - pChannelStrip->channelReset(); - } - m_pWorkspace->setUpdatesEnabled(true); + m_pWorkspace->setUpdatesEnabled(false); + QWidgetList wlist = m_pWorkspace->windowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { + qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); + if (pChannelStrip) + pChannelStrip->channelReset(); + } + m_pWorkspace->setUpdatesEnabled(true); } @@ -1104,20 +1109,20 @@ // Show/hide the device configurator form. void qsamplerMainForm::viewDevices (void) { - if (m_pOptions == NULL) - return; + if (m_pOptions == NULL) + return; - if (m_pDeviceForm) { - m_pOptions->saveWidgetGeometry(m_pDeviceForm); + if (m_pDeviceForm) { + m_pOptions->saveWidgetGeometry(m_pDeviceForm); m_pDeviceForm->setClient(m_pClient); - if (m_pDeviceForm->isVisible()) { - m_pDeviceForm->hide(); - } else { - m_pDeviceForm->show(); - m_pDeviceForm->raise(); - m_pDeviceForm->setActiveWindow(); - } - } + if (m_pDeviceForm->isVisible()) { + m_pDeviceForm->hide(); + } else { + m_pDeviceForm->show(); + m_pDeviceForm->raise(); + m_pDeviceForm->setActiveWindow(); + } + } } @@ -1235,7 +1240,7 @@ y += iHeight; } m_pWorkspace->setUpdatesEnabled(true); - + stabilizeForm(); } @@ -1294,6 +1299,12 @@ sText += ::lscp_client_package(); sText += " "; sText += ::lscp_client_version(); +#ifdef CONFIG_LIBGIG + sText += ", "; + sText += gig::libraryName(); + sText += " "; + sText += gig::libraryVersion(); +#endif sText += "
\n"; sText += "
\n"; sText += tr("Website") + ": " QSAMPLER_WEBSITE "
\n"; @@ -1373,8 +1384,10 @@ void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip ) { // Add this strip to the changed list... - if (m_changedStrips.containsRef(pChannelStrip) == 0) + if (m_changedStrips.containsRef(pChannelStrip) == 0) { m_changedStrips.append(pChannelStrip); + pChannelStrip->resetErrorCount(); + } // Just mark the dirty form. m_iDirtyCount++; @@ -1620,7 +1633,7 @@ if (m_pOptions->bMessagesLimit) m_pMessages->setMessagesLimit(m_pOptions->iMessagesLimitLines); else - m_pMessages->setMessagesLimit(0); + m_pMessages->setMessagesLimit(-1); } } @@ -1664,7 +1677,7 @@ pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); if (pChannelStrip == NULL) return NULL; - + // Actual channel strip setup... pChannelStrip->setup(pChannel); QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); @@ -1722,7 +1735,7 @@ QWidgetList wlist = m_pWorkspace->windowList(); if (wlist.isEmpty()) return NULL; - + for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); if (pChannelStrip) { @@ -1803,29 +1816,29 @@ } } } - + // Refresh each channel usage, on each period... - if (m_pClient && (m_changedStrips.count() > 0 || m_pOptions->bAutoRefresh)) { - m_iTimerSlot += QSAMPLER_TIMER_MSECS; - if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled()) { - m_iTimerSlot = 0; - // Update the channel information for each pending strip... - for (qsamplerChannelStrip *pChannelStrip = m_changedStrips.first(); - pChannelStrip; + if (m_pClient && (m_changedStrips.count() > 0 || m_pOptions->bAutoRefresh)) { + m_iTimerSlot += QSAMPLER_TIMER_MSECS; + if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled()) { + m_iTimerSlot = 0; + // Update the channel information for each pending strip... + for (qsamplerChannelStrip *pChannelStrip = m_changedStrips.first(); + pChannelStrip; pChannelStrip = m_changedStrips.next()) { // If successfull, remove from pending list... if (pChannelStrip->updateChannelInfo()) - m_changedStrips.remove(pChannelStrip); + m_changedStrips.remove(pChannelStrip); } - // Update the channel stream usage for each strip... - QWidgetList wlist = m_pWorkspace->windowList(); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); - if (pChannelStrip && pChannelStrip->isVisible()) - pChannelStrip->updateChannelUsage(); - } - } - } + // Update the channel stream usage for each strip... + QWidgetList wlist = m_pWorkspace->windowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { + qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); + if (pChannelStrip && pChannelStrip->isVisible()) + pChannelStrip->updateChannelUsage(); + } + } + } // Register the next timer slot. QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(timerSlot())); @@ -2059,7 +2072,7 @@ // channels from the back-end server. m_iDirtyCount = 0; closeSession(false); - + // Close us as a client... lscp_client_destroy(m_pClient); m_pClient = NULL;