/[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 986 by capela, Mon Dec 18 16:51:50 2006 UTC revision 1372 by capela, Wed Oct 3 11:34:30 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-2006, 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 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 55  Line 58 
58  #include <gig.h>  #include <gig.h>
59  #endif  #endif
60    
61    // Needed for lroundf()
62    #include <math.h>
63    
64    #ifndef CONFIG_ROUND
65    static inline long lroundf ( float x )
66    {
67            if (x >= 0.0f)
68                    return long(x + 0.5f);
69            else
70                    return long(x - 0.5f);
71    }
72    #endif
73    
74  // Timer constant stuff.  // Timer constant stuff.
75  #define QSAMPLER_TIMER_MSECS    200  #define QSAMPLER_TIMER_MSECS    200
76    
# Line 139  void qsamplerMainForm::init (void) Line 155  void qsamplerMainForm::init (void)
155          ::signal(SIGPIPE, SIG_IGN);          ::signal(SIGPIPE, SIG_IGN);
156  #endif  #endif
157    
158    #ifdef CONFIG_VOLUME
159        // Make some extras into the toolbar...
160            const QString& sVolumeText = tr("Master volume");
161            m_iVolumeChanging = 0;
162            // Volume slider...
163            channelsToolbar->addSeparator();
164            m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar);
165            m_pVolumeSlider->setTickmarks(QSlider::Below);
166            m_pVolumeSlider->setTickInterval(10);
167            m_pVolumeSlider->setPageStep(10);
168            m_pVolumeSlider->setRange(0, 100);
169            m_pVolumeSlider->setMaximumHeight(22);
170            m_pVolumeSlider->setMinimumWidth(160);
171            QToolTip::add(m_pVolumeSlider, sVolumeText);
172            QObject::connect(m_pVolumeSlider,
173                    SIGNAL(valueChanged(int)),
174                    SLOT(volumeChanged(int)));
175            channelsToolbar->setHorizontallyStretchable(true);
176            channelsToolbar->setStretchableWidget(m_pVolumeSlider);
177            // Volume spin-box
178            channelsToolbar->addSeparator();
179            m_pVolumeSpinBox = new QSpinBox(channelsToolbar);
180            m_pVolumeSpinBox->setSuffix(" %");
181            m_pVolumeSpinBox->setRange(0, 100);
182            QToolTip::add(m_pVolumeSpinBox, sVolumeText);
183            QObject::connect(m_pVolumeSpinBox,
184                    SIGNAL(valueChanged(int)),
185                    SLOT(volumeChanged(int)));
186    #endif
187    
188      // Make it an MDI workspace.      // Make it an MDI workspace.
189      m_pWorkspace = new QWorkspace(this);      m_pWorkspace = new QWorkspace(this);
190      m_pWorkspace->setScrollBarsEnabled(true);      m_pWorkspace->setScrollBarsEnabled(true);
191      // Set the activation connection.          // Set the activation connection.
192      QObject::connect(m_pWorkspace, SIGNAL(windowActivated(QWidget *)), this, SLOT(stabilizeForm()));          QObject::connect(m_pWorkspace,
193                    SIGNAL(windowActivated(QWidget *)),
194                    SLOT(stabilizeForm()));
195      // Make it shine :-)      // Make it shine :-)
196      setCentralWidget(m_pWorkspace);      setCentralWidget(m_pWorkspace);
197    
# Line 213  void qsamplerMainForm::destroy (void) Line 261  void qsamplerMainForm::destroy (void)
261      if (m_statusItem[QSAMPLER_STATUS_SESSION])      if (m_statusItem[QSAMPLER_STATUS_SESSION])
262          delete m_statusItem[QSAMPLER_STATUS_SESSION];          delete m_statusItem[QSAMPLER_STATUS_SESSION];
263    
264    #ifdef CONFIG_VOLUME
265            delete m_pVolumeSpinBox;
266            delete m_pVolumeSlider;
267    #endif
268    
269      // Delete recentfiles menu.      // Delete recentfiles menu.
270      if (m_pRecentFilesMenu)      if (m_pRecentFilesMenu)
271          delete m_pRecentFilesMenu;          delete m_pRecentFilesMenu;
# Line 253  void qsamplerMainForm::setup ( qsamplerO Line 306  void qsamplerMainForm::setup ( qsamplerO
306      updateMessagesLimit();      updateMessagesLimit();
307      updateMessagesCapture();      updateMessagesCapture();
308      // Set the visibility signal.      // Set the visibility signal.
309      QObject::connect(m_pMessages,          QObject::connect(m_pMessages,
310                  SIGNAL(visibilityChanged(bool)),                  SIGNAL(visibilityChanged(bool)),
311                  SLOT(stabilizeForm()));                  SLOT(stabilizeForm()));
312    
# Line 284  void qsamplerMainForm::setup ( qsamplerO Line 337  void qsamplerMainForm::setup ( qsamplerO
337      m_pOptions->loadWidgetGeometry(m_pDeviceForm);      m_pOptions->loadWidgetGeometry(m_pDeviceForm);
338    
339      // Final startup stabilization...      // Final startup stabilization...
340        updateMaxVolume();
341      updateRecentFilesMenu();      updateRecentFilesMenu();
342      stabilizeForm();      stabilizeForm();
343    
# Line 404  void qsamplerMainForm::dropEvent ( QDrop Line 458  void qsamplerMainForm::dropEvent ( QDrop
458                          m_iDirtyCount++;                          m_iDirtyCount++;
459                          stabilizeForm();                          stabilizeForm();
460                  }   // Otherwise, load an usual session file (LSCP script)...                  }   // Otherwise, load an usual session file (LSCP script)...
461                  else if (closeSession(true))                  else if (closeSession(true)) {
462                          loadSessionFile(sPath);                          loadSessionFile(sPath);
463                            break;
464                    }
465                  // Make it look responsive...:)                  // Make it look responsive...:)
466                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
467          }          }
# Line 636  bool qsamplerMainForm::loadSessionFile ( Line 692  bool qsamplerMainForm::loadSessionFile (
692          return false;          return false;
693      }      }
694    
695            // Tell the world we'll take some time...
696            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
697    
698      // Read the file.      // Read the file.
699            int iLine = 0;
700      int iErrors = 0;      int iErrors = 0;
701      QTextStream ts(&file);      QTextStream ts(&file);
702      while (!ts.atEnd()) {      while (!ts.atEnd()) {
703          // Read the line.          // Read the line.
704          QString sCommand = ts.readLine().stripWhiteSpace();          QString sCommand = ts.readLine().stripWhiteSpace();
705                    iLine++;
706          // If not empty, nor a comment, call the server...          // If not empty, nor a comment, call the server...
707          if (!sCommand.isEmpty() && sCommand[0] != '#') {          if (!sCommand.isEmpty() && sCommand[0] != '#') {
708              appendMessagesColor(sCommand, "#996633");                          // Remember that, no matter what,
709              // Remember that, no matter what,                          // all LSCP commands are CR/LF terminated.
710              // all LSCP commands are CR/LF terminated.                          sCommand += "\r\n";
711              sCommand += "\r\n";                          if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
712              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {                                  appendMessagesColor(QString("%1(%2): %3")
713                  appendMessagesClient("lscp_client_query");                                          .arg(QFileInfo(sFilename).fileName()).arg(iLine)
714                  iErrors++;                                          .arg(sCommand.simplifyWhiteSpace()), "#996633");
715              }                                  appendMessagesClient("lscp_client_query");
716                                    iErrors++;
717                            }
718          }          }
719          // Try to make it snappy :)          // Try to make it snappy :)
720          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
# Line 663  bool qsamplerMainForm::loadSessionFile ( Line 726  bool qsamplerMainForm::loadSessionFile (
726          // Now we'll try to create (update) the whole GUI session.          // Now we'll try to create (update) the whole GUI session.
727          updateSession();          updateSession();
728    
729            // We're fornerly done.
730            QApplication::restoreOverrideCursor();
731    
732          // Have we any errors?          // Have we any errors?
733          if (iErrors > 0)          if (iErrors > 0)
734                  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 702  bool qsamplerMainForm::saveSessionFile ( Line 768  bool qsamplerMainForm::saveSessionFile (
768          return false;          return false;
769      }      }
770    
771            // Tell the world we'll take some time...
772            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
773    
774      // Write the file.      // Write the file.
775      int  iErrors = 0;      int  iErrors = 0;
776      QTextStream ts(&file);      QTextStream ts(&file);
# Line 855  bool qsamplerMainForm::saveSessionFile ( Line 924  bool qsamplerMainForm::saveSessionFile (
924                                  if (pInstrInfo->name)                                  if (pInstrInfo->name)
925                                          ts << " '" << pInstrInfo->name << "'";                                          ts << " '" << pInstrInfo->name << "'";
926                                  ts << endl;                                  ts << endl;
927                            }       // Check for errors...
928                            else if (::lscp_client_get_errno(m_pClient)) {
929                                    appendMessagesClient("lscp_get_midi_instrument_info");
930                                    iErrors++;
931                          }                          }
                         // MIDI device index/id mapping.  
                         midiInstrumentMap[iMidiMap] = iMap;  
932                          // Try to keep it snappy :)                          // Try to keep it snappy :)
933                          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
934                  }                  }
935                  if (pInstrs)                  ts << endl;
936                          ts << endl;                  // Check for errors...
937                    if (pInstrs == NULL && ::lscp_client_get_errno(m_pClient)) {
938                            appendMessagesClient("lscp_list_midi_instruments");
939                            iErrors++;
940                    }
941                    // MIDI strument index/id mapping.
942                    midiInstrumentMap[iMidiMap] = iMap;
943            }
944            // Check for errors...
945            if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {
946                    appendMessagesClient("lscp_list_midi_instrument_maps");
947                    iErrors++;
948          }          }
949  #endif //  CONFIG_MIDI_INSTRUMENT  #endif  // CONFIG_MIDI_INSTRUMENT
950    
951          // Sampler channel mapping.          // Sampler channel mapping.
952      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
953      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
954          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip
955                            = static_cast<qsamplerChannelStrip *> (wlist.at(iChannel));
956          if (pChannelStrip) {          if (pChannelStrip) {
957              qsamplerChannel *pChannel = pChannelStrip->channel();              qsamplerChannel *pChannel = pChannelStrip->channel();
958              if (pChannel) {              if (pChannel) {
# Line 921  bool qsamplerMainForm::saveSessionFile ( Line 1004  bool qsamplerMainForm::saveSessionFile (
1004                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;
1005                                  }                                  }
1006  #endif  #endif
1007    #ifdef CONFIG_FXSEND
1008                                    int iChannelID = pChannel->channelID();
1009                                    int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);
1010                                    for (int iFxSend = 0;
1011                                                    piFxSends && piFxSends[iFxSend] >= 0;
1012                                                            iFxSend++) {
1013                                            lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info(
1014                                                    m_pClient, iChannelID, piFxSends[iFxSend]);
1015                                            if (pFxSendInfo) {
1016                                                    ts << "CREATE FX_SEND " << iChannel
1017                                                            << " " << pFxSendInfo->midi_controller;
1018                                                    if (pFxSendInfo->name)
1019                                                            ts << " '" << pFxSendInfo->name << "'";
1020                                                    ts << endl;
1021                                                    int *piRouting = pFxSendInfo->audio_routing;
1022                                                    for (int iAudioSrc = 0;
1023                                                                    piRouting && piRouting[iAudioSrc] >= 0;
1024                                                                            iAudioSrc++) {
1025                                                            ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL "
1026                                                                    << iChannel
1027                                                                    << " " << iFxSend
1028                                                                    << " " << iAudioSrc
1029                                                                    << " " << piRouting[iAudioSrc] << endl;
1030                                                    }
1031    #ifdef CONFIG_FXSEND_LEVEL
1032                                                    ts << "SET FX_SEND LEVEL " << iChannel
1033                                                            << " " << iFxSend
1034                                                            << " " << pFxSendInfo->level << endl;                                                  
1035    #endif
1036                                            }       // Check for errors...
1037                                            else if (::lscp_client_get_errno(m_pClient)) {
1038                                                    appendMessagesClient("lscp_get_fxsend_info");
1039                                                    iErrors++;
1040                                            }
1041                                    }
1042    #endif
1043                  ts << endl;                  ts << endl;
1044              }              }
1045          }          }
# Line 928  bool qsamplerMainForm::saveSessionFile ( Line 1047  bool qsamplerMainForm::saveSessionFile (
1047          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1048      }      }
1049    
1050    #ifdef CONFIG_VOLUME
1051            ts << "# " << tr("Global volume level") << endl;
1052            ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;
1053            ts << endl;
1054    #endif
1055    
1056      // Ok. we've wrote it.      // Ok. we've wrote it.
1057      file.close();      file.close();
1058    
1059            // We're fornerly done.
1060            QApplication::restoreOverrideCursor();
1061    
1062      // Have we any errors?      // Have we any errors?
1063      if (iErrors > 0)      if (iErrors > 0)
1064          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 1022  void qsamplerMainForm::fileReset (void) Line 1150  void qsamplerMainForm::fileReset (void)
1150          tr("Reset"), tr("Cancel")) > 0)          tr("Reset"), tr("Cancel")) > 0)
1151          return;          return;
1152    
1153            // Trye closing the current session, first...
1154            if (!closeSession(true))
1155                    return;
1156    
1157      // Just do the reset, after closing down current session...      // Just do the reset, after closing down current session...
1158      if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) {          // Do the actual sampler reset...
1159          appendMessagesClient("lscp_reset_sampler");          if (::lscp_reset_sampler(m_pClient) != LSCP_OK) {
1160          appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));                  appendMessagesClient("lscp_reset_sampler");
1161          return;                  appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
1162      }                  return;
1163            }
1164    
1165      // Log this.      // Log this.
1166      appendMessages(tr("Sampler reset."));      appendMessages(tr("Sampler reset."));
# Line 1167  void qsamplerMainForm::editSetupChannel Line 1300  void qsamplerMainForm::editSetupChannel
1300  }  }
1301    
1302    
1303    // Edit current sampler channel.
1304    void qsamplerMainForm::editEditChannel (void)
1305    {
1306        if (m_pClient == NULL)
1307            return;
1308    
1309        qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1310        if (pChannelStrip == NULL)
1311            return;
1312    
1313        // Just invoque the channel strip procedure.
1314        pChannelStrip->channelEdit();
1315    }
1316    
1317    
1318  // Reset current sampler channel.  // Reset current sampler channel.
1319  void qsamplerMainForm::editResetChannel (void)  void qsamplerMainForm::editResetChannel (void)
1320  {  {
# Line 1461  void qsamplerMainForm::helpAbout (void) Line 1609  void qsamplerMainForm::helpAbout (void)
1609      sText += tr("Sampler channel Mute/Solo support disabled.");      sText += tr("Sampler channel Mute/Solo support disabled.");
1610      sText += "</font></small><br />";      sText += "</font></small><br />";
1611  #endif  #endif
1612    #ifndef CONFIG_AUDIO_ROUTING
1613        sText += "<small><font color=\"red\">";
1614        sText += tr("LSCP (liblscp) audio_routing support disabled.");
1615        sText += "</font></small><br />";
1616    #endif
1617    #ifndef CONFIG_FXSEND
1618        sText += "<small><font color=\"red\">";
1619        sText += tr("Sampler channel Effect Sends support disabled.");
1620        sText += "</font></small><br />";
1621    #endif
1622    #ifndef CONFIG_VOLUME
1623        sText += "<small><font color=\"red\">";
1624        sText += tr("Global volume support disabled.");
1625        sText += "</font></small><br />";
1626    #endif
1627  #ifndef CONFIG_MIDI_INSTRUMENT  #ifndef CONFIG_MIDI_INSTRUMENT
1628      sText += "<small><font color=\"red\">";      sText += "<small><font color=\"red\">";
1629      sText += tr("MIDI instrument mapping support disabled.");      sText += tr("MIDI instrument mapping support disabled.");
1630      sText += "</font></small><br />";      sText += "</font></small><br />";
1631  #endif  #endif
1632    #ifndef CONFIG_EDIT_INSTRUMENT
1633        sText += "<small><font color=\"red\">";
1634        sText += tr("Instrument editing support disabled.");
1635        sText += "</font></small><br />";
1636    #endif
1637      sText += "<br />\n";      sText += "<br />\n";
1638      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1639      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1517  void qsamplerMainForm::stabilizeForm (vo Line 1685  void qsamplerMainForm::stabilizeForm (vo
1685      editAddChannelAction->setEnabled(bHasClient);      editAddChannelAction->setEnabled(bHasClient);
1686      editRemoveChannelAction->setEnabled(bHasChannel);      editRemoveChannelAction->setEnabled(bHasChannel);
1687      editSetupChannelAction->setEnabled(bHasChannel);      editSetupChannelAction->setEnabled(bHasChannel);
1688    #ifdef CONFIG_EDIT_INSTRUMENT
1689        editEditChannelAction->setEnabled(bHasChannel);
1690    #else
1691        editEditChannelAction->setEnabled(false);
1692    #endif
1693      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1694      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
1695      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
# Line 1524  void qsamplerMainForm::stabilizeForm (vo Line 1697  void qsamplerMainForm::stabilizeForm (vo
1697          viewInstrumentsAction->setOn(m_pInstrumentListForm          viewInstrumentsAction->setOn(m_pInstrumentListForm
1698                  && m_pInstrumentListForm->isVisible());                  && m_pInstrumentListForm->isVisible());
1699          viewInstrumentsAction->setEnabled(bHasClient);          viewInstrumentsAction->setEnabled(bHasClient);
1700    #else
1701            viewInstrumentsAction->setEnabled(false);
1702  #endif  #endif
1703          viewDevicesAction->setOn(m_pDeviceForm          viewDevicesAction->setOn(m_pDeviceForm
1704                  && m_pDeviceForm->isVisible());                  && m_pDeviceForm->isVisible());
1705      viewDevicesAction->setEnabled(bHasClient);      viewDevicesAction->setEnabled(bHasClient);
1706      channelsArrangeAction->setEnabled(bHasChannel);      channelsArrangeAction->setEnabled(bHasChannel);
1707    
1708    #ifdef CONFIG_VOLUME
1709            // Toolbar widgets are also affected...
1710        m_pVolumeSlider->setEnabled(bHasClient);
1711        m_pVolumeSpinBox->setEnabled(bHasClient);
1712    #endif
1713    
1714      // Client/Server status...      // Client/Server status...
1715      if (bHasClient) {      if (bHasClient) {
1716          m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));          m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));
# Line 1558  void qsamplerMainForm::stabilizeForm (vo Line 1739  void qsamplerMainForm::stabilizeForm (vo
1739  }  }
1740    
1741    
1742    // Global volume change receiver slot.
1743    void qsamplerMainForm::volumeChanged ( int iVolume )
1744    {
1745    #ifdef CONFIG_VOLUME
1746    
1747            if (m_iVolumeChanging > 0)
1748                    return;
1749            
1750            m_iVolumeChanging++;
1751    
1752            // Update the toolbar widgets...
1753            if (m_pVolumeSlider->value()  != iVolume)
1754                    m_pVolumeSlider->setValue(iVolume);
1755            if (m_pVolumeSpinBox->value() != iVolume)
1756                    m_pVolumeSpinBox->setValue(iVolume);
1757    
1758            // Do it as commanded...
1759            float fVolume = 0.01f * float(iVolume);
1760            if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK)
1761                    appendMessages(QObject::tr("Volume: %1.").arg(fVolume));
1762            else
1763                    appendMessagesClient("lscp_set_volume");
1764    
1765            m_iVolumeChanging--;
1766    
1767            m_iDirtyCount++;
1768            stabilizeForm();
1769    
1770    #endif
1771    }
1772    
1773    
1774  // Channel change receiver slot.  // Channel change receiver slot.
1775  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )
1776  {  {
# Line 1577  void qsamplerMainForm::channelStripChang Line 1790  void qsamplerMainForm::channelStripChang
1790  // Grab and restore current sampler channels session.  // Grab and restore current sampler channels session.
1791  void qsamplerMainForm::updateSession (void)  void qsamplerMainForm::updateSession (void)
1792  {  {
1793    #ifdef CONFIG_VOLUME
1794            int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient));
1795            m_iVolumeChanging++;
1796            m_pVolumeSlider->setValue(iVolume);
1797            m_pVolumeSpinBox->setValue(iVolume);
1798            m_iVolumeChanging--;
1799    #endif
1800  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
1801          // FIXME Make some room for default instrument maps...          // FIXME: Make some room for default instrument maps...
1802          int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);          int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);
1803          if (iMaps < 0)          if (iMaps < 0)
1804                  appendMessagesClient("lscp_get_midi_instrument_maps");                  appendMessagesClient("lscp_get_midi_instrument_maps");
# Line 1595  void qsamplerMainForm::updateSession (vo Line 1815  void qsamplerMainForm::updateSession (vo
1815                          appendMessagesClient("lscp_list_channels");                          appendMessagesClient("lscp_list_channels");
1816                          appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));                          appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));
1817                  }                  }
1818                  return;          } else {
1819                    // Try to (re)create each channel.
1820                    m_pWorkspace->setUpdatesEnabled(false);
1821                    for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1822                            // Check if theres already a channel strip for this one...
1823                            if (!channelStrip(piChannelIDs[iChannel]))
1824                                    createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));
1825                    }
1826                    m_pWorkspace->setUpdatesEnabled(true);
1827          }          }
1828    
1829          // Try to (re)create each channel.      // Do we auto-arrange?
1830          m_pWorkspace->setUpdatesEnabled(false);      if (m_pOptions && m_pOptions->bAutoArrange)
1831          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {          channelsArrange();
                 // Check if theres already a channel strip for this one...  
                 if (!channelStrip(piChannelIDs[iChannel]))  
                         createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));  
                 // Make it visibly responsive...  
                 QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);  
         }  
         m_pWorkspace->setUpdatesEnabled(true);  
1832    
1833          // Remember to refresh devices and instruments...          // Remember to refresh devices and instruments...
1834          if (m_pInstrumentListForm)          if (m_pInstrumentListForm)
# Line 1736  void qsamplerMainForm::updateMaxVolume ( Line 1957  void qsamplerMainForm::updateMaxVolume (
1957      if (m_pOptions == NULL)      if (m_pOptions == NULL)
1958          return;          return;
1959    
1960    #ifdef CONFIG_VOLUME
1961            m_iVolumeChanging++;
1962            m_pVolumeSlider->setMaxValue(m_pOptions->iMaxVolume);
1963            m_pVolumeSpinBox->setMaxValue(m_pOptions->iMaxVolume);
1964            m_iVolumeChanging--;
1965    #endif
1966    
1967      // Full channel list update...      // Full channel list update...
1968      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1969      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1784  void qsamplerMainForm::appendMessagesErr Line 2012  void qsamplerMainForm::appendMessagesErr
2012    
2013      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");
2014    
2015            // Make it look responsive...:)
2016            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
2017    
2018      QMessageBox::critical(this,      QMessageBox::critical(this,
2019                  QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));                  QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));
2020  }  }
# Line 1798  void qsamplerMainForm::appendMessagesCli Line 2029  void qsamplerMainForm::appendMessagesCli
2029      appendMessagesColor(s + QString(": %1 (errno=%2)")      appendMessagesColor(s + QString(": %1 (errno=%2)")
2030          .arg(::lscp_client_get_result(m_pClient))          .arg(::lscp_client_get_result(m_pClient))
2031          .arg(::lscp_client_get_errno(m_pClient)), "#996666");          .arg(::lscp_client_get_errno(m_pClient)), "#996666");
2032    
2033            // Make it look responsive...:)
2034            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
2035  }  }
2036    
2037    
# Line 1872  qsamplerChannelStrip *qsamplerMainForm:: Line 2106  qsamplerChannelStrip *qsamplerMainForm::
2106    
2107      // Actual channel strip setup...      // Actual channel strip setup...
2108      pChannelStrip->setup(pChannel);      pChannelStrip->setup(pChannel);
2109      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));          QObject::connect(pChannelStrip,
2110                    SIGNAL(channelChanged(qsamplerChannelStrip *)),
2111                    SLOT(channelStripChanged(qsamplerChannelStrip *)));
2112      // Set some initial aesthetic options...      // Set some initial aesthetic options...
2113      if (m_pOptions) {      if (m_pOptions) {
2114          // Background display effect...          // Background display effect...
# Line 2079  void qsamplerMainForm::startServer (void Line 2315  void qsamplerMainForm::startServer (void
2315      m_pServer = new QProcess(this);      m_pServer = new QProcess(this);
2316    
2317      // Setup stdout/stderr capture...      // Setup stdout/stderr capture...
2318      //if (m_pOptions->bStdoutCapture) {          //      if (m_pOptions->bStdoutCapture) {
2319          m_pServer->setCommunication(QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr);                  m_pServer->setCommunication(
2320          QObject::connect(m_pServer, SIGNAL(readyReadStdout()), this, SLOT(readServerStdout()));                          QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr);
2321          QObject::connect(m_pServer, SIGNAL(readyReadStderr()), this, SLOT(readServerStdout()));                  QObject::connect(m_pServer,
2322      //}                          SIGNAL(readyReadStdout()),
2323      // The unforgiveable signal communication...                          SLOT(readServerStdout()));
2324      QObject::connect(m_pServer, SIGNAL(processExited()), this, SLOT(processServerExit()));                  QObject::connect(m_pServer,
2325                            SIGNAL(readyReadStderr()),
2326                            SLOT(readServerStdout()));
2327            //      }
2328            // The unforgiveable signal communication...
2329            QObject::connect(m_pServer,
2330                    SIGNAL(processExited()),
2331                    SLOT(processServerExit()));
2332    
2333      // Build process arguments...      // Build process arguments...
2334      m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine));      m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine));

Legend:
Removed from v.986  
changed lines
  Added in v.1372

  ViewVC Help
Powered by ViewVC