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

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

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

revision 296 by capela, Wed Nov 17 11:51:49 2004 UTC revision 388 by capela, Thu Feb 17 17:27:59 2005 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, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2005, 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 39  Line 39 
39  void qsamplerChannelStrip::init (void)  void qsamplerChannelStrip::init (void)
40  {  {
41      // Initialize locals.      // Initialize locals.
     m_pMainForm    = NULL;  
42      m_pChannel     = NULL;      m_pChannel     = NULL;
43      m_iDirtyChange = 0;      m_iDirtyChange = 0;
44    
# Line 59  void qsamplerChannelStrip::destroy (void Line 58  void qsamplerChannelStrip::destroy (void
58    
59    
60  // Channel strip setup formal initializer.  // Channel strip setup formal initializer.
61  void qsamplerChannelStrip::setup ( qsamplerMainForm *pMainForm, int iChannelID )  void qsamplerChannelStrip::setup ( qsamplerChannel *pChannel )
62  {  {
63      // Set main form reference.      // Destroy any previous channel descriptor;
64      m_pMainForm = pMainForm;      // (remember that once setup we own it!)
       
     // Destroy any previous channel descriptor.  
65      if (m_pChannel)      if (m_pChannel)
66          delete m_pChannel;          delete m_pChannel;
67    
68      // Create a new one...      // Set the new one...
69      m_pChannel = new qsamplerChannel(pMainForm);      m_pChannel = pChannel;
70      // And set appropriate settings.  
     if (m_pChannel && iChannelID >= 0) {  
         m_pChannel->setChannelID(iChannelID);  
         m_iDirtyChange = 0;  
     }  
       
71      // Stabilize this around.      // Stabilize this around.
72      updateChannelInfo();      updateChannelInfo();
73  }  }
# Line 134  void qsamplerChannelStrip::setDisplayBac Line 126  void qsamplerChannelStrip::setDisplayBac
126  // Channel setup dialog slot.  // Channel setup dialog slot.
127  bool qsamplerChannelStrip::channelSetup (void)  bool qsamplerChannelStrip::channelSetup (void)
128  {  {
129      bool bResult = false;      bool bResult = m_pChannel->channelSetup(this);
   
     qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this);  
     if (pChannelForm) {  
         pChannelForm->setup(m_pChannel);  
         bResult = pChannelForm->exec();  
         delete pChannelForm;  
     }  
130    
131      if (bResult)      if (bResult)
132          emit channelChanged(this);          emit channelChanged(this);
# Line 150  bool qsamplerChannelStrip::channelSetup Line 135  bool qsamplerChannelStrip::channelSetup
135  }  }
136    
137    
138    // Update the channel instrument name.
139    bool qsamplerChannelStrip::updateInstrumentName ( bool bForce )
140    {
141            if (m_pChannel == NULL)
142                    return false;
143    
144            // Do we refersh the actual name?
145            if (bForce)
146                    m_pChannel->updateInstrumentName();
147    
148            // Instrument name...
149            if (m_pChannel->instrumentName().isEmpty())
150                    InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName());
151            else
152                    InstrumentNameTextLabel->setText(' ' + m_pChannel->instrumentName());
153    
154            return true;    
155    }
156    
157    
158  // Update whole channel info state.  // Update whole channel info state.
159  void qsamplerChannelStrip::updateChannelInfo (void)  bool qsamplerChannelStrip::updateChannelInfo (void)
160  {  {
161      if (m_pChannel == NULL)      if (m_pChannel == NULL)
162          return;          return false;
163                    
164      // Update strip caption.      // Update strip caption.
165      QString sText = m_pChannel->channelName();      QString sText = m_pChannel->channelName();
# Line 163  void qsamplerChannelStrip::updateChannel Line 168  void qsamplerChannelStrip::updateChannel
168    
169      // Check if we're up and connected.      // Check if we're up and connected.
170      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
171          return;          return false;
172    
173      // Read actual channel information.      // Read actual channel information.
174      m_pChannel->updateChannelInfo();      m_pChannel->updateChannelInfo();
175    
     // Set some proper display values.  
     const QString sIndent = " ";  
   
176      // Engine name...      // Engine name...
177      if (m_pChannel->engineName().isEmpty())      if (m_pChannel->engineName().isEmpty())
178          EngineNameTextLabel->setText(sIndent + tr("(No engine)"));          EngineNameTextLabel->setText(' ' + qsamplerChannel::noEngineName());
179      else      else
180          EngineNameTextLabel->setText(sIndent + m_pChannel->engineName());          EngineNameTextLabel->setText(' ' + m_pChannel->engineName());
181    
182      // Instrument name...          // Instrument name...
183      if (m_pChannel->instrumentFile().isEmpty())          updateInstrumentName(false);
         InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)"));  
     else  
         InstrumentNameTextLabel->setText(sIndent + QString("%1 [%2]")  
             .arg(QFileInfo(m_pChannel->instrumentFile()).fileName()).arg(m_pChannel->instrumentNr()));  
184    
185      // Instrument status...      // Instrument status...
186      int iInstrumentStatus = m_pChannel->instrumentStatus();      int iInstrumentStatus = m_pChannel->instrumentStatus();
# Line 201  void qsamplerChannelStrip::updateChannel Line 199  void qsamplerChannelStrip::updateChannel
199          MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel() + 1));          MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel() + 1));
200    
201      // And update the both GUI volume elements.      // And update the both GUI volume elements.
202      updateChannelVolume();      return updateChannelVolume();
203  }  }
204    
205    
206  // Do the dirty volume change.  // Do the dirty volume change.
207  void qsamplerChannelStrip::updateChannelVolume (void)  bool qsamplerChannelStrip::updateChannelVolume (void)
208  {  {
209      if (m_pChannel == NULL)      if (m_pChannel == NULL)
210          return;          return false;
211    
212      // Convert...      // Convert...
213  #ifdef CONFIG_ROUND  #ifdef CONFIG_ROUND
# Line 234  void qsamplerChannelStrip::updateChannel Line 232  void qsamplerChannelStrip::updateChannel
232      VolumeSlider->setValue(iVolume);      VolumeSlider->setValue(iVolume);
233      VolumeSpinBox->setValue(iVolume);      VolumeSpinBox->setValue(iVolume);
234      m_iDirtyChange--;      m_iDirtyChange--;
235        
236        return true;
237  }  }
238    
239    
240  // Update whole channel usage state.  // Update whole channel usage state.
241  void qsamplerChannelStrip::updateChannelUsage (void)  bool qsamplerChannelStrip::updateChannelUsage (void)
242  {  {
243      if (m_pChannel == NULL)      if (m_pChannel == NULL)
244          return;          return false;
245      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
246          return;          return false;
247    
248      // Conditionally update whole channel status info.      // Update whole channel status info,
249      if (m_pChannel->instrumentStatus() >= 0 && m_pChannel->instrumentStatus() < 100) {      // if instrument load is still pending...
250        if (m_pChannel->instrumentStatus() < 100) {
251          updateChannelInfo();          updateChannelInfo();
252          // Once we get a complete instrument load, try a implied reset channel....          // Check (updated) status again...
253          if (m_pChannel->instrumentStatus() == 100)          if (m_pChannel->instrumentStatus() < 100)
254              m_pChannel->resetChannel();              return false;
255            // Once we get a complete instrument load,
256            // we'll try an implied channel reset...
257            m_pChannel->resetChannel();
258      }      }
259      // Leave, if we still have an erroneus or incomplete instrument load.      
260        // Check again that we're clean.
261      if (m_pChannel->instrumentStatus() < 100)      if (m_pChannel->instrumentStatus() < 100)
262          return;          return false;
263    
264      // Get current channel voice count.      // Get current channel voice count.
265      int iVoiceCount  = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID());      int iVoiceCount  = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID());
# Line 268  void qsamplerChannelStrip::updateChannel Line 273  void qsamplerChannelStrip::updateChannel
273      // Update the GUI elements...      // Update the GUI elements...
274      StreamUsageProgressBar->setProgress(iStreamUsage);      StreamUsageProgressBar->setProgress(iStreamUsage);
275      StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));      StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));
276        
277        // We're clean.
278        return true;
279  }  }
280    
281    
# Line 297  void qsamplerChannelStrip::volumeChanged Line 305  void qsamplerChannelStrip::volumeChanged
305  // Context menu event handler.  // Context menu event handler.
306  void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )  void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )
307  {  {
308      if (m_pMainForm == NULL)      if (m_pChannel == NULL)
309          return;          return;
310                    
311      // We'll just show up the main form's edit menu.      // We'll just show up the main form's edit menu (thru qsamplerChannel).
312      m_pMainForm->contextMenuEvent(pEvent);      m_pChannel->contextMenuEvent(pEvent);
313  }  }
314    
315    

Legend:
Removed from v.296  
changed lines
  Added in v.388

  ViewVC Help
Powered by ViewVC