/[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 753 by capela, Wed Aug 24 17:44:59 2005 UTC revision 1034 by capela, Mon Jan 15 16:21:01 2007 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-2007, 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 32  Line 32 
32  #include <qfile.h>  #include <qfile.h>
33  #include <qtextstream.h>  #include <qtextstream.h>
34  #include <qstatusbar.h>  #include <qstatusbar.h>
35    #include <qslider.h>
36    #include <qspinbox.h>
37  #include <qlabel.h>  #include <qlabel.h>
38  #include <qtimer.h>  #include <qtimer.h>
39    #include <qtooltip.h>
40    
41  #include "qsamplerAbout.h"  #include "qsamplerAbout.h"
42  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
# Line 41  Line 44 
44  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
45    
46  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
47    #include "qsamplerInstrumentList.h"
48    
49    #include "qsamplerInstrumentListForm.h"
50  #include "qsamplerDeviceForm.h"  #include "qsamplerDeviceForm.h"
51  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
52    
# Line 102  private: Line 107  private:
107  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
108  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
109    
110    // Kind of singleton reference.
111    qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL;
112    
113    
114  // Kind of constructor.  // Kind of constructor.
115  void qsamplerMainForm::init (void)  void qsamplerMainForm::init (void)
116  {  {
117            // Pseudo-singleton reference setup.
118            g_pMainForm = this;
119    
120      // Initialize some pointer references.      // Initialize some pointer references.
121      m_pOptions = NULL;      m_pOptions = NULL;
122    
123      // All child forms are to be created later, not earlier than setup.      // All child forms are to be created later, not earlier than setup.
124      m_pMessages   = NULL;      m_pMessages = NULL;
125        m_pInstrumentListForm = NULL;
126      m_pDeviceForm = NULL;      m_pDeviceForm = NULL;
127    
128      // We'll start clean.      // We'll start clean.
# Line 129  void qsamplerMainForm::init (void) Line 142  void qsamplerMainForm::init (void)
142          ::signal(SIGPIPE, SIG_IGN);          ::signal(SIGPIPE, SIG_IGN);
143  #endif  #endif
144    
145    #ifdef CONFIG_VOLUME
146        // Make some extras into the toolbar...
147            channelsToolbar->addSeparator();
148            const QString& sVolumeText = tr("Master volume");
149            m_iVolumeChanging = 0;
150            // Volume slider...
151            m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar);
152    //      m_pVolumeSlider->setTickmarks(QSlider::Below);
153    //      m_pVolumeSlider->setTickInterval(10);
154            m_pVolumeSlider->setPageStep(10);
155            m_pVolumeSlider->setRange(0, 100);
156            m_pVolumeSlider->setMaximumHeight(22);
157            m_pVolumeSlider->setMinimumWidth(160);
158            m_pVolumeSlider->setSizePolicy(
159                    QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
160            QToolTip::add(m_pVolumeSlider, sVolumeText);
161            QObject::connect(m_pVolumeSlider,
162                    SIGNAL(valueChanged(int)),
163                    SLOT(volumeChanged(int)));
164            // Volume spin-box
165            m_pVolumeSpinBox = new QSpinBox(channelsToolbar);
166            m_pVolumeSpinBox->setSuffix(" %");
167            m_pVolumeSpinBox->setRange(0, 100);
168            QToolTip::add(m_pVolumeSpinBox, sVolumeText);
169            QObject::connect(m_pVolumeSpinBox,
170                    SIGNAL(valueChanged(int)),
171                    SLOT(volumeChanged(int)));
172    #endif
173    
174      // Make it an MDI workspace.      // Make it an MDI workspace.
175      m_pWorkspace = new QWorkspace(this);      m_pWorkspace = new QWorkspace(this);
176      m_pWorkspace->setScrollBarsEnabled(true);      m_pWorkspace->setScrollBarsEnabled(true);
177      // Set the activation connection.          // Set the activation connection.
178      QObject::connect(m_pWorkspace, SIGNAL(windowActivated(QWidget *)), this, SLOT(stabilizeForm()));          QObject::connect(m_pWorkspace,
179                    SIGNAL(windowActivated(QWidget *)),
180                    SLOT(stabilizeForm()));
181      // Make it shine :-)      // Make it shine :-)
182      setCentralWidget(m_pWorkspace);      setCentralWidget(m_pWorkspace);
183    
# Line 186  void qsamplerMainForm::destroy (void) Line 230  void qsamplerMainForm::destroy (void)
230      // Finally drop any widgets around...      // Finally drop any widgets around...
231      if (m_pDeviceForm)      if (m_pDeviceForm)
232          delete m_pDeviceForm;          delete m_pDeviceForm;
233        if (m_pInstrumentListForm)
234            delete m_pInstrumentListForm;
235      if (m_pMessages)      if (m_pMessages)
236          delete m_pMessages;          delete m_pMessages;
237      if (m_pWorkspace)      if (m_pWorkspace)
# Line 201  void qsamplerMainForm::destroy (void) Line 247  void qsamplerMainForm::destroy (void)
247      if (m_statusItem[QSAMPLER_STATUS_SESSION])      if (m_statusItem[QSAMPLER_STATUS_SESSION])
248          delete m_statusItem[QSAMPLER_STATUS_SESSION];          delete m_statusItem[QSAMPLER_STATUS_SESSION];
249    
250    #ifdef CONFIG_VOLUME
251            delete m_pVolumeSpinBox;
252            delete m_pVolumeSlider;
253    #endif
254    
255      // Delete recentfiles menu.      // Delete recentfiles menu.
256      if (m_pRecentFilesMenu)      if (m_pRecentFilesMenu)
257          delete m_pRecentFilesMenu;          delete m_pRecentFilesMenu;
258    
259            // Pseudo-singleton reference shut-down.
260            g_pMainForm = NULL;
261  }  }
262    
263    
# Line 214  void qsamplerMainForm::setup ( qsamplerO Line 268  void qsamplerMainForm::setup ( qsamplerO
268      m_pOptions = pOptions;      m_pOptions = pOptions;
269    
270      // What style do we create these forms?      // What style do we create these forms?
271      WFlags wflags = Qt::WType_TopLevel;          Qt::WFlags wflags = Qt::WStyle_Customize
272                    | Qt::WStyle_NormalBorder
273                    | Qt::WStyle_Title
274                    | Qt::WStyle_SysMenu
275                    | Qt::WStyle_MinMax
276                    | Qt::WType_TopLevel;
277      if (m_pOptions->bKeepOnTop)      if (m_pOptions->bKeepOnTop)
278          wflags |= Qt::WStyle_Tool;          wflags |= Qt::WStyle_Tool;
279      // Some child forms are to be created right now.      // Some child forms are to be created right now.
280      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
281      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
282      m_pDeviceForm->setMainForm(this); // An important life immutable!  #ifdef CONFIG_MIDI_INSTRUMENT
283        m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags);
284            QObject::connect(m_pInstrumentListForm->InstrumentList,
285                    SIGNAL(instrumentsChanged()),
286                    SLOT(sessionDirty()));
287    #else
288            viewInstrumentsAction->setEnabled(false);
289    #endif
290      // Set message defaults...      // Set message defaults...
291      updateMessagesFont();      updateMessagesFont();
292      updateMessagesLimit();      updateMessagesLimit();
293      updateMessagesCapture();      updateMessagesCapture();
294      // Set the visibility signal.      // Set the visibility signal.
295      QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm()));          QObject::connect(m_pMessages,
296                    SIGNAL(visibilityChanged(bool)),
297                    SLOT(stabilizeForm()));
298    
299      // Initial decorations toggle state.      // Initial decorations toggle state.
300      viewMenubarAction->setOn(m_pOptions->bMenubar);      viewMenubarAction->setOn(m_pOptions->bMenubar);
# Line 251  void qsamplerMainForm::setup ( qsamplerO Line 319  void qsamplerMainForm::setup ( qsamplerO
319      }      }
320      // Try to restore old window positioning and initial visibility.      // Try to restore old window positioning and initial visibility.
321      m_pOptions->loadWidgetGeometry(this);      m_pOptions->loadWidgetGeometry(this);
322        m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);
323      m_pOptions->loadWidgetGeometry(m_pDeviceForm);      m_pOptions->loadWidgetGeometry(m_pDeviceForm);
324    
325      // Final startup stabilization...      // Final startup stabilization...
326        updateMaxVolume();
327      updateRecentFilesMenu();      updateRecentFilesMenu();
328      stabilizeForm();      stabilizeForm();
329    
# Line 291  bool qsamplerMainForm::queryClose (void) Line 361  bool qsamplerMainForm::queryClose (void)
361              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
362              // And the children, and the main windows state,.              // And the children, and the main windows state,.
363                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);
364                            m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
365                          m_pOptions->saveWidgetGeometry(this);                          m_pOptions->saveWidgetGeometry(this);
366                          // Close popup widgets.                          // Close popup widgets.
367                            if (m_pInstrumentListForm)
368                                    m_pInstrumentListForm->close();
369                          if (m_pDeviceForm)                          if (m_pDeviceForm)
370                                  m_pDeviceForm->close();                                  m_pDeviceForm->close();
371              // Stop client and/or server, gracefully.              // Stop client and/or server, gracefully.
# Line 351  void qsamplerMainForm::dropEvent ( QDrop Line 424  void qsamplerMainForm::dropEvent ( QDrop
424                  const QString& sPath = *iter;                  const QString& sPath = *iter;
425                  if (qsamplerChannel::isInstrumentFile(sPath)) {                  if (qsamplerChannel::isInstrumentFile(sPath)) {
426                          // Try to create a new channel from instrument file...                          // Try to create a new channel from instrument file...
427                          qsamplerChannel *pChannel = new qsamplerChannel(this);                          qsamplerChannel *pChannel = new qsamplerChannel();
428                          if (pChannel == NULL)                          if (pChannel == NULL)
429                                  return;                                  return;
430                          // Start setting the instrument filename...                          // Start setting the instrument filename...
# Line 371  void qsamplerMainForm::dropEvent ( QDrop Line 444  void qsamplerMainForm::dropEvent ( QDrop
444                          m_iDirtyCount++;                          m_iDirtyCount++;
445                          stabilizeForm();                          stabilizeForm();
446                  }   // Otherwise, load an usual session file (LSCP script)...                  }   // Otherwise, load an usual session file (LSCP script)...
447                  else if (closeSession(true))                  else if (closeSession(true)) {
448                          loadSessionFile(sPath);                          loadSessionFile(sPath);
449                            break;
450                    }
451                  // Make it look responsive...:)                  // Make it look responsive...:)
452                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
453          }          }
# Line 417  qsamplerOptions *qsamplerMainForm::optio Line 492  qsamplerOptions *qsamplerMainForm::optio
492      return m_pOptions;      return m_pOptions;
493  }  }
494    
495    
496  // The LSCP client descriptor property.  // The LSCP client descriptor property.
497  lscp_client_t *qsamplerMainForm::client (void)  lscp_client_t *qsamplerMainForm::client (void)
498  {  {
# Line 424  lscp_client_t *qsamplerMainForm::client Line 500  lscp_client_t *qsamplerMainForm::client
500  }  }
501    
502    
503    // The pseudo-singleton instance accessor.
504    qsamplerMainForm *qsamplerMainForm::getInstance (void)
505    {
506            return g_pMainForm;
507    }
508    
509    
510  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
511  // qsamplerMainForm -- Session file stuff.  // qsamplerMainForm -- Session file stuff.
512    
# Line 471  bool qsamplerMainForm::openSession (void Line 554  bool qsamplerMainForm::openSession (void
554    
555      // Ask for the filename to open...      // Ask for the filename to open...
556      QString sFilename = QFileDialog::getOpenFileName(      QString sFilename = QFileDialog::getOpenFileName(
557              m_pOptions->sSessionDir,                // Start here.                  m_pOptions->sSessionDir,                // Start here.
558              tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)                  tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)
559              this, 0,                                // Parent and name (none)                  this, 0,                                // Parent and name (none)
560              tr("Open Session")                      // Caption.                  QSAMPLER_TITLE ": " + tr("Open Session")        // Caption.
561      );      );
562    
563      // Have we cancelled?      // Have we cancelled?
# Line 505  bool qsamplerMainForm::saveSession ( boo Line 588  bool qsamplerMainForm::saveSession ( boo
588              sFilename = m_pOptions->sSessionDir;              sFilename = m_pOptions->sSessionDir;
589          // Prompt the guy...          // Prompt the guy...
590          sFilename = QFileDialog::getSaveFileName(          sFilename = QFileDialog::getSaveFileName(
591                  sFilename,                              // Start here.                          sFilename,                              // Start here.
592                  tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)                          tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)
593                  this, 0,                                // Parent and name (none)                          this, 0,                                // Parent and name (none)
594                  tr("Save Session")                      // Caption.                          QSAMPLER_TITLE ": " + tr("Save Session")        // Caption.
595          );          );
596          // Have we cancelled it?          // Have we cancelled it?
597          if (sFilename.isEmpty())          if (sFilename.isEmpty())
# Line 518  bool qsamplerMainForm::saveSession ( boo Line 601  bool qsamplerMainForm::saveSession ( boo
601              sFilename += ".lscp";              sFilename += ".lscp";
602          // Check if already exists...          // Check if already exists...
603          if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {          if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {
604              if (QMessageBox::warning(this, tr("Warning"),              if (QMessageBox::warning(this,
605                                    QSAMPLER_TITLE ": " + tr("Warning"),
606                  tr("The file already exists:\n\n"                  tr("The file already exists:\n\n"
607                     "\"%1\"\n\n"                     "\"%1\"\n\n"
608                     "Do you want to replace it?")                     "Do you want to replace it?")
# Line 540  bool qsamplerMainForm::closeSession ( bo Line 624  bool qsamplerMainForm::closeSession ( bo
624    
625      // Are we dirty enough to prompt it?      // Are we dirty enough to prompt it?
626      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
627          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this,
628                            QSAMPLER_TITLE ": " + tr("Warning"),
629              tr("The current session has been changed:\n\n"              tr("The current session has been changed:\n\n"
630              "\"%1\"\n\n"              "\"%1\"\n\n"
631              "Do you want to save the changes?")              "Do you want to save the changes?")
# Line 593  bool qsamplerMainForm::loadSessionFile ( Line 678  bool qsamplerMainForm::loadSessionFile (
678          return false;          return false;
679      }      }
680    
681            // Tell the world we'll take some time...
682            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
683    
684      // Read the file.      // Read the file.
685            int iLine = 0;
686      int iErrors = 0;      int iErrors = 0;
687      QTextStream ts(&file);      QTextStream ts(&file);
688      while (!ts.atEnd()) {      while (!ts.atEnd()) {
689          // Read the line.          // Read the line.
690          QString sCommand = ts.readLine().simplifyWhiteSpace();          QString sCommand = ts.readLine().stripWhiteSpace();
691                    iLine++;
692          // If not empty, nor a comment, call the server...          // If not empty, nor a comment, call the server...
693          if (!sCommand.isEmpty() && sCommand[0] != '#') {          if (!sCommand.isEmpty() && sCommand[0] != '#') {
694              appendMessagesColor(sCommand, "#996633");                          // Remember that, no matter what,
695              // Remember that, no matter what,                          // all LSCP commands are CR/LF terminated.
696              // all LSCP commands are CR/LF terminated.                          sCommand += "\r\n";
697              sCommand += "\r\n";                          if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
698              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {                                  appendMessagesColor(QString("%1(%2): %3")
699                  appendMessagesClient("lscp_client_query");                                          .arg(QFileInfo(sFilename).fileName()).arg(iLine)
700                  iErrors++;                                          .arg(sCommand.simplifyWhiteSpace()), "#996633");
701              }                                  appendMessagesClient("lscp_client_query");
702                                    iErrors++;
703                            }
704          }          }
705          // Try to make it snappy :)          // Try to make it snappy :)
706          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
# Line 620  bool qsamplerMainForm::loadSessionFile ( Line 712  bool qsamplerMainForm::loadSessionFile (
712          // Now we'll try to create (update) the whole GUI session.          // Now we'll try to create (update) the whole GUI session.
713          updateSession();          updateSession();
714    
715            // We're fornerly done.
716            QApplication::restoreOverrideCursor();
717    
718          // Have we any errors?          // Have we any errors?
719          if (iErrors > 0)          if (iErrors > 0)
720                  appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename));                  appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename));
# Line 643  bool qsamplerMainForm::loadSessionFile ( Line 738  bool qsamplerMainForm::loadSessionFile (
738  // Save current session to specific file path.  // Save current session to specific file path.
739  bool qsamplerMainForm::saveSessionFile ( const QString& sFilename )  bool qsamplerMainForm::saveSessionFile ( const QString& sFilename )
740  {  {
741            if (m_pClient == NULL)
742                    return false;
743    
744            // Check whether server is apparently OK...
745            if (::lscp_get_channels(m_pClient) < 0) {
746                    appendMessagesClient("lscp_get_channels");
747                    return false;
748            }
749    
750      // Open and write into real file.      // Open and write into real file.
751      QFile file(sFilename);      QFile file(sFilename);
752      if (!file.open(IO_WriteOnly | IO_Truncate)) {      if (!file.open(IO_WriteOnly | IO_Truncate)) {
# Line 650  bool qsamplerMainForm::saveSessionFile ( Line 754  bool qsamplerMainForm::saveSessionFile (
754          return false;          return false;
755      }      }
756    
757            // Tell the world we'll take some time...
758            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
759    
760      // Write the file.      // Write the file.
761      int  iErrors = 0;      int  iErrors = 0;
762      QTextStream ts(&file);      QTextStream ts(&file);
# Line 666  bool qsamplerMainForm::saveSessionFile ( Line 773  bool qsamplerMainForm::saveSessionFile (
773         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
774      ts << "#"  << endl;      ts << "#"  << endl;
775      ts << endl;      ts << endl;
776    
777          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
778          // will be loaded from a complete          // will be loaded from a complete initialized server...
779          int *piDeviceIDs;          int *piDeviceIDs;
780          int  iDevice;          int  iDevice;
781          ts << "RESET" << endl;          ts << "RESET" << endl;
782    
783          // Audio device mapping.          // Audio device mapping.
784          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap;
785          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
786          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
787                  ts << endl;                  ts << endl;
788                  qsamplerDevice device(this, qsamplerDevice::Audio, piDeviceIDs[iDevice]);                  qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);
789                  // Audio device specification...                  // Audio device specification...
790                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
791                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
# Line 708  bool qsamplerMainForm::saveSessionFile ( Line 817  bool qsamplerMainForm::saveSessionFile (
817                  }                  }
818                  // Audio device index/id mapping.                  // Audio device index/id mapping.
819                  audioDeviceMap[device.deviceID()] = iDevice;                  audioDeviceMap[device.deviceID()] = iDevice;
820          // Try to keep it snappy :)                  // Try to keep it snappy :)
821          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
822          }          }
823    
824          // MIDI device mapping.          // MIDI device mapping.
825          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap;
826          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
827          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
828                  ts << endl;                  ts << endl;
829                  qsamplerDevice device(this, qsamplerDevice::Midi, piDeviceIDs[iDevice]);                  qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);
830                  // MIDI device specification...                  // MIDI device specification...
831                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
832                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
# Line 748  bool qsamplerMainForm::saveSessionFile ( Line 858  bool qsamplerMainForm::saveSessionFile (
858                  }                  }
859                  // MIDI device index/id mapping.                  // MIDI device index/id mapping.
860                  midiDeviceMap[device.deviceID()] = iDevice;                  midiDeviceMap[device.deviceID()] = iDevice;
861          // Try to keep it snappy :)                  // Try to keep it snappy :)
862          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
863          }          }
864          ts << endl;          ts << endl;
865    
866    #ifdef CONFIG_MIDI_INSTRUMENT
867            // MIDI instrument mapping...
868            QMap<int, int> midiInstrumentMap;
869            int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient);
870            for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) {
871                    int iMidiMap = piMaps[iMap];
872                    const char *pszMapName
873                            = ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap);
874                    ts << "# " << tr("MIDI instrument map") << " " << iMap;
875                    if (pszMapName)
876                            ts << " - " << pszMapName;
877                    ts << endl;
878                    ts << "ADD MIDI_INSTRUMENT_MAP";
879                    if (pszMapName)
880                            ts << " '" << pszMapName << "'";
881                    ts << endl;
882                    // MIDI instrument mapping...
883                    lscp_midi_instrument_t *pInstrs
884                            = ::lscp_list_midi_instruments(m_pClient, iMidiMap);
885                    for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; iInstr++) {
886                            lscp_midi_instrument_info_t *pInstrInfo
887                                    = ::lscp_get_midi_instrument_info(m_pClient, &pInstrs[iInstr]);
888                            if (pInstrInfo) {
889                                    ts << "MAP MIDI_INSTRUMENT "
890                                            << iMap                        << " "
891                                            << pInstrs[iInstr].bank        << " "
892                                            << pInstrs[iInstr].prog        << " "
893                                            << pInstrInfo->engine_name     << " '"
894                                            << pInstrInfo->instrument_file << "' "
895                                            << pInstrInfo->instrument_nr   << " "
896                                            << pInstrInfo->volume          << " ";
897                                    switch (pInstrInfo->load_mode) {
898                                            case LSCP_LOAD_PERSISTENT:
899                                                    ts << "PERSISTENT";
900                                                    break;
901                                            case LSCP_LOAD_ON_DEMAND_HOLD:
902                                                    ts << "ON_DEMAND_HOLD";
903                                                    break;
904                                            case LSCP_LOAD_ON_DEMAND:
905                                            case LSCP_LOAD_DEFAULT:
906                                            default:
907                                                    ts << "ON_DEMAND";
908                                                    break;
909                                    }
910                                    if (pInstrInfo->name)
911                                            ts << " '" << pInstrInfo->name << "'";
912                                    ts << endl;
913                            }       // Check for errors...
914                            else if (::lscp_client_get_errno(m_pClient)) {
915                                    appendMessagesClient("lscp_get_midi_instrument_info");
916                                    iErrors++;
917                            }
918                            // Try to keep it snappy :)
919                            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
920                    }
921                    ts << endl;
922                    // Check for errors...
923                    if (pInstrs == NULL && ::lscp_client_get_errno(m_pClient)) {
924                            appendMessagesClient("lscp_list_midi_instruments");
925                            iErrors++;
926                    }
927                    // MIDI strument index/id mapping.
928                    midiInstrumentMap[iMidiMap] = iMap;
929            }
930            // Check for errors...
931            if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {
932                    appendMessagesClient("lscp_list_midi_instrument_maps");
933                    iErrors++;
934            }
935    #endif  // CONFIG_MIDI_INSTRUMENT
936    
937          // Sampler channel mapping.          // Sampler channel mapping.
938      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
939      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
940          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip
941                            = static_cast<qsamplerChannelStrip *> (wlist.at(iChannel));
942          if (pChannelStrip) {          if (pChannelStrip) {
943              qsamplerChannel *pChannel = pChannelStrip->channel();              qsamplerChannel *pChannel = pChannelStrip->channel();
944              if (pChannel) {              if (pChannel) {
# Line 784  bool qsamplerMainForm::saveSessionFile ( Line 967  bool qsamplerMainForm::saveSessionFile (
967                      ts << pChannel->midiChannel();                      ts << pChannel->midiChannel();
968                  ts << endl;                  ts << endl;
969                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;
970                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl;                                  if (pChannel->instrumentStatus() < 100) ts << "# ";
971                  ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl;                                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' "
972                  if (pChannel->channelMute())                                          << pChannel->instrumentNr() << " " << iChannel << endl;
973                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;                                  qsamplerChannelRoutingMap::ConstIterator audioRoute;
974                  if (pChannel->channelSolo())                                  for (audioRoute = pChannel->audioRouting().begin();
975                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;                                                  audioRoute != pChannel->audioRouting().end();
976                                                            ++audioRoute) {
977                                            ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel
978                                                    << " " << audioRoute.key()
979                                                    << " " << audioRoute.data() << endl;
980                                    }
981                                    ts << "SET CHANNEL VOLUME " << iChannel
982                                            << " " << pChannel->volume() << endl;
983                                    if (pChannel->channelMute())
984                                            ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;
985                                    if (pChannel->channelSolo())
986                                            ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;
987    #ifdef CONFIG_MIDI_INSTRUMENT
988                                    if (pChannel->midiMap() >= 0) {
989                                            ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel
990                                                    << " " << midiInstrumentMap[pChannel->midiMap()] << endl;
991                                    }
992    #endif
993    #ifdef CONFIG_FXSEND
994                                    int iChannelID = pChannel->channelID();
995                                    int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);
996                                    for (int iFxSend = 0;
997                                                    piFxSends && piFxSends[iFxSend] >= 0;
998                                                            iFxSend++) {
999                                            lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info(
1000                                                    m_pClient, iChannelID, piFxSends[iFxSend]);
1001                                            if (pFxSendInfo) {
1002                                                    ts << "CREATE FX_SEND " << iChannel
1003                                                            << " " << pFxSendInfo->midi_controller;
1004                                                    if (pFxSendInfo->name)
1005                                                            ts << " '" << pFxSendInfo->name << "'";
1006                                                    ts << endl;
1007                                                    int *piRouting = pFxSendInfo->audio_routing;
1008                                                    for (int iAudioSrc = 0;
1009                                                                    piRouting && piRouting[iAudioSrc] >= 0;
1010                                                                            iAudioSrc++) {
1011                                                            ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL "
1012                                                                    << iChannel
1013                                                                    << " " << iFxSend
1014                                                                    << " " << iAudioSrc
1015                                                                    << " " << piRouting[iAudioSrc] << endl;
1016                                                    }
1017    #ifdef CONFIG_FXSEND_LEVEL
1018                                                    ts << "SET FX_SEND LEVEL " << iChannel
1019                                                            << " " << iFxSend
1020                                                            << " " << pFxSendInfo->level << endl;                                                  
1021    #endif
1022                                            }       // Check for errors...
1023                                            else if (::lscp_client_get_errno(m_pClient)) {
1024                                                    appendMessagesClient("lscp_get_fxsend_info");
1025                                                    iErrors++;
1026                                            }
1027                                    }
1028    #endif
1029                  ts << endl;                  ts << endl;
1030              }              }
1031          }          }
# Line 797  bool qsamplerMainForm::saveSessionFile ( Line 1033  bool qsamplerMainForm::saveSessionFile (
1033          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1034      }      }
1035    
1036    #ifdef CONFIG_VOLUME
1037            ts << "# " << tr("Global volume level") << endl;
1038            ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;
1039            ts << endl;
1040    #endif
1041    
1042      // Ok. we've wrote it.      // Ok. we've wrote it.
1043      file.close();      file.close();
1044    
1045            // We're fornerly done.
1046            QApplication::restoreOverrideCursor();
1047    
1048      // Have we any errors?      // Have we any errors?
1049      if (iErrors > 0)      if (iErrors > 0)
1050          appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename));          appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename));
# Line 881  void qsamplerMainForm::fileReset (void) Line 1126  void qsamplerMainForm::fileReset (void)
1126          return;          return;
1127    
1128      // Ask user whether he/she want's an internal sampler reset...      // Ask user whether he/she want's an internal sampler reset...
1129      if (QMessageBox::warning(this, tr("Warning"),      if (QMessageBox::warning(this,
1130                    QSAMPLER_TITLE ": " + tr("Warning"),
1131          tr("Resetting the sampler instance will close\n"          tr("Resetting the sampler instance will close\n"
1132             "all device and channel configurations.\n\n"             "all device and channel configurations.\n\n"
1133             "Please note that this operation may cause\n"             "Please note that this operation may cause\n"
# Line 890  void qsamplerMainForm::fileReset (void) Line 1136  void qsamplerMainForm::fileReset (void)
1136          tr("Reset"), tr("Cancel")) > 0)          tr("Reset"), tr("Cancel")) > 0)
1137          return;          return;
1138    
1139            // Trye closing the current session, first...
1140            if (!closeSession(true))
1141                    return;
1142    
1143      // Just do the reset, after closing down current session...      // Just do the reset, after closing down current session...
1144      if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) {          // Do the actual sampler reset...
1145          appendMessagesClient("lscp_reset_sampler");          if (::lscp_reset_sampler(m_pClient) != LSCP_OK) {
1146          appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));                  appendMessagesClient("lscp_reset_sampler");
1147          return;                  appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
1148      }                  return;
1149            }
1150    
1151      // Log this.      // Log this.
1152      appendMessages(tr("Sampler reset."));      appendMessages(tr("Sampler reset."));
# Line 916  void qsamplerMainForm::fileRestart (void Line 1167  void qsamplerMainForm::fileRestart (void
1167      // Ask user whether he/she want's a complete restart...      // Ask user whether he/she want's a complete restart...
1168      // (if we're currently up and running)      // (if we're currently up and running)
1169      if (bRestart && m_pClient) {      if (bRestart && m_pClient) {
1170          bRestart = (QMessageBox::warning(this, tr("Warning"),          bRestart = (QMessageBox::warning(this,
1171                            QSAMPLER_TITLE ": " + tr("Warning"),
1172              tr("New settings will be effective after\n"              tr("New settings will be effective after\n"
1173                 "restarting the client/server connection.\n\n"                 "restarting the client/server connection.\n\n"
1174                 "Please note that this operation may cause\n"                 "Please note that this operation may cause\n"
# Line 953  void qsamplerMainForm::editAddChannel (v Line 1205  void qsamplerMainForm::editAddChannel (v
1205          return;          return;
1206    
1207      // Just create the channel instance...      // Just create the channel instance...
1208      qsamplerChannel *pChannel = new qsamplerChannel(this);      qsamplerChannel *pChannel = new qsamplerChannel();
1209      if (pChannel == NULL)      if (pChannel == NULL)
1210          return;          return;
1211    
# Line 992  void qsamplerMainForm::editRemoveChannel Line 1244  void qsamplerMainForm::editRemoveChannel
1244    
1245      // Prompt user if he/she's sure about this...      // Prompt user if he/she's sure about this...
1246      if (m_pOptions && m_pOptions->bConfirmRemove) {      if (m_pOptions && m_pOptions->bConfirmRemove) {
1247          if (QMessageBox::warning(this, tr("Warning"),          if (QMessageBox::warning(this,
1248                            QSAMPLER_TITLE ": " + tr("Warning"),
1249              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
1250                 "%1\n\n"                 "%1\n\n"
1251                 "Are you sure?")                 "Are you sure?")
# Line 1115  void qsamplerMainForm::viewMessages ( bo Line 1368  void qsamplerMainForm::viewMessages ( bo
1368  }  }
1369    
1370    
1371    // Show/hide the MIDI instrument list-view form.
1372    void qsamplerMainForm::viewInstruments (void)
1373    {
1374            if (m_pOptions == NULL)
1375                    return;
1376    
1377            if (m_pInstrumentListForm) {
1378                    m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
1379                    if (m_pInstrumentListForm->isVisible()) {
1380                            m_pInstrumentListForm->hide();
1381                    } else {
1382                            m_pInstrumentListForm->show();
1383                            m_pInstrumentListForm->raise();
1384                            m_pInstrumentListForm->setActiveWindow();
1385                    }
1386            }
1387    }
1388    
1389    
1390  // Show/hide the device configurator form.  // Show/hide the device configurator form.
1391  void qsamplerMainForm::viewDevices (void)  void qsamplerMainForm::viewDevices (void)
1392  {  {
# Line 1123  void qsamplerMainForm::viewDevices (void Line 1395  void qsamplerMainForm::viewDevices (void
1395    
1396          if (m_pDeviceForm) {          if (m_pDeviceForm) {
1397                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);
                 m_pDeviceForm->setClient(m_pClient);  
1398                  if (m_pDeviceForm->isVisible()) {                  if (m_pDeviceForm->isVisible()) {
1399                          m_pDeviceForm->hide();                          m_pDeviceForm->hide();
1400                  } else {                  } else {
# Line 1175  void qsamplerMainForm::viewOptions (void Line 1446  void qsamplerMainForm::viewOptions (void
1446                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1447                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1448                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {
1449                  QMessageBox::information(this, tr("Information"),                  QMessageBox::information(this,
1450                                            QSAMPLER_TITLE ": " + tr("Information"),
1451                      tr("Some settings may be only effective\n"                      tr("Some settings may be only effective\n"
1452                         "next time you start this program."), tr("OK"));                         "next time you start this program."), tr("OK"));
1453                  updateMessagesCapture();                  updateMessagesCapture();
# Line 1308  void qsamplerMainForm::helpAbout (void) Line 1580  void qsamplerMainForm::helpAbout (void)
1580      sText += tr("Sampler channel Mute/Solo support disabled.");      sText += tr("Sampler channel Mute/Solo support disabled.");
1581      sText += "</font></small><br />";      sText += "</font></small><br />";
1582  #endif  #endif
1583    #ifndef CONFIG_AUDIO_ROUTING
1584        sText += "<small><font color=\"red\">";
1585        sText += tr("LSCP (liblscp) audio_routing support disabled.");
1586        sText += "</font></small><br />";
1587    #endif
1588    #ifndef CONFIG_FXSEND
1589        sText += "<small><font color=\"red\">";
1590        sText += tr("Sampler channel Effect Sends support disabled.");
1591        sText += "</font></small><br />";
1592    #endif
1593    #ifndef CONFIG_VOLUME
1594        sText += "<small><font color=\"red\">";
1595        sText += tr("Global volume support disabled.");
1596        sText += "</font></small><br />";
1597    #endif
1598    #ifndef CONFIG_MIDI_INSTRUMENT
1599        sText += "<small><font color=\"red\">";
1600        sText += tr("MIDI instrument mapping support disabled.");
1601        sText += "</font></small><br />";
1602    #endif
1603      sText += "<br />\n";      sText += "<br />\n";
1604      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1605      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1343  void qsamplerMainForm::stabilizeForm (vo Line 1635  void qsamplerMainForm::stabilizeForm (vo
1635      // Update the main application caption...      // Update the main application caption...
1636      QString sSessionName = sessionName(m_sFilename);      QString sSessionName = sessionName(m_sFilename);
1637      if (m_iDirtyCount > 0)      if (m_iDirtyCount > 0)
1638          sSessionName += '*';          sSessionName += " *";
1639      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));
1640    
1641      // Update the main menu state...      // Update the main menu state...
# Line 1362  void qsamplerMainForm::stabilizeForm (vo Line 1654  void qsamplerMainForm::stabilizeForm (vo
1654      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1655      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
1656      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1657      viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());  #ifdef CONFIG_MIDI_INSTRUMENT
1658            viewInstrumentsAction->setOn(m_pInstrumentListForm
1659                    && m_pInstrumentListForm->isVisible());
1660            viewInstrumentsAction->setEnabled(bHasClient);
1661    #endif
1662            viewDevicesAction->setOn(m_pDeviceForm
1663                    && m_pDeviceForm->isVisible());
1664      viewDevicesAction->setEnabled(bHasClient);      viewDevicesAction->setEnabled(bHasClient);
1665      channelsArrangeAction->setEnabled(bHasChannel);      channelsArrangeAction->setEnabled(bHasChannel);
1666    
1667    #ifdef CONFIG_VOLUME
1668            // Toolbar widgets are also affected...
1669        m_pVolumeSlider->setEnabled(bHasClient);
1670        m_pVolumeSpinBox->setEnabled(bHasClient);
1671    #endif
1672    
1673      // Client/Server status...      // Client/Server status...
1674      if (bHasClient) {      if (bHasClient) {
1675          m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));          m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));
# Line 1394  void qsamplerMainForm::stabilizeForm (vo Line 1698  void qsamplerMainForm::stabilizeForm (vo
1698  }  }
1699    
1700    
1701    // Global volume change receiver slot.
1702    void qsamplerMainForm::volumeChanged ( int iVolume )
1703    {
1704    #ifdef CONFIG_VOLUME
1705    
1706            if (m_iVolumeChanging > 0)
1707                    return;
1708            
1709            m_iVolumeChanging++;
1710    
1711            // Update the toolbar widgets...
1712            if (m_pVolumeSlider->value() != iVolume)
1713                    m_pVolumeSlider->setValue(iVolume);
1714            if (m_pVolumeSpinBox->value() != iVolume)
1715                    m_pVolumeSpinBox->setValue(iVolume);
1716    
1717            // Do it as commanded...
1718            float fVolume = 0.01f * float(iVolume);
1719            if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK)
1720                    appendMessages(QObject::tr("Volume: %1.").arg(fVolume));
1721            else
1722                    appendMessagesClient("lscp_set_channel_volume");
1723    
1724            m_iVolumeChanging--;
1725    
1726            m_iDirtyCount++;
1727            stabilizeForm();
1728    
1729    #endif
1730    }
1731    
1732    
1733  // Channel change receiver slot.  // Channel change receiver slot.
1734  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )
1735  {  {
# Line 1413  void qsamplerMainForm::channelStripChang Line 1749  void qsamplerMainForm::channelStripChang
1749  // Grab and restore current sampler channels session.  // Grab and restore current sampler channels session.
1750  void qsamplerMainForm::updateSession (void)  void qsamplerMainForm::updateSession (void)
1751  {  {
1752    #ifdef CONFIG_VOLUME
1753            int iVolume = 100.0f * ::lscp_get_volume(m_pClient);
1754            m_iVolumeChanging++;
1755            m_pVolumeSlider->setValue(iVolume);
1756            m_pVolumeSpinBox->setValue(iVolume);
1757            m_iVolumeChanging--;
1758    #endif
1759    #ifdef CONFIG_MIDI_INSTRUMENT
1760            // FIXME: Make some room for default instrument maps...
1761            int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);
1762            if (iMaps < 0)
1763                    appendMessagesClient("lscp_get_midi_instrument_maps");
1764            else if (iMaps < 1) {
1765                    ::lscp_add_midi_instrument_map(m_pClient, tr("Chromatic").latin1());
1766                    ::lscp_add_midi_instrument_map(m_pClient, tr("Drum Kits").latin1());
1767            }
1768    #endif
1769    
1770          // Retrieve the current channel list.          // Retrieve the current channel list.
1771          int *piChannelIDs = ::lscp_list_channels(m_pClient);          int *piChannelIDs = ::lscp_list_channels(m_pClient);
1772          if (piChannelIDs == NULL) {          if (piChannelIDs == NULL) {
# Line 1420  void qsamplerMainForm::updateSession (vo Line 1774  void qsamplerMainForm::updateSession (vo
1774                          appendMessagesClient("lscp_list_channels");                          appendMessagesClient("lscp_list_channels");
1775                          appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));                          appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));
1776                  }                  }
1777                  return;          } else {
1778                    // Try to (re)create each channel.
1779                    m_pWorkspace->setUpdatesEnabled(false);
1780                    for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1781                            // Check if theres already a channel strip for this one...
1782                            if (!channelStrip(piChannelIDs[iChannel]))
1783                                    createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));
1784                    }
1785                    m_pWorkspace->setUpdatesEnabled(true);
1786          }          }
1787    
1788          // Try to (re)create each channel.      // Do we auto-arrange?
1789          m_pWorkspace->setUpdatesEnabled(false);      if (m_pOptions && m_pOptions->bAutoArrange)
1790          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {          channelsArrange();
1791                  // Check if theres already a channel strip for this one...  
1792                  if (!channelStrip(piChannelIDs[iChannel]))          // Remember to refresh devices and instruments...
1793                          createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));          if (m_pInstrumentListForm)
1794                  // Make it visibly responsive...              m_pInstrumentListForm->refreshInstruments();
                 QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);  
         }  
         m_pWorkspace->setUpdatesEnabled(true);  
           
         // Remember to refresh devices  
1795          if (m_pDeviceForm)          if (m_pDeviceForm)
1796              m_pDeviceForm->refreshDevices();              m_pDeviceForm->refreshDevices();
1797  }  }
# Line 1559  void qsamplerMainForm::updateMaxVolume ( Line 1916  void qsamplerMainForm::updateMaxVolume (
1916      if (m_pOptions == NULL)      if (m_pOptions == NULL)
1917          return;          return;
1918    
1919    #ifdef CONFIG_VOLUME
1920            m_iVolumeChanging++;
1921            m_pVolumeSlider->setMaxValue(m_pOptions->iMaxVolume);
1922            m_pVolumeSpinBox->setMaxValue(m_pOptions->iMaxVolume);
1923            m_iVolumeChanging--;
1924    #endif
1925    
1926      // Full channel list update...      // Full channel list update...
1927      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1928      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1607  void qsamplerMainForm::appendMessagesErr Line 1971  void qsamplerMainForm::appendMessagesErr
1971    
1972      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");
1973    
1974      QMessageBox::critical(this, tr("Error"), s, tr("Cancel"));          // Make it look responsive...:)
1975            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1976    
1977        QMessageBox::critical(this,
1978                    QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));
1979  }  }
1980    
1981    
# Line 1620  void qsamplerMainForm::appendMessagesCli Line 1988  void qsamplerMainForm::appendMessagesCli
1988      appendMessagesColor(s + QString(": %1 (errno=%2)")      appendMessagesColor(s + QString(": %1 (errno=%2)")
1989          .arg(::lscp_client_get_result(m_pClient))          .arg(::lscp_client_get_result(m_pClient))
1990          .arg(::lscp_client_get_errno(m_pClient)), "#996666");          .arg(::lscp_client_get_errno(m_pClient)), "#996666");
1991    
1992            // Make it look responsive...:)
1993            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1994  }  }
1995    
1996    
# Line 1694  qsamplerChannelStrip *qsamplerMainForm:: Line 2065  qsamplerChannelStrip *qsamplerMainForm::
2065    
2066      // Actual channel strip setup...      // Actual channel strip setup...
2067      pChannelStrip->setup(pChannel);      pChannelStrip->setup(pChannel);
2068      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));          QObject::connect(pChannelStrip,
2069                    SIGNAL(channelChanged(qsamplerChannelStrip *)),
2070                    SLOT(channelStripChanged(qsamplerChannelStrip *)));
2071      // Set some initial aesthetic options...      // Set some initial aesthetic options...
2072      if (m_pOptions) {      if (m_pOptions) {
2073          // Background display effect...          // Background display effect...
# Line 1879  void qsamplerMainForm::startServer (void Line 2252  void qsamplerMainForm::startServer (void
2252    
2253      // Is the server process instance still here?      // Is the server process instance still here?
2254      if (m_pServer) {      if (m_pServer) {
2255          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this,
2256                            QSAMPLER_TITLE ": " + tr("Warning"),
2257              tr("Could not start the LinuxSampler server.\n\n"              tr("Could not start the LinuxSampler server.\n\n"
2258                 "Maybe it ss already started."),                 "Maybe it ss already started."),
2259              tr("Stop"), tr("Kill"), tr("Cancel"))) {              tr("Stop"), tr("Kill"), tr("Cancel"))) {
# Line 1900  void qsamplerMainForm::startServer (void Line 2274  void qsamplerMainForm::startServer (void
2274      m_pServer = new QProcess(this);      m_pServer = new QProcess(this);
2275    
2276      // Setup stdout/stderr capture...      // Setup stdout/stderr capture...
2277      //if (m_pOptions->bStdoutCapture) {          //      if (m_pOptions->bStdoutCapture) {
2278          m_pServer->setCommunication(QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr);                  m_pServer->setCommunication(
2279          QObject::connect(m_pServer, SIGNAL(readyReadStdout()), this, SLOT(readServerStdout()));                          QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr);
2280          QObject::connect(m_pServer, SIGNAL(readyReadStderr()), this, SLOT(readServerStdout()));                  QObject::connect(m_pServer,
2281      //}                          SIGNAL(readyReadStdout()),
2282      // The unforgiveable signal communication...                          SLOT(readServerStdout()));
2283      QObject::connect(m_pServer, SIGNAL(processExited()), this, SLOT(processServerExit()));                  QObject::connect(m_pServer,
2284                            SIGNAL(readyReadStderr()),
2285                            SLOT(readServerStdout()));
2286            //      }
2287            // The unforgiveable signal communication...
2288            QObject::connect(m_pServer,
2289                    SIGNAL(processExited()),
2290                    SLOT(processServerExit()));
2291    
2292      // Build process arguments...      // Build process arguments...
2293      m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine));      m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine));
# Line 2051  bool qsamplerMainForm::startClient (void Line 2432  bool qsamplerMainForm::startClient (void
2432      // Log success here.      // Log success here.
2433      appendMessages(tr("Client connected."));      appendMessages(tr("Client connected."));
2434    
2435          // Hard-notify device configuration form,          // Hard-notify instrumnet and device configuration forms,
2436          // if visible, that we're ready...          // if visible, that we're ready...
2437          if (m_pDeviceForm && m_pDeviceForm->isVisible())          if (m_pInstrumentListForm)
2438              m_pDeviceForm->setClient(m_pClient);              m_pInstrumentListForm->refreshInstruments();
2439            if (m_pDeviceForm)
2440                m_pDeviceForm->refreshDevices();
2441    
2442      // Is any session pending to be loaded?      // Is any session pending to be loaded?
2443      if (!m_pOptions->sSessionFile.isEmpty()) {      if (!m_pOptions->sSessionFile.isEmpty()) {
# Line 2076  void qsamplerMainForm::stopClient (void) Line 2459  void qsamplerMainForm::stopClient (void)
2459      if (m_pClient == NULL)      if (m_pClient == NULL)
2460          return;          return;
2461    
         // Hard-notify device configuration form,  
         // if visible, that we're running out...  
         if (m_pDeviceForm && m_pDeviceForm->isVisible())  
             m_pDeviceForm->setClient(NULL);  
   
2462      // Log prepare here.      // Log prepare here.
2463      appendMessages(tr("Client disconnecting..."));      appendMessages(tr("Client disconnecting..."));
2464    
# Line 2101  void qsamplerMainForm::stopClient (void) Line 2479  void qsamplerMainForm::stopClient (void)
2479      ::lscp_client_destroy(m_pClient);      ::lscp_client_destroy(m_pClient);
2480      m_pClient = NULL;      m_pClient = NULL;
2481    
2482            // Hard-notify instrumnet and device configuration forms,
2483            // if visible, that we're running out...
2484            if (m_pInstrumentListForm)
2485                m_pInstrumentListForm->refreshInstruments();
2486            if (m_pDeviceForm)
2487                m_pDeviceForm->refreshDevices();
2488    
2489      // Log final here.      // Log final here.
2490      appendMessages(tr("Client disconnected."));      appendMessages(tr("Client disconnected."));
2491    

Legend:
Removed from v.753  
changed lines
  Added in v.1034

  ViewVC Help
Powered by ViewVC