/[svn]/qsampler/trunk/src/qsamplerMainForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 462 by capela, Tue Mar 15 11:39:12 2005 UTC revision 969 by capela, Wed Dec 6 19:38:02 2006 UTC
# Line 2  Line 2 
2  //  //
3  // ui.h extension file, included from the uic-generated form implementation.  // ui.h extension file, included from the uic-generated form implementation.
4  /****************************************************************************  /****************************************************************************
5     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 14  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
# Line 41  Line 41 
41  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
42    
43  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
44    #include "qsamplerInstrumentList.h"
45    
46    #include "qsamplerInstrumentListForm.h"
47  #include "qsamplerDeviceForm.h"  #include "qsamplerDeviceForm.h"
48  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
49    
 #include "config.h"  
   
50  #ifdef HAVE_SIGNAL_H  #ifdef HAVE_SIGNAL_H
51  #include <signal.h>  #include <signal.h>
52  #endif  #endif
53    
54    #ifdef CONFIG_LIBGIG
55    #include <gig.h>
56    #endif
57    
58  // Timer constant stuff.  // Timer constant stuff.
59  #define QSAMPLER_TIMER_MSECS    200  #define QSAMPLER_TIMER_MSECS    200
60    
# Line 100  private: Line 104  private:
104  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
105  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
106    
107    // Kind of singleton reference.
108    qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL;
109    
110    
111  // Kind of constructor.  // Kind of constructor.
112  void qsamplerMainForm::init (void)  void qsamplerMainForm::init (void)
113  {  {
114            // Pseudo-singleton reference setup.
115            g_pMainForm = this;
116    
117      // Initialize some pointer references.      // Initialize some pointer references.
118      m_pOptions = NULL;      m_pOptions = NULL;
119    
120      // All child forms are to be created later, not earlier than setup.      // All child forms are to be created later, not earlier than setup.
121      m_pMessages   = NULL;      m_pMessages = NULL;
122        m_pInstrumentListForm = NULL;
123      m_pDeviceForm = NULL;      m_pDeviceForm = NULL;
124    
125      // We'll start clean.      // We'll start clean.
# Line 184  void qsamplerMainForm::destroy (void) Line 196  void qsamplerMainForm::destroy (void)
196      // Finally drop any widgets around...      // Finally drop any widgets around...
197      if (m_pDeviceForm)      if (m_pDeviceForm)
198          delete m_pDeviceForm;          delete m_pDeviceForm;
199        if (m_pInstrumentListForm)
200            delete m_pInstrumentListForm;
201      if (m_pMessages)      if (m_pMessages)
202          delete m_pMessages;          delete m_pMessages;
203      if (m_pWorkspace)      if (m_pWorkspace)
# Line 202  void qsamplerMainForm::destroy (void) Line 216  void qsamplerMainForm::destroy (void)
216      // Delete recentfiles menu.      // Delete recentfiles menu.
217      if (m_pRecentFilesMenu)      if (m_pRecentFilesMenu)
218          delete m_pRecentFilesMenu;          delete m_pRecentFilesMenu;
219    
220            // Pseudo-singleton reference shut-down.
221            g_pMainForm = NULL;
222  }  }
223    
224    
# Line 212  void qsamplerMainForm::setup ( qsamplerO Line 229  void qsamplerMainForm::setup ( qsamplerO
229      m_pOptions = pOptions;      m_pOptions = pOptions;
230    
231      // What style do we create these forms?      // What style do we create these forms?
232      WFlags wflags = Qt::WType_TopLevel;          Qt::WFlags wflags = Qt::WStyle_Customize
233                    | Qt::WStyle_NormalBorder
234                    | Qt::WStyle_Title
235                    | Qt::WStyle_SysMenu
236                    | Qt::WStyle_MinMax
237                    | Qt::WType_TopLevel;
238      if (m_pOptions->bKeepOnTop)      if (m_pOptions->bKeepOnTop)
239          wflags |= Qt::WStyle_Tool;          wflags |= Qt::WStyle_Tool;
240      // Some child forms are to be created right now.      // Some child forms are to be created right now.
241      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
242      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
243    #ifdef CONFIG_MIDI_INSTRUMENT
244        m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags);
245            QObject::connect(m_pInstrumentListForm->InstrumentList,
246                    SIGNAL(instrumentsChanged()),
247                    SLOT(sessionDirty()));
248    #else
249            viewInstrumentsAction->setEnabled(false);
250    #endif
251      // Set message defaults...      // Set message defaults...
252      updateMessagesFont();      updateMessagesFont();
253      updateMessagesLimit();      updateMessagesLimit();
254      updateMessagesCapture();      updateMessagesCapture();
255      // Set the visibility signal.      // Set the visibility signal.
256      QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm()));      QObject::connect(m_pMessages,
257                    SIGNAL(visibilityChanged(bool)),
258                    SLOT(stabilizeForm()));
259    
260      // Initial decorations toggle state.      // Initial decorations toggle state.
261      viewMenubarAction->setOn(m_pOptions->bMenubar);      viewMenubarAction->setOn(m_pOptions->bMenubar);
# Line 248  void qsamplerMainForm::setup ( qsamplerO Line 280  void qsamplerMainForm::setup ( qsamplerO
280      }      }
281      // Try to restore old window positioning and initial visibility.      // Try to restore old window positioning and initial visibility.
282      m_pOptions->loadWidgetGeometry(this);      m_pOptions->loadWidgetGeometry(this);
283        m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);
284      m_pOptions->loadWidgetGeometry(m_pDeviceForm);      m_pOptions->loadWidgetGeometry(m_pDeviceForm);
285    
286      // Final startup stabilization...      // Final startup stabilization...
# Line 287  bool qsamplerMainForm::queryClose (void) Line 320  bool qsamplerMainForm::queryClose (void)
320              ostr << *this;              ostr << *this;
321              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
322              // And the children, and the main windows state,.              // And the children, and the main windows state,.
323                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);
324              m_pOptions->saveWidgetGeometry(this);                          m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
325                  // Close popup widgets.                          m_pOptions->saveWidgetGeometry(this);
326                  if (m_pDeviceForm)                          // Close popup widgets.
327                      m_pDeviceForm->close();                          if (m_pInstrumentListForm)
328                                    m_pInstrumentListForm->close();
329                            if (m_pDeviceForm)
330                                    m_pDeviceForm->close();
331              // Stop client and/or server, gracefully.              // Stop client and/or server, gracefully.
332              stopServer();              stopServer();
333          }          }
# Line 344  void qsamplerMainForm::dropEvent ( QDrop Line 380  void qsamplerMainForm::dropEvent ( QDrop
380      if (!decodeDragFiles(pDropEvent, files))      if (!decodeDragFiles(pDropEvent, files))
381          return;          return;
382    
383      for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {          for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {
384                  const QString& sPath = *iter;                  const QString& sPath = *iter;
385                  if (qsamplerChannel::isInstrumentFile(sPath)) {                  if (qsamplerChannel::isInstrumentFile(sPath)) {
386                          // Try to create a new channel from instrument file...                          // Try to create a new channel from instrument file...
387                      qsamplerChannel *pChannel = new qsamplerChannel(this);                          qsamplerChannel *pChannel = new qsamplerChannel();
388                      if (pChannel == NULL)                          if (pChannel == NULL)
389                          return;                                  return;
390                          // Start setting the instrument filename...                          // Start setting the instrument filename...
391                          pChannel->setInstrument(sPath, 0);                          pChannel->setInstrument(sPath, 0);
392                      // Before we show it up, may be we'll                          // Before we show it up, may be we'll
393                      // better ask for some initial values?                          // better ask for some initial values?
394                      if (!pChannel->channelSetup(this)) {                          if (!pChannel->channelSetup(this)) {
395                          delete pChannel;                                  delete pChannel;
396                          return;                                  return;
397                      }                          }
398                      // Finally, give it to a new channel strip...                          // Finally, give it to a new channel strip...
399                          if (!createChannelStrip(pChannel)) {                          if (!createChannelStrip(pChannel)) {
400                          delete pChannel;                                  delete pChannel;
401                          return;                                  return;
402                          }                          }
403                      // Make that an overall update.                          // Make that an overall update.
404                      m_iDirtyCount++;                          m_iDirtyCount++;
405                      stabilizeForm();                          stabilizeForm();
406                  }   // Otherwise, load an usual session file (LSCP script)...                  }   // Otherwise, load an usual session file (LSCP script)...
407                  else if (closeSession(true))                  else if (closeSession(true))
408                          loadSessionFile(sPath);                          loadSessionFile(sPath);
# Line 382  void qsamplerMainForm::customEvent ( QCu Line 418  void qsamplerMainForm::customEvent ( QCu
418      // For the time being, just pump it to messages.      // For the time being, just pump it to messages.
419      if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {      if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {
420          qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent;          qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent;
421          appendMessagesColor(tr("Notify event: %1 data: %2")                  if (pEvent->event() == LSCP_EVENT_CHANNEL_INFO) {
422              .arg(::lscp_event_to_text(pEvent->event()))                          int iChannelID = pEvent->data().toInt();
423              .arg(pEvent->data()), "#996699");                          qsamplerChannelStrip *pChannelStrip = channelStrip(iChannelID);
424                            if (pChannelStrip)
425                                    channelStripChanged(pChannelStrip);
426                    } else {
427                            appendMessagesColor(tr("Notify event: %1 data: %2")
428                                    .arg(::lscp_event_to_text(pEvent->event()))
429                                    .arg(pEvent->data()), "#996699");
430                    }
431      }      }
432  }  }
433    
# Line 393  void qsamplerMainForm::customEvent ( QCu Line 436  void qsamplerMainForm::customEvent ( QCu
436  void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )  void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )
437  {  {
438      stabilizeForm();      stabilizeForm();
439        
440      editMenu->exec(pEvent->globalPos());      editMenu->exec(pEvent->globalPos());
441  }  }
442    
# Line 407  qsamplerOptions *qsamplerMainForm::optio Line 450  qsamplerOptions *qsamplerMainForm::optio
450      return m_pOptions;      return m_pOptions;
451  }  }
452    
453    
454  // The LSCP client descriptor property.  // The LSCP client descriptor property.
455  lscp_client_t *qsamplerMainForm::client (void)  lscp_client_t *qsamplerMainForm::client (void)
456  {  {
# Line 414  lscp_client_t *qsamplerMainForm::client Line 458  lscp_client_t *qsamplerMainForm::client
458  }  }
459    
460    
461    // The pseudo-singleton instance accessor.
462    qsamplerMainForm *qsamplerMainForm::getInstance (void)
463    {
464            return g_pMainForm;
465    }
466    
467    
468  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
469  // qsamplerMainForm -- Session file stuff.  // qsamplerMainForm -- Session file stuff.
470    
# Line 461  bool qsamplerMainForm::openSession (void Line 512  bool qsamplerMainForm::openSession (void
512    
513      // Ask for the filename to open...      // Ask for the filename to open...
514      QString sFilename = QFileDialog::getOpenFileName(      QString sFilename = QFileDialog::getOpenFileName(
515              m_pOptions->sSessionDir,                // Start here.                  m_pOptions->sSessionDir,                // Start here.
516              tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)                  tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)
517              this, 0,                                // Parent and name (none)                  this, 0,                                // Parent and name (none)
518              tr("Open Session")                      // Caption.                  QSAMPLER_TITLE ": " + tr("Open Session")        // Caption.
519      );      );
520    
521      // Have we cancelled?      // Have we cancelled?
# Line 495  bool qsamplerMainForm::saveSession ( boo Line 546  bool qsamplerMainForm::saveSession ( boo
546              sFilename = m_pOptions->sSessionDir;              sFilename = m_pOptions->sSessionDir;
547          // Prompt the guy...          // Prompt the guy...
548          sFilename = QFileDialog::getSaveFileName(          sFilename = QFileDialog::getSaveFileName(
549                  sFilename,                              // Start here.                          sFilename,                              // Start here.
550                  tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)                          tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)
551                  this, 0,                                // Parent and name (none)                          this, 0,                                // Parent and name (none)
552                  tr("Save Session")                      // Caption.                          QSAMPLER_TITLE ": " + tr("Save Session")        // Caption.
553          );          );
554          // Have we cancelled it?          // Have we cancelled it?
555          if (sFilename.isEmpty())          if (sFilename.isEmpty())
# Line 508  bool qsamplerMainForm::saveSession ( boo Line 559  bool qsamplerMainForm::saveSession ( boo
559              sFilename += ".lscp";              sFilename += ".lscp";
560          // Check if already exists...          // Check if already exists...
561          if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {          if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {
562              if (QMessageBox::warning(this, tr("Warning"),              if (QMessageBox::warning(this,
563                                    QSAMPLER_TITLE ": " + tr("Warning"),
564                  tr("The file already exists:\n\n"                  tr("The file already exists:\n\n"
565                     "\"%1\"\n\n"                     "\"%1\"\n\n"
566                     "Do you want to replace it?")                     "Do you want to replace it?")
# Line 530  bool qsamplerMainForm::closeSession ( bo Line 582  bool qsamplerMainForm::closeSession ( bo
582    
583      // Are we dirty enough to prompt it?      // Are we dirty enough to prompt it?
584      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
585          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this,
586                            QSAMPLER_TITLE ": " + tr("Warning"),
587              tr("The current session has been changed:\n\n"              tr("The current session has been changed:\n\n"
588              "\"%1\"\n\n"              "\"%1\"\n\n"
589              "Do you want to save the changes?")              "Do you want to save the changes?")
# Line 588  bool qsamplerMainForm::loadSessionFile ( Line 641  bool qsamplerMainForm::loadSessionFile (
641      QTextStream ts(&file);      QTextStream ts(&file);
642      while (!ts.atEnd()) {      while (!ts.atEnd()) {
643          // Read the line.          // Read the line.
644          QString sCommand = ts.readLine().simplifyWhiteSpace();          QString sCommand = ts.readLine().stripWhiteSpace();
645          // If not empty, nor a comment, call the server...          // If not empty, nor a comment, call the server...
646          if (!sCommand.isEmpty() && sCommand[0] != '#') {          if (!sCommand.isEmpty() && sCommand[0] != '#') {
647              appendMessagesColor(sCommand, "#996633");              appendMessagesColor(sCommand, "#996633");
# Line 598  bool qsamplerMainForm::loadSessionFile ( Line 651  bool qsamplerMainForm::loadSessionFile (
651              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
652                  appendMessagesClient("lscp_client_query");                  appendMessagesClient("lscp_client_query");
653                  iErrors++;                  iErrors++;
                 break;  
654              }              }
655          }          }
656          // Try to make it snappy :)          // Try to make it snappy :)
# Line 608  bool qsamplerMainForm::loadSessionFile ( Line 660  bool qsamplerMainForm::loadSessionFile (
660      // Ok. we've read it.      // Ok. we've read it.
661      file.close();      file.close();
662    
     // Have we any errors?  
     if (iErrors > 0)  
         appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename));  
   
663          // Now we'll try to create (update) the whole GUI session.          // Now we'll try to create (update) the whole GUI session.
664          updateSession();          updateSession();
665    
666            // Have we any errors?
667            if (iErrors > 0)
668                    appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename));
669    
670      // Save as default session directory.      // Save as default session directory.
671      if (m_pOptions)      if (m_pOptions)
672          m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true);          m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true);
673      // We're not dirty anymore.          // We're not dirty anymore, if loaded without errors,
674      m_iDirtyCount = 0;          m_iDirtyCount = iErrors;
675      // Stabilize form...      // Stabilize form...
676      m_sFilename = sFilename;      m_sFilename = sFilename;
677      updateRecentFiles(sFilename);      updateRecentFiles(sFilename);
678      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));
679        
680      // Make that an overall update.      // Make that an overall update.
681      stabilizeForm();      stabilizeForm();
682      return true;      return true;
# Line 666  bool qsamplerMainForm::saveSessionFile ( Line 718  bool qsamplerMainForm::saveSessionFile (
718          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap;
719          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
720          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
                 qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]);  
721                  ts << endl;                  ts << endl;
722          ts << "# " << device.deviceTypeName() << " " << device.driverName()                  qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);
723                     << " " << tr("Device") << " " << iDevice << endl;                  // Audio device specification...
724                    ts << "# " << device.deviceTypeName() << " " << device.driverName()
725                            << " " << tr("Device") << " " << iDevice << endl;
726                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
727                  const qsamplerDeviceParamMap& params = device.params();                  qsamplerDeviceParamMap::ConstIterator deviceParam;
728                  qsamplerDeviceParamMap::ConstIterator iter;                  for (deviceParam = device.params().begin();
729                  for (iter = params.begin(); iter != params.end(); ++iter)                                  deviceParam != device.params().end();
730                          ts << " " << iter.key() << "='" << iter.data().value << "'";                                          ++deviceParam) {
731                            const qsamplerDeviceParam& param = deviceParam.data();
732                            if (param.value.isEmpty()) ts << "# ";
733                            ts << " " << deviceParam.key() << "='" << param.value << "'";
734                    }
735                  ts << endl;                  ts << endl;
736                    // Audio channel parameters...
737                    int iPort = 0;
738                    for (qsamplerDevicePort *pPort = device.ports().first();
739                                    pPort;
740                                            pPort = device.ports().next(), ++iPort) {
741                            qsamplerDeviceParamMap::ConstIterator portParam;
742                            for (portParam = pPort->params().begin();
743                                            portParam != pPort->params().end();
744                                                    ++portParam) {
745                                    const qsamplerDeviceParam& param = portParam.data();
746                                    if (param.fix || param.value.isEmpty()) ts << "# ";
747                                    ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice
748                                            << " " << iPort << " " << portParam.key()
749                                            << "='" << param.value << "'" << endl;
750                            }
751                    }
752                    // Audio device index/id mapping.
753                  audioDeviceMap[device.deviceID()] = iDevice;                  audioDeviceMap[device.deviceID()] = iDevice;
754          // Try to keep it snappy :)          // Try to keep it snappy :)
755          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
# Line 684  bool qsamplerMainForm::saveSessionFile ( Line 758  bool qsamplerMainForm::saveSessionFile (
758          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap;
759          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
760          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
                 qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]);  
761                  ts << endl;                  ts << endl;
762          ts << "# " << device.deviceTypeName() << " " << device.driverName()                  qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);
763                     << " " << tr("Device") << " " << iDevice << endl;                  // MIDI device specification...
764                    ts << "# " << device.deviceTypeName() << " " << device.driverName()
765                            << " " << tr("Device") << " " << iDevice << endl;
766                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
767                  const qsamplerDeviceParamMap& params = device.params();                  qsamplerDeviceParamMap::ConstIterator deviceParam;
768                  qsamplerDeviceParamMap::ConstIterator iter;                  for (deviceParam = device.params().begin();
769                  for (iter = params.begin(); iter != params.end(); ++iter)                                  deviceParam != device.params().end();
770                          ts << " " << iter.key() << "='" << iter.data().value << "'";                                          ++deviceParam) {
771                            const qsamplerDeviceParam& param = deviceParam.data();
772                            if (param.value.isEmpty()) ts << "# ";
773                            ts << " " << deviceParam.key() << "='" << param.value << "'";
774                    }
775                  ts << endl;                  ts << endl;
776                    // MIDI port parameters...
777                    int iPort = 0;
778                    for (qsamplerDevicePort *pPort = device.ports().first();
779                                    pPort;
780                                            pPort = device.ports().next(), ++iPort) {
781                            qsamplerDeviceParamMap::ConstIterator portParam;
782                            for (portParam = pPort->params().begin();
783                                            portParam != pPort->params().end();
784                                                    ++portParam) {
785                                    const qsamplerDeviceParam& param = portParam.data();
786                                    if (param.fix || param.value.isEmpty()) ts << "# ";
787                                    ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice
788                                       << " " << iPort << " " << portParam.key()
789                                       << "='" << param.value << "'" << endl;
790                            }
791                    }
792                    // MIDI device index/id mapping.
793                  midiDeviceMap[device.deviceID()] = iDevice;                  midiDeviceMap[device.deviceID()] = iDevice;
794          // Try to keep it snappy :)          // Try to keep it snappy :)
795          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
# Line 708  bool qsamplerMainForm::saveSessionFile ( Line 804  bool qsamplerMainForm::saveSessionFile (
804              if (pChannel) {              if (pChannel) {
805                  ts << "# " << tr("Channel") << " " << iChannel << endl;                  ts << "# " << tr("Channel") << " " << iChannel << endl;
806                  ts << "ADD CHANNEL" << endl;                  ts << "ADD CHANNEL" << endl;
807                  if (audioDeviceMap.isEmpty()) {                                  if (audioDeviceMap.isEmpty()) {
808                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel
809                                              << " " << pChannel->audioDriver() << endl;                                                  << " " << pChannel->audioDriver() << endl;
810                              } else {                                  } else {
811                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel
812                                             << " " << audioDeviceMap[pChannel->audioDevice()] << endl;                                                  << " " << audioDeviceMap[pChannel->audioDevice()] << endl;
813                                    }
814                                    if (midiDeviceMap.isEmpty()) {
815                                            ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel
816                                                    << " " << pChannel->midiDriver() << endl;
817                                    } else {
818                                            ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel
819                                                    << " " << midiDeviceMap[pChannel->midiDevice()] << endl;
820                                  }                                  }
821                  if (midiDeviceMap.isEmpty()) {                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel
822                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel                                          << " " << pChannel->midiPort() << endl;
                                        << " " << 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;  
823                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";
824                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
825                      ts << "ALL";                      ts << "ALL";
# Line 732  bool qsamplerMainForm::saveSessionFile ( Line 828  bool qsamplerMainForm::saveSessionFile (
828                  ts << endl;                  ts << endl;
829                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;
830                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl;                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl;
831                                    qsamplerChannelRoutingMap::ConstIterator audioRoute;
832                                    for (audioRoute = pChannel->audioRouting().begin();
833                                                    audioRoute != pChannel->audioRouting().end();
834                                                            ++audioRoute) {
835                                            ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel
836                                                    << " " << audioRoute.key()
837                                                    << " " << audioRoute.data() << endl;
838                                    }
839                  ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl;                  ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl;
840                                    if (pChannel->channelMute())
841                                            ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;
842                                    if (pChannel->channelSolo())
843                                            ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;
844                  ts << endl;                  ts << endl;
845              }              }
846          }          }
# Line 740  bool qsamplerMainForm::saveSessionFile ( Line 848  bool qsamplerMainForm::saveSessionFile (
848          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
849      }      }
850    
851    #ifdef CONFIG_MIDI_INSTRUMENT
852            // MIDI instrument mapping...
853            lscp_midi_instrument_t *pInstrs = ::lscp_list_midi_instruments(m_pClient);
854            if (pInstrs)
855                    ts << "# " << tr("MIDI instrument mapping") << endl;
856            for (int iInstr = 0; pInstrs && pInstrs[iInstr].program >= 0; iInstr++) {
857                    lscp_midi_instrument_info_t *pInstrInfo
858                            = ::lscp_get_midi_instrument_info(m_pClient, &pInstrs[iInstr]);
859                    if (pInstrInfo) {
860                            ts << "MAP MIDI_INSTRUMENT "
861                                    << pInstrs[iInstr].bank_msb    << " "
862                                    << pInstrs[iInstr].bank_lsb    << " "
863                                    << pInstrs[iInstr].program     << " "
864                                    << pInstrInfo->engine_name     << " '"
865                                    << pInstrInfo->instrument_file << "' "
866                                    << pInstrInfo->instrument_nr   << " "
867                                    << pInstrInfo->volume          << " ";
868                            switch (pInstrInfo->load_mode) {
869                                    case LSCP_LOAD_PERSISTENT:
870                                            ts << "PERSISTENT";
871                                            break;
872                                    case LSCP_LOAD_ON_DEMAND_HOLD:
873                                            ts << "ON_DEMAND_HOLD";
874                                            break;
875                                    case LSCP_LOAD_ON_DEMAND:
876                                    case LSCP_LOAD_DEFAULT:
877                                    default:
878                                            ts << "ON_DEMAND";
879                                            break;
880                            }
881                            if (pInstrInfo->name)
882                                    ts << " '" << pInstrInfo->name << "'";
883                            ts << endl;
884                    }
885                    // Try to keep it snappy :)
886                    QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
887            }
888            if (pInstrs)
889                    ts << endl;
890    #endif //  CONFIG_MIDI_INSTRUMENT
891    
892      // Ok. we've wrote it.      // Ok. we've wrote it.
893      file.close();      file.close();
894    
# Line 824  void qsamplerMainForm::fileReset (void) Line 973  void qsamplerMainForm::fileReset (void)
973          return;          return;
974    
975      // Ask user whether he/she want's an internal sampler reset...      // Ask user whether he/she want's an internal sampler reset...
976      if (QMessageBox::warning(this, tr("Warning"),      if (QMessageBox::warning(this,
977                    QSAMPLER_TITLE ": " + tr("Warning"),
978          tr("Resetting the sampler instance will close\n"          tr("Resetting the sampler instance will close\n"
979             "all device and channel configurations.\n\n"             "all device and channel configurations.\n\n"
980             "Please note that this operation may cause\n"             "Please note that this operation may cause\n"
981             "temporary MIDI and Audio disruption\n\n"             "temporary MIDI and Audio disruption.\n\n"
982             "Do you want to reset the sampler engine now?"),             "Do you want to reset the sampler engine now?"),
983          tr("Reset"), tr("Cancel")) > 0)          tr("Reset"), tr("Cancel")) > 0)
984          return;          return;
# Line 853  void qsamplerMainForm::fileRestart (void Line 1003  void qsamplerMainForm::fileRestart (void
1003  {  {
1004      if (m_pOptions == NULL)      if (m_pOptions == NULL)
1005          return;          return;
1006            
1007      bool bRestart = true;      bool bRestart = true;
1008        
1009      // Ask user whether he/she want's a complete restart...      // Ask user whether he/she want's a complete restart...
1010      // (if we're currently up and running)      // (if we're currently up and running)
1011      if (bRestart && m_pClient) {      if (bRestart && m_pClient) {
1012          bRestart = (QMessageBox::warning(this, tr("Warning"),          bRestart = (QMessageBox::warning(this,
1013                            QSAMPLER_TITLE ": " + tr("Warning"),
1014              tr("New settings will be effective after\n"              tr("New settings will be effective after\n"
1015                 "restarting the client/server connection.\n\n"                 "restarting the client/server connection.\n\n"
1016                 "Please note that this operation may cause\n"                 "Please note that this operation may cause\n"
1017                 "temporary MIDI and Audio disruption\n\n"                 "temporary MIDI and Audio disruption.\n\n"
1018                 "Do you want to restart the connection now?"),                 "Do you want to restart the connection now?"),
1019              tr("Restart"), tr("Cancel")) == 0);              tr("Restart"), tr("Cancel")) == 0);
1020      }      }
# Line 896  void qsamplerMainForm::editAddChannel (v Line 1047  void qsamplerMainForm::editAddChannel (v
1047          return;          return;
1048    
1049      // Just create the channel instance...      // Just create the channel instance...
1050      qsamplerChannel *pChannel = new qsamplerChannel(this);      qsamplerChannel *pChannel = new qsamplerChannel();
1051      if (pChannel == NULL)      if (pChannel == NULL)
1052          return;          return;
1053    
# Line 906  void qsamplerMainForm::editAddChannel (v Line 1057  void qsamplerMainForm::editAddChannel (v
1057          delete pChannel;          delete pChannel;
1058          return;          return;
1059      }      }
1060        
1061      // And give it to the strip (will own the channel instance, if successful).      // And give it to the strip (will own the channel instance, if successful).
1062      if (!createChannelStrip(pChannel)) {      if (!createChannelStrip(pChannel)) {
1063          delete pChannel;          delete pChannel;
# Line 928  void qsamplerMainForm::editRemoveChannel Line 1079  void qsamplerMainForm::editRemoveChannel
1079      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1080      if (pChannelStrip == NULL)      if (pChannelStrip == NULL)
1081          return;          return;
1082            
1083      qsamplerChannel *pChannel = pChannelStrip->channel();      qsamplerChannel *pChannel = pChannelStrip->channel();
1084      if (pChannel == NULL)      if (pChannel == NULL)
1085          return;          return;
1086    
1087      // Prompt user if he/she's sure about this...      // Prompt user if he/she's sure about this...
1088      if (m_pOptions && m_pOptions->bConfirmRemove) {      if (m_pOptions && m_pOptions->bConfirmRemove) {
1089          if (QMessageBox::warning(this, tr("Warning"),          if (QMessageBox::warning(this,
1090                            QSAMPLER_TITLE ": " + tr("Warning"),
1091              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
1092                 "%1\n\n"                 "%1\n\n"
1093                 "Are you sure?")                 "Are you sure?")
# Line 950  void qsamplerMainForm::editRemoveChannel Line 1102  void qsamplerMainForm::editRemoveChannel
1102    
1103      // Just delete the channel strip.      // Just delete the channel strip.
1104      delete pChannelStrip;      delete pChannelStrip;
1105        
1106      // Do we auto-arrange?      // Do we auto-arrange?
1107      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
1108          channelsArrange();          channelsArrange();
# Line 994  void qsamplerMainForm::editResetChannel Line 1146  void qsamplerMainForm::editResetChannel
1146  // Reset all sampler channels.  // Reset all sampler channels.
1147  void qsamplerMainForm::editResetAllChannels (void)  void qsamplerMainForm::editResetAllChannels (void)
1148  {  {
1149      if (m_pClient == NULL)          if (m_pClient == NULL)
1150          return;                  return;
1151    
1152      // Invoque the channel strip procedure,          // Invoque the channel strip procedure,
1153          // for all channels out there...          // for all channels out there...
1154      m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1155      QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1156      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1157          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1158          if (pChannelStrip)                  if (pChannelStrip)
1159                  pChannelStrip->channelReset();                          pChannelStrip->channelReset();
1160      }          }
1161      m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
1162  }  }
1163    
1164    
# Line 1058  void qsamplerMainForm::viewMessages ( bo Line 1210  void qsamplerMainForm::viewMessages ( bo
1210  }  }
1211    
1212    
1213    // Show/hide the MIDI instrument list-view form.
1214    void qsamplerMainForm::viewInstruments (void)
1215    {
1216            if (m_pOptions == NULL)
1217                    return;
1218    
1219            if (m_pInstrumentListForm) {
1220                    m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
1221                    if (m_pInstrumentListForm->isVisible()) {
1222                            m_pInstrumentListForm->hide();
1223                    } else {
1224                            m_pInstrumentListForm->show();
1225                            m_pInstrumentListForm->raise();
1226                            m_pInstrumentListForm->setActiveWindow();
1227                    }
1228            }
1229    }
1230    
1231    
1232  // Show/hide the device configurator form.  // Show/hide the device configurator form.
1233  void qsamplerMainForm::viewDevices (void)  void qsamplerMainForm::viewDevices (void)
1234  {  {
1235      if (m_pOptions == NULL)          if (m_pOptions == NULL)
1236          return;                  return;
1237    
1238      if (m_pDeviceForm) {          if (m_pDeviceForm) {
1239          m_pOptions->saveWidgetGeometry(m_pDeviceForm);                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);
1240                  m_pDeviceForm->setClient(m_pClient);                  if (m_pDeviceForm->isVisible()) {
1241          if (m_pDeviceForm->isVisible()) {                          m_pDeviceForm->hide();
1242              m_pDeviceForm->hide();                  } else {
1243          } else {                          m_pDeviceForm->show();
1244              m_pDeviceForm->show();                          m_pDeviceForm->raise();
1245              m_pDeviceForm->raise();                          m_pDeviceForm->setActiveWindow();
1246              m_pDeviceForm->setActiveWindow();                  }
1247          }          }
     }  
1248  }  }
1249    
1250    
# Line 1118  void qsamplerMainForm::viewOptions (void Line 1288  void qsamplerMainForm::viewOptions (void
1288                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1289                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1290                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {
1291                  QMessageBox::information(this, tr("Information"),                  QMessageBox::information(this,
1292                                            QSAMPLER_TITLE ": " + tr("Information"),
1293                      tr("Some settings may be only effective\n"                      tr("Some settings may be only effective\n"
1294                         "next time you start this program."), tr("OK"));                         "next time you start this program."), tr("OK"));
1295                  updateMessagesCapture();                  updateMessagesCapture();
# Line 1192  void qsamplerMainForm::channelsArrange ( Line 1363  void qsamplerMainForm::channelsArrange (
1363          y += iHeight;          y += iHeight;
1364      }      }
1365      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1366        
1367      stabilizeForm();      stabilizeForm();
1368  }  }
1369    
# Line 1246  void qsamplerMainForm::helpAbout (void) Line 1417  void qsamplerMainForm::helpAbout (void)
1417      sText += tr("LSCP (liblscp) instrument_name support disabled.");      sText += tr("LSCP (liblscp) instrument_name support disabled.");
1418      sText += "</font></small><br />";      sText += "</font></small><br />";
1419  #endif  #endif
1420    #ifndef CONFIG_MUTE_SOLO
1421        sText += "<small><font color=\"red\">";
1422        sText += tr("Sampler channel Mute/Solo support disabled.");
1423        sText += "</font></small><br />";
1424    #endif
1425    #ifndef CONFIG_MIDI_INSTRUMENT
1426        sText += "<small><font color=\"red\">";
1427        sText += tr("MIDI instrument mapping support disabled.");
1428        sText += "</font></small><br />";
1429    #endif
1430      sText += "<br />\n";      sText += "<br />\n";
1431      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1432      sText += ::lscp_client_package();      sText += ::lscp_client_package();
1433      sText += " ";      sText += " ";
1434      sText += ::lscp_client_version();      sText += ::lscp_client_version();
1435    #ifdef CONFIG_LIBGIG
1436        sText += ", ";
1437        sText += gig::libraryName().c_str();
1438        sText += " ";
1439        sText += gig::libraryVersion().c_str();
1440    #endif
1441      sText += "<br />\n";      sText += "<br />\n";
1442      sText += "<br />\n";      sText += "<br />\n";
1443      sText += tr("Website") + ": <a href=\"" QSAMPLER_WEBSITE "\">" QSAMPLER_WEBSITE "</a><br />\n";      sText += tr("Website") + ": <a href=\"" QSAMPLER_WEBSITE "\">" QSAMPLER_WEBSITE "</a><br />\n";
# Line 1275  void qsamplerMainForm::stabilizeForm (vo Line 1462  void qsamplerMainForm::stabilizeForm (vo
1462      // Update the main application caption...      // Update the main application caption...
1463      QString sSessionName = sessionName(m_sFilename);      QString sSessionName = sessionName(m_sFilename);
1464      if (m_iDirtyCount > 0)      if (m_iDirtyCount > 0)
1465          sSessionName += '*';          sSessionName += " *";
1466      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));
1467    
1468      // Update the main menu state...      // Update the main menu state...
# Line 1294  void qsamplerMainForm::stabilizeForm (vo Line 1481  void qsamplerMainForm::stabilizeForm (vo
1481      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1482      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
1483      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1484      viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());  #ifdef CONFIG_MIDI_INSTRUMENT
1485            viewInstrumentsAction->setOn(m_pInstrumentListForm
1486                    && m_pInstrumentListForm->isVisible());
1487            viewInstrumentsAction->setEnabled(bHasClient);
1488    #endif
1489            viewDevicesAction->setOn(m_pDeviceForm
1490                    && m_pDeviceForm->isVisible());
1491      viewDevicesAction->setEnabled(bHasClient);      viewDevicesAction->setEnabled(bHasClient);
1492      channelsArrangeAction->setEnabled(bHasChannel);      channelsArrangeAction->setEnabled(bHasChannel);
1493    
# Line 1330  void qsamplerMainForm::stabilizeForm (vo Line 1523  void qsamplerMainForm::stabilizeForm (vo
1523  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )
1524  {  {
1525          // Add this strip to the changed list...          // Add this strip to the changed list...
1526          if (m_changedStrips.containsRef(pChannelStrip) == 0)          if (m_changedStrips.containsRef(pChannelStrip) == 0) {
1527                  m_changedStrips.append(pChannelStrip);                  m_changedStrips.append(pChannelStrip);
1528                    pChannelStrip->resetErrorCount();
1529            }
1530    
1531      // Just mark the dirty form.      // Just mark the dirty form.
1532      m_iDirtyCount++;      m_iDirtyCount++;
# Line 1358  void qsamplerMainForm::updateSession (vo Line 1553  void qsamplerMainForm::updateSession (vo
1553          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1554                  // Check if theres already a channel strip for this one...                  // Check if theres already a channel strip for this one...
1555                  if (!channelStrip(piChannelIDs[iChannel]))                  if (!channelStrip(piChannelIDs[iChannel]))
1556                          createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));                          createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));
1557                  // Make it visibly responsive...                  // Make it visibly responsive...
1558                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1559          }          }
1560          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
1561            
1562            // Remember to refresh devices and instruments...
1563            if (m_pInstrumentListForm)
1564                m_pInstrumentListForm->refreshInstruments();
1565            if (m_pDeviceForm)
1566                m_pDeviceForm->refreshDevices();
1567  }  }
1568    
1569    
# Line 1533  void qsamplerMainForm::appendMessagesErr Line 1734  void qsamplerMainForm::appendMessagesErr
1734    
1735      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");
1736    
1737      QMessageBox::critical(this, tr("Error"), s, tr("Cancel"));      QMessageBox::critical(this,
1738                    QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));
1739  }  }
1740    
1741    
# Line 1573  void qsamplerMainForm::updateMessagesLim Line 1775  void qsamplerMainForm::updateMessagesLim
1775          if (m_pOptions->bMessagesLimit)          if (m_pOptions->bMessagesLimit)
1776              m_pMessages->setMessagesLimit(m_pOptions->iMessagesLimitLines);              m_pMessages->setMessagesLimit(m_pOptions->iMessagesLimitLines);
1777          else          else
1778              m_pMessages->setMessagesLimit(0);              m_pMessages->setMessagesLimit(-1);
1779      }      }
1780  }  }
1781    
# Line 1617  qsamplerChannelStrip *qsamplerMainForm:: Line 1819  qsamplerChannelStrip *qsamplerMainForm::
1819      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1820      if (pChannelStrip == NULL)      if (pChannelStrip == NULL)
1821          return NULL;          return NULL;
1822            
1823      // Actual channel strip setup...      // Actual channel strip setup...
1824      pChannelStrip->setup(pChannel);      pChannelStrip->setup(pChannel);
1825      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
# Line 1675  qsamplerChannelStrip *qsamplerMainForm:: Line 1877  qsamplerChannelStrip *qsamplerMainForm::
1877          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1878          if (wlist.isEmpty())          if (wlist.isEmpty())
1879                  return NULL;                  return NULL;
1880            
1881          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1882                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1883                  if (pChannelStrip) {                  if (pChannelStrip) {
# Line 1756  void qsamplerMainForm::timerSlot (void) Line 1958  void qsamplerMainForm::timerSlot (void)
1958              }              }
1959          }          }
1960      }      }
1961        
1962          // Refresh each channel usage, on each period...          if (m_pClient) {
1963      if (m_pClient && (m_changedStrips.count() > 0 || m_pOptions->bAutoRefresh)) {                  // Update the channel information for each pending strip...
1964          m_iTimerSlot += QSAMPLER_TIMER_MSECS;                  if (m_changedStrips.count() > 0) {
1965          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {                          for (qsamplerChannelStrip *pChannelStrip = m_changedStrips.first();
1966              m_iTimerSlot = 0;                                          pChannelStrip; pChannelStrip = m_changedStrips.next()) {
             // Update the channel information for each pending strip...  
             for (qsamplerChannelStrip *pChannelStrip = m_changedStrips.first();  
                     pChannelStrip;  
                                                 pChannelStrip = m_changedStrips.next()) {  
1967                                  // If successfull, remove from pending list...                                  // If successfull, remove from pending list...
1968                                  if (pChannelStrip->updateChannelInfo())                                  if (pChannelStrip->updateChannelInfo())
1969                      m_changedStrips.remove(pChannelStrip);                                          m_changedStrips.remove(pChannelStrip);
1970                          }                          }
1971              // Update the channel stream usage for each strip...                  }
1972              QWidgetList wlist = m_pWorkspace->windowList();                  // Refresh each channel usage, on each period...
1973              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {                  if (m_pOptions->bAutoRefresh) {
1974                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1975                  if (pChannelStrip && pChannelStrip->isVisible())                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {
1976                      pChannelStrip->updateChannelUsage();                                  m_iTimerSlot = 0;
1977              }                                  // Update the channel stream usage for each strip...
1978          }                                  QWidgetList wlist = m_pWorkspace->windowList();
1979      }                                  for (int iChannel = 0;
1980                                                    iChannel < (int) wlist.count(); iChannel++) {
1981                                            qsamplerChannelStrip *pChannelStrip
1982                                                    = (qsamplerChannelStrip *) wlist.at(iChannel);
1983                                            if (pChannelStrip && pChannelStrip->isVisible())
1984                                                    pChannelStrip->updateChannelUsage();
1985                                    }
1986                            }
1987                    }
1988            }
1989    
1990      // Register the next timer slot.      // Register the next timer slot.
1991      QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(timerSlot()));      QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(timerSlot()));
# Line 1800  void qsamplerMainForm::startServer (void Line 2007  void qsamplerMainForm::startServer (void
2007    
2008      // Is the server process instance still here?      // Is the server process instance still here?
2009      if (m_pServer) {      if (m_pServer) {
2010          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this,
2011                            QSAMPLER_TITLE ": " + tr("Warning"),
2012              tr("Could not start the LinuxSampler server.\n\n"              tr("Could not start the LinuxSampler server.\n\n"
2013                 "Maybe it ss already started."),                 "Maybe it ss already started."),
2014              tr("Stop"), tr("Kill"), tr("Cancel"))) {              tr("Stop"), tr("Kill"), tr("Cancel"))) {
# Line 1959  bool qsamplerMainForm::startClient (void Line 2167  bool qsamplerMainForm::startClient (void
2167      ::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout);      ::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout);
2168      appendMessages(tr("Client receive timeout is set to %1 msec.").arg(::lscp_client_get_timeout(m_pClient)));      appendMessages(tr("Client receive timeout is set to %1 msec.").arg(::lscp_client_get_timeout(m_pClient)));
2169    
2170            // Subscribe to channel info change notifications...
2171            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK)
2172                    appendMessagesClient("lscp_client_subscribe");
2173    
2174      // We may stop scheduling around.      // We may stop scheduling around.
2175      stopSchedule();      stopSchedule();
2176    
# Line 1968  bool qsamplerMainForm::startClient (void Line 2180  bool qsamplerMainForm::startClient (void
2180      // Log success here.      // Log success here.
2181      appendMessages(tr("Client connected."));      appendMessages(tr("Client connected."));
2182    
2183          // Hard-notify device configuration form,          // Hard-notify instrumnet and device configuration forms,
2184          // if visible, that we're ready...          // if visible, that we're ready...
2185          if (m_pDeviceForm && m_pDeviceForm->isVisible())          if (m_pInstrumentListForm)
2186              m_pDeviceForm->setClient(m_pClient);              m_pInstrumentListForm->refreshInstruments();
2187                        if (m_pDeviceForm)
2188                m_pDeviceForm->refreshDevices();
2189    
2190      // Is any session pending to be loaded?      // Is any session pending to be loaded?
2191      if (!m_pOptions->sSessionFile.isEmpty()) {      if (!m_pOptions->sSessionFile.isEmpty()) {
2192          // Just load the prabably startup session...          // Just load the prabably startup session...
# Line 1993  void qsamplerMainForm::stopClient (void) Line 2207  void qsamplerMainForm::stopClient (void)
2207      if (m_pClient == NULL)      if (m_pClient == NULL)
2208          return;          return;
2209    
         // Hard-notify device configuration form,  
         // if visible, that we're running out...  
         if (m_pDeviceForm && m_pDeviceForm->isVisible())  
             m_pDeviceForm->setClient(NULL);  
   
2210      // Log prepare here.      // Log prepare here.
2211      appendMessages(tr("Client disconnecting..."));      appendMessages(tr("Client disconnecting..."));
2212    
# Line 2012  void qsamplerMainForm::stopClient (void) Line 2221  void qsamplerMainForm::stopClient (void)
2221      // channels from the back-end server.      // channels from the back-end server.
2222      m_iDirtyCount = 0;      m_iDirtyCount = 0;
2223      closeSession(false);      closeSession(false);
2224        
2225      // Close us as a client...      // Close us as a client...
2226      lscp_client_destroy(m_pClient);          ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO);
2227        ::lscp_client_destroy(m_pClient);
2228      m_pClient = NULL;      m_pClient = NULL;
2229    
2230            // Hard-notify instrumnet and device configuration forms,
2231            // if visible, that we're running out...
2232            if (m_pInstrumentListForm)
2233                m_pInstrumentListForm->refreshInstruments();
2234            if (m_pDeviceForm)
2235                m_pDeviceForm->refreshDevices();
2236    
2237      // Log final here.      // Log final here.
2238      appendMessages(tr("Client disconnected."));      appendMessages(tr("Client disconnected."));
2239    

Legend:
Removed from v.462  
changed lines
  Added in v.969

  ViewVC Help
Powered by ViewVC