/[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 395 by capela, Sun Feb 20 19:13:33 2005 UTC revision 409 by capela, Thu Feb 24 12:10:54 2005 UTC
# Line 108  void qsamplerMainForm::init (void) Line 108  void qsamplerMainForm::init (void)
108      m_pMessages = NULL;      m_pMessages = NULL;
109    
110      // We'll start clean.      // We'll start clean.
111      m_iUntitled    = 0;      m_iUntitled   = 0;
112      m_iDirtyCount  = 0;      m_iDirtyCount = 0;
     m_iChangeCount = 0;  
113    
114      m_pServer = NULL;      m_pServer = NULL;
115      m_pClient = NULL;      m_pClient = NULL;
# Line 306  bool qsamplerMainForm::decodeDragFiles ( Line 305  bool qsamplerMainForm::decodeDragFiles (
305          if (bDecode) {          if (bDecode) {
306              files = QStringList::split('\n', sText);              files = QStringList::split('\n', sText);
307              for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++)              for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++)
308                  *iter = (*iter).stripWhiteSpace().replace(QRegExp("^file:"), QString::null);                  *iter = QUrl((*iter).stripWhiteSpace().replace(QRegExp("^file:"), QString::null)).path();
309          }          }
310      }      }
311    
# Line 330  void qsamplerMainForm::dropEvent ( QDrop Line 329  void qsamplerMainForm::dropEvent ( QDrop
329          return;          return;
330    
331      for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {      for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {
332                  const QString& sPath = QUrl(*iter).path();                  const QString& sPath = *iter;
333                  if (qsamplerChannel::isInstrumentFile(sPath)) {                  if (qsamplerChannel::isInstrumentFile(sPath)) {
334                          // Try to create a new channel from instrument file...                          // Try to create a new channel from instrument file...
335                      qsamplerChannel *pChannel = new qsamplerChannel(this);                      qsamplerChannel *pChannel = new qsamplerChannel(this);
# Line 351  void qsamplerMainForm::dropEvent ( QDrop Line 350  void qsamplerMainForm::dropEvent ( QDrop
350                          }                          }
351                      // Make that an overall update.                      // Make that an overall update.
352                      m_iDirtyCount++;                      m_iDirtyCount++;
                     m_iChangeCount++;  
353                      stabilizeForm();                      stabilizeForm();
354                  }   // Otherwise, load an usual session file (LSCP script)...                  }   // Otherwise, load an usual session file (LSCP script)...
355                  else if (closeSession(true))                  else if (closeSession(true))
# Line 612  bool qsamplerMainForm::loadSessionFile ( Line 610  bool qsamplerMainForm::loadSessionFile (
610      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));
611            
612      // Make that an overall update.      // Make that an overall update.
     m_iChangeCount++;  
613      stabilizeForm();      stabilizeForm();
614      return true;      return true;
615  }  }
# Line 650  bool qsamplerMainForm::saveSessionFile ( Line 647  bool qsamplerMainForm::saveSessionFile (
647          if (pChannelStrip) {          if (pChannelStrip) {
648              qsamplerChannel *pChannel = pChannelStrip->channel();              qsamplerChannel *pChannel = pChannelStrip->channel();
649              if (pChannel) {              if (pChannel) {
650                  int iChannelID = pChannel->channelID();                  ts << "# Channel " << iChannel << endl;
                 ts << "# " << pChannelStrip->caption() << endl;  
651                  ts << "ADD CHANNEL" << endl;                  ts << "ADD CHANNEL" << endl;
652                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel << " " << pChannel->audioDriver() << endl;
653                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel << " " << pChannel->midiDriver() << endl;
654                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;              //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel << " " << pChannel->midiPort() << endl;
655                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";
656                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
657                      ts << "ALL";                      ts << "ALL";
658                  else                  else
659                      ts << pChannel->midiChannel();                      ts << pChannel->midiChannel();
660                  ts << endl;                  ts << endl;
661                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;
662                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl;
663                  ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;                  ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl;
664                  ts << endl;                  ts << endl;
665              }              }
666          }          }
# Line 837  void qsamplerMainForm::editAddChannel (v Line 833  void qsamplerMainForm::editAddChannel (v
833    
834      // Make that an overall update.      // Make that an overall update.
835      m_iDirtyCount++;      m_iDirtyCount++;
     m_iChangeCount++;  
836      stabilizeForm();      stabilizeForm();
837  }  }
838    
# Line 909  void qsamplerMainForm::editResetChannel Line 904  void qsamplerMainForm::editResetChannel
904      if (pChannelStrip == NULL)      if (pChannelStrip == NULL)
905          return;          return;
906    
907      qsamplerChannel *pChannel = pChannelStrip->channel();      // Just invoque the channel strip procedure.
908      if (pChannel == NULL)      pChannelStrip->channelReset();
909          return;  }
910    
     // Reset the existing sampler channel.  
     pChannel->resetChannel();  
911    
912      // And force a deferred update.  // Reset all sampler channels.
913      m_iChangeCount++;  void qsamplerMainForm::editResetAllChannels (void)
914    {
915        if (m_pClient == NULL)
916            return;
917    
918        // Invoque the channel strip procedure,
919            // for all channels out there...
920        m_pWorkspace->setUpdatesEnabled(false);
921        QWidgetList wlist = m_pWorkspace->windowList();
922        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
923            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
924            if (pChannelStrip)
925                    pChannelStrip->channelReset();
926        }
927        m_pWorkspace->setUpdatesEnabled(true);
928  }  }
929    
930    
# Line 1180  void qsamplerMainForm::stabilizeForm (vo Line 1187  void qsamplerMainForm::stabilizeForm (vo
1187      editRemoveChannelAction->setEnabled(bHasChannel);      editRemoveChannelAction->setEnabled(bHasChannel);
1188      editSetupChannelAction->setEnabled(bHasChannel);      editSetupChannelAction->setEnabled(bHasChannel);
1189      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1190        editResetAllChannelsAction->setEnabled(bHasChannel);
1191      channelsArrangeAction->setEnabled(bHasChannel);      channelsArrangeAction->setEnabled(bHasChannel);
1192      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1193    
# Line 1212  void qsamplerMainForm::stabilizeForm (vo Line 1220  void qsamplerMainForm::stabilizeForm (vo
1220    
1221    
1222  // Channel change receiver slot.  // Channel change receiver slot.
1223  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )
1224  {  {
1225      // Flag that we're update those channel strips.          // Add this strip to the changed list...
1226      m_iChangeCount++;          if (m_changedStrips.containsRef(pChannelStrip) == 0)
1227                    m_changedStrips.append(pChannelStrip);
1228    
1229      // Just mark the dirty form.      // Just mark the dirty form.
1230      m_iDirtyCount++;      m_iDirtyCount++;
1231      // and update the form status...      // and update the form status...
# Line 1525  qsamplerChannelStrip *qsamplerMainForm:: Line 1535  qsamplerChannelStrip *qsamplerMainForm::
1535          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1536          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1537      }      }
1538        
1539            // This is pretty new, so we'll watch for it closely.
1540            channelStripChanged(pChannelStrip);
1541    
1542      // Return our successful reference...      // Return our successful reference...
1543      return pChannelStrip;      return pChannelStrip;
1544  }  }
# Line 1638  void qsamplerMainForm::timerSlot (void) Line 1651  void qsamplerMainForm::timerSlot (void)
1651      }      }
1652            
1653          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1654      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {      if (m_pClient && (m_changedStrips.count() > 0 || m_pOptions->bAutoRefresh)) {
1655          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1656          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1657              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1658              m_iChangeCount = 0;              // Update the channel information for each pending strip...
1659                for (qsamplerChannelStrip *pChannelStrip = m_changedStrips.first();
1660                        pChannelStrip;
1661                                                    pChannelStrip = m_changedStrips.next()) {
1662                                    // If successfull, remove from pending list...
1663                                    if (pChannelStrip->updateChannelInfo())
1664                        m_changedStrips.remove(pChannelStrip);
1665                            }
1666                // Update the channel stream usage for each strip...
1667              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1668              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1669                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1670                  if (pChannelStrip && pChannelStrip->isVisible()) {                  if (pChannelStrip && pChannelStrip->isVisible())
1671                      // If we can't make it clean, try next time.                      pChannelStrip->updateChannelUsage();
                     if (!pChannelStrip->updateChannelUsage())  
                         m_iChangeCount++;  
                 }  
1672              }              }
1673          }          }
1674      }      }

Legend:
Removed from v.395  
changed lines
  Added in v.409

  ViewVC Help
Powered by ViewVC