/[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 261 by capela, Wed Sep 29 07:43:26 2004 UTC revision 400 by capela, Mon Feb 21 15:02:58 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 22  Line 22 
22    
23  #include <qvalidator.h>  #include <qvalidator.h>
24  #include <qmessagebox.h>  #include <qmessagebox.h>
25    #include <qdragobject.h>
26  #include <qfileinfo.h>  #include <qfileinfo.h>
27  #include <qtooltip.h>  #include <qtooltip.h>
28  #include <qpopupmenu.h>  #include <qpopupmenu.h>
29    #include <qobjectlist.h>
30    
31  #include <math.h>  #include <math.h>
32    
# Line 33  Line 35 
35    
36  #include "config.h"  #include "config.h"
37    
38    // Channel status/usage usage limit control.
39    #define QSAMPLER_ERROR_LIMIT    3
40    
41    
42  // Kind of constructor.  // Kind of constructor.
43  void qsamplerChannelStrip::init (void)  void qsamplerChannelStrip::init (void)
44  {  {
45      // Initialize locals.      // Initialize locals.
46      m_pMainForm  = NULL;      m_pChannel     = NULL;
     m_iChannelID = 0;  
       
 //  m_sEngineName       = tr("(No engine)");  
 //  m_sInstrumentFile   = tr("(No instrument)");  
     m_iInstrumentNr     = -1;  
     m_iInstrumentStatus = -1;  
     m_sMidiDriver       = "Alsa";   // DEPRECATED.  
     m_iMidiDevice       = -1;  
     m_iMidiPort         = -1;  
     m_iMidiChannel      = -1;  
     m_sAudioDriver      = "Alsa";   // DEPRECATED.  
     m_iAudioDevice      = -1;  
     m_fVolume           = 0.0;  
       
47      m_iDirtyChange = 0;      m_iDirtyChange = 0;
48            m_iErrorCount  = 0;
49    
50      // Try to restore normal window positioning.      // Try to restore normal window positioning.
51      adjustSize();      adjustSize();
# Line 63  void qsamplerChannelStrip::init (void) Line 55  void qsamplerChannelStrip::init (void)
55  // Kind of destructor.  // Kind of destructor.
56  void qsamplerChannelStrip::destroy (void)  void qsamplerChannelStrip::destroy (void)
57  {  {
58        // Destroy existing channel descriptor.
59        if (m_pChannel)
60            delete m_pChannel;
61        m_pChannel = NULL;
62  }  }
63    
64    
65  // Channel strip setup formal initializer.  // Drag'n'drop file handler.
66  void qsamplerChannelStrip::setup ( qsamplerMainForm *pMainForm, int iChannelID )  bool qsamplerChannelStrip::decodeDragFile ( const QMimeSource *pEvent, QString& sInstrumentFile )
67  {  {
68      m_iDirtyChange = 0;          if (m_pChannel == NULL)
69      m_pMainForm = pMainForm;                  return false;
70    
71      setChannelID(iChannelID);          if (QTextDrag::canDecode(pEvent)) {
72                    QString sText;
73                    if (QTextDrag::decode(pEvent, sText)) {
74                            QStringList files = QStringList::split('\n', sText);
75                            for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {
76                                    *iter = (*iter).stripWhiteSpace().replace(QRegExp("^file:"), QString::null);
77                                    if (qsamplerChannel::isInstrumentFile(*iter)) {
78                                            sInstrumentFile = *iter;
79                                            return true;
80                                    }
81                            }
82                    }
83            }
84            // Fail.
85            return false;
86  }  }
87    
88    
89  // The global options settings delegated property.  // Window drag-n-drop event handlers.
90  qsamplerOptions *qsamplerChannelStrip::options (void)  void qsamplerChannelStrip::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )
91  {  {
92      if (m_pMainForm == NULL)          QString sInstrumentFile;
93          return NULL;          pDragEnterEvent->accept(decodeDragFile(pDragEnterEvent, sInstrumentFile));
           
     return m_pMainForm->options();  
94  }  }
95    
96    
97  // The client descriptor delegated property.  void qsamplerChannelStrip::dropEvent ( QDropEvent* pDropEvent )
 lscp_client_t *qsamplerChannelStrip::client (void)  
98  {  {
99      if (m_pMainForm == NULL)          QString sInstrumentFile;
         return NULL;  
100    
101      return m_pMainForm->client();          if (decodeDragFile(pDropEvent, sInstrumentFile)) {
102                    // Go and set the dropped instrument filename...
103                    m_pChannel->setInstrument(sInstrumentFile, 0);
104                    // Open up the channel dialog.
105                    channelSetup();
106            }
107  }  }
108    
109    
110  // Channel-ID (aka Sammpler-Channel) accessors.  // Channel strip setup formal initializer.
111  int qsamplerChannelStrip::channelID (void)  void qsamplerChannelStrip::setup ( qsamplerChannel *pChannel )
 {  
     return m_iChannelID;  
 }  
   
 void qsamplerChannelStrip::setChannelID ( int iChannelID )  
112  {  {
113      m_iChannelID = iChannelID;      // Destroy any previous channel descriptor;
114        // (remember that once setup we own it!)
115        if (m_pChannel)
116            delete m_pChannel;
117    
118        // Set the new one...
119        m_pChannel = pChannel;
120        
121        // Stabilize this around.
122      updateChannelInfo();      updateChannelInfo();
 }  
   
123    
124  // Engine name accessors.          // We'll accept drops from now on...
125  QString& qsamplerChannelStrip::engineName (void)          if (m_pChannel)
126  {                  setAcceptDrops(true);
     return m_sEngineName;  
127  }  }
128    
129  bool qsamplerChannelStrip::loadEngine ( const QString& sEngineName )  // Channel secriptor accessor.
130    qsamplerChannel *qsamplerChannelStrip::channel (void)
131  {  {
132      if (client() == NULL)      return m_pChannel;
         return false;  
   
     if (::lscp_load_engine(client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) {  
         appendMessagesClient("lscp_load_engine");  
         return false;  
     }  
   
     m_sEngineName = sEngineName;  
     return true;  
133  }  }
134    
135    
136  // Instrument filename accessor.  // Messages view font accessors.
137  QString& qsamplerChannelStrip::instrumentFile (void)  QFont qsamplerChannelStrip::displayFont (void)
138  {  {
139      return m_sInstrumentFile;      return EngineNameTextLabel->font();
140  }  }
141    
142  // Instrument index accessor.  void qsamplerChannelStrip::setDisplayFont ( const QFont & font )
 int qsamplerChannelStrip::instrumentNr (void)  
143  {  {
144      return m_iInstrumentNr;      EngineNameTextLabel->setFont(font);
145        MidiPortChannelTextLabel->setFont(font);
146        InstrumentNameTextLabel->setFont(font);
147        InstrumentStatusTextLabel->setFont(font);
148  }  }
149    
 // Instrument status accessor.  
 int qsamplerChannelStrip::instrumentStatus (void)  
 {  
     return m_iInstrumentStatus;  
 }  
150    
151  // Instrument file loader.  // Channel display background effect.
152  bool qsamplerChannelStrip::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr )  void qsamplerChannelStrip::setDisplayEffect ( bool bDisplayEffect )
153  {  {
154      if (client() == NULL)      QPixmap pm;
155          return false;      if (bDisplayEffect)
156            pm = QPixmap::fromMimeSource("displaybg1.png");
157      if (::lscp_load_instrument_non_modal(client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) {      setDisplayBackground(pm);
         appendMessagesClient("lscp_load_instrument");  
         return false;  
     }  
   
     m_sInstrumentFile = sInstrumentFile;  
     m_iInstrumentNr = iInstrumentNr;  
     m_iInstrumentStatus = 0;  
       
     return true;  
158  }  }
159    
160    
161  // MIDI driver type accessors (DEPRECATED).  // Update main display background pixmap.
162  QString& qsamplerChannelStrip::midiDriver (void)  void qsamplerChannelStrip::setDisplayBackground ( const QPixmap& pm )
163  {  {
164      return m_sMidiDriver;      // Set the main origin...
165  }      ChannelInfoFrame->setPaletteBackgroundPixmap(pm);
   
 bool qsamplerChannelStrip::setMidiDriver ( const QString& sMidiDriver )  
 {  
     if (client() == NULL)  
         return false;  
166    
167      if (::lscp_set_channel_midi_type(client(), m_iChannelID, sMidiDriver.latin1()) != LSCP_OK) {      // Iterate for every child text label...
168          appendMessagesClient("lscp_set_channel_midi_type");      QObjectList *pList = ChannelInfoFrame->queryList("QLabel");
169          return false;      if (pList) {
170            for (QLabel *pLabel = (QLabel *) pList->first(); pLabel; pLabel = (QLabel *) pList->next())
171                pLabel->setPaletteBackgroundPixmap(pm);
172            delete pList;
173      }      }
174        
175      m_sMidiDriver = sMidiDriver;      // And this standalone too.
176      return true;      StreamVoiceCountTextLabel->setPaletteBackgroundPixmap(pm);
177  }  }
178    
179    
180  // MIDI device accessors.  // Maximum volume slider accessors.
181  int qsamplerChannelStrip::midiDevice (void)  void qsamplerChannelStrip::setMaxVolume ( int iMaxVolume )
 {  
     return m_iMidiDevice;  
 }  
   
 bool qsamplerChannelStrip::setMidiDevice ( int iMidiDevice )  
182  {  {
183      if (client() == NULL)      m_iDirtyChange++;
184          return false;      VolumeSlider->setRange(0, iMaxVolume);
185        VolumeSpinBox->setRange(0, iMaxVolume);
186      if (::lscp_set_channel_midi_device(client(), m_iChannelID, iMidiDevice) != LSCP_OK) {      m_iDirtyChange--;
         appendMessagesClient("lscp_set_channel_midi_device");  
         return false;  
     }  
   
     m_iMidiDevice = iMidiDevice;  
     return true;  
187  }  }
188    
189    
190  // MIDI port number accessor.  // Channel setup dialog slot.
191  int qsamplerChannelStrip::midiPort (void)  bool qsamplerChannelStrip::channelSetup (void)
 {  
     return m_iMidiPort;  
 }  
   
 bool qsamplerChannelStrip::setMidiPort ( int iMidiPort )  
192  {  {
193      if (client() == NULL)          if (m_pChannel == NULL)
194          return false;                  return false;
195                    
196            // Invoke the channel setup dialog.
197            bool bResult = m_pChannel->channelSetup(this);
198            // Notify that thie channel has changed.
199            if (bResult)
200                    emit channelChanged(this);
201    
202      if (::lscp_set_channel_midi_port(client(), m_iChannelID, iMidiPort) != LSCP_OK) {          return bResult;
         appendMessagesClient("lscp_set_channel_midi_port");  
         return false;  
     }  
   
     m_iMidiPort = iMidiPort;  
     return true;  
203  }  }
204    
205    
206  // MIDI channel accessor.  // Channel reset slot.
207  int qsamplerChannelStrip::midiChannel (void)  bool qsamplerChannelStrip::channelReset (void)
208  {  {
209      return m_iMidiChannel;          if (m_pChannel == NULL)
210  }                  return false;
211    
212  bool qsamplerChannelStrip::setMidiChannel ( int iMidiChannel )          // Invoke the channel reset method.
213  {          bool bResult = m_pChannel->channelReset();
214      if (client() == NULL)          // Notify that thie channel has changed.
215          return false;          if (bResult)
216                    emit channelChanged(this);
217    
218      if (::lscp_set_channel_midi_channel(client(), m_iChannelID, iMidiChannel) != LSCP_OK) {          return bResult;
         appendMessagesClient("lscp_set_channel_midi_channel");  
         return false;  
     }  
   
     m_iMidiChannel = iMidiChannel;  
     return true;  
219  }  }
220    
221    
222  // Audio device accessor.  // Update the channel instrument name.
223  int qsamplerChannelStrip::audioDevice (void)  bool qsamplerChannelStrip::updateInstrumentName ( bool bForce )
224  {  {
225      return m_iAudioDevice;          if (m_pChannel == NULL)
226  }                  return false;
227    
228  bool qsamplerChannelStrip::setAudioDevice ( int iAudioDevice )          // Do we refersh the actual name?
229  {          if (bForce)
230      if (client() == NULL)                  m_pChannel->updateInstrumentName();
         return false;  
231    
232      if (::lscp_set_channel_audio_device(client(), m_iChannelID, iAudioDevice) != LSCP_OK) {          // Instrument name...
233          appendMessagesClient("lscp_set_channel_audio_device");          if (m_pChannel->instrumentName().isEmpty())
234          return false;                  InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName());
235      }          else
236                    InstrumentNameTextLabel->setText(' ' + m_pChannel->instrumentName());
237    
238      m_iAudioDevice = iAudioDevice;          return true;    
     return true;  
239  }  }
240    
241    
242  // Audio driver type accessors (DEPRECATED).  // Do the dirty volume change.
243  QString& qsamplerChannelStrip::audioDriver (void)  bool qsamplerChannelStrip::updateChannelVolume (void)
 {  
     return m_sAudioDriver;  
 }  
   
 bool qsamplerChannelStrip::setAudioDriver ( const QString& sAudioDriver )  
244  {  {
245      if (client() == NULL)      if (m_pChannel == NULL)
246          return false;          return false;
247    
248      if (::lscp_set_channel_audio_type(client(), m_iChannelID, sAudioDriver.latin1()) != LSCP_OK) {      // Convert...
249          appendMessagesClient("lscp_set_channel_audio_type");  #ifdef CONFIG_ROUND
250          return false;      int iVolume = (int) ::round(100.0 * m_pChannel->volume());
251      }  #else
252        double fIPart = 0.0;
253      m_sAudioDriver = sAudioDriver;      double fFPart = ::modf(100.0 * m_pChannel->volume(), &fIPart);
254      return true;      int iVolume = (int) fIPart;
255  }      if (fFPart >= +0.5)
256            iVolume++;
257        else
258  // Channel volume accessors.      if (fFPart <= -0.5)
259  float qsamplerChannelStrip::volume (void)          iVolume--;
260  {  #endif
     return m_fVolume;  
 }  
261    
262  bool qsamplerChannelStrip::setVolume ( float fVolume )      // And clip...
263  {      if (iVolume < 0)
264      if (client() == NULL)          iVolume = 0;
         return false;  
265    
266      if (::lscp_set_channel_volume(client(), m_iChannelID, fVolume) != LSCP_OK) {      // Flag it here, to avoid infinite recursion.
267          appendMessagesClient("lscp_set_channel_volume");      m_iDirtyChange++;
268          return false;      VolumeSlider->setValue(iVolume);
269      }      VolumeSpinBox->setValue(iVolume);
270        m_iDirtyChange--;
271    
     m_fVolume = fVolume;  
272      return true;      return true;
273  }  }
274    
275    
 // Messages view font accessors.  
 QFont qsamplerChannelStrip::displayFont (void)  
 {  
     return EngineNameTextLabel->font();  
 }  
   
 void qsamplerChannelStrip::setDisplayFont ( const QFont & font )  
 {  
     EngineNameTextLabel->setFont(font);  
     MidiPortChannelTextLabel->setFont(font);  
     InstrumentNameTextLabel->setFont(font);  
     InstrumentStatusTextLabel->setFont(font);  
 }  
   
 // Channel setup dialog.  
 void qsamplerChannelStrip::channelSetup ( bool bNew )  
 {  
     qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this);  
     if (pChannelForm) {  
         pChannelForm->setup(this, bNew);  
         if (pChannelForm->exec()) {  
             updateChannelInfo();  
             emit channelChanged(this);  
         }  
         delete pChannelForm;  
     }  
 }  
   
   
276  // Update whole channel info state.  // Update whole channel info state.
277  void qsamplerChannelStrip::updateChannelInfo (void)  bool qsamplerChannelStrip::updateChannelInfo (void)
278  {  {
279        if (m_pChannel == NULL)
280            return false;
281            
282            // Check for error limit/recycle...
283            if (m_iErrorCount > QSAMPLER_ERROR_LIMIT)
284                    return true;
285    
286      // Update strip caption.      // Update strip caption.
287      QString sText = tr("Channel %1").arg(m_iChannelID);      QString sText = m_pChannel->channelName();
288      setCaption(sText);      setCaption(sText);
289      ChannelSetupPushButton->setText(sText);      ChannelSetupPushButton->setText(sText);
290    
291      // Check if we're up and connected.      // Check if we're up and connected.
292      if (client() == NULL)      if (m_pChannel->client() == NULL)
293          return;          return false;
   
     // Read channel information.  
     lscp_channel_info_t *pChannelInfo = ::lscp_get_channel_info(client(), m_iChannelID);  
     if (pChannelInfo == NULL) {  
         appendMessagesClient("lscp_get_channel_info");      
         appendMessagesError(tr("Could not get channel information.\n\nSorry."));  
     } else {  
         // Cache in channel information.  
         m_sEngineName       = pChannelInfo->engine_name;  
         m_sInstrumentFile   = pChannelInfo->instrument_file;  
         m_iInstrumentNr     = pChannelInfo->instrument_nr;  
         m_iInstrumentStatus = pChannelInfo->instrument_status;  
         m_iMidiDevice       = pChannelInfo->midi_device;  
         m_iMidiPort         = pChannelInfo->midi_port;  
         m_iMidiChannel      = pChannelInfo->midi_channel;  
         m_iAudioDevice      = pChannelInfo->audio_device;  
         m_fVolume           = pChannelInfo->volume;  
         // Some sanity checks.  
         if (m_sEngineName == "NONE")  
             m_sEngineName = QString::null;  
         if (m_sInstrumentFile == "NONE")  
             m_sInstrumentFile = QString::null;  
     }  
294    
295      // Set some proper display values.      // Read actual channel information.
296      const QString sIndent = " ";      m_pChannel->updateChannelInfo();
297    
298      // Engine name...      // Engine name...
299      if (m_sEngineName.isEmpty())      if (m_pChannel->engineName().isEmpty())
300          EngineNameTextLabel->setText(sIndent + tr("(No engine)"));          EngineNameTextLabel->setText(' ' + qsamplerChannel::noEngineName());
301      else      else
302          EngineNameTextLabel->setText(sIndent + m_sEngineName);          EngineNameTextLabel->setText(' ' + m_pChannel->engineName());
303    
304      // Instrument name...          // Instrument name...
305      if (m_sInstrumentFile.isEmpty())          updateInstrumentName(false);
306          InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)"));  
307        // MIDI Port/Channel...
308        if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
309            MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_pChannel->midiPort()));
310      else      else
311          InstrumentNameTextLabel->setText(sIndent + QString("%1 [%2]")          MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel() + 1));
             .arg(QFileInfo(m_sInstrumentFile).fileName()).arg(m_iInstrumentNr));  
312    
313      // Instrument status...      // Instrument status...
314      if (m_iInstrumentStatus < 0) {      int iInstrumentStatus = m_pChannel->instrumentStatus();
315        if (iInstrumentStatus < 0) {
316          InstrumentStatusTextLabel->setPaletteForegroundColor(Qt::red);          InstrumentStatusTextLabel->setPaletteForegroundColor(Qt::red);
317          InstrumentStatusTextLabel->setText(tr("ERR%1").arg(m_iInstrumentStatus));          InstrumentStatusTextLabel->setText(tr("ERR%1").arg(iInstrumentStatus));
318      } else {          m_iErrorCount++;
319          InstrumentStatusTextLabel->setPaletteForegroundColor(m_iInstrumentStatus < 100 ? Qt::yellow : Qt::green);          return false;
         InstrumentStatusTextLabel->setText(QString::number(m_iInstrumentStatus) + "%");  
320      }      }
321        // All seems normal...
322      // MIDI Port/Channel...      InstrumentStatusTextLabel->setPaletteForegroundColor(iInstrumentStatus < 100 ? Qt::yellow : Qt::green);
323      if (m_iMidiChannel > 0)      InstrumentStatusTextLabel->setText(QString::number(iInstrumentStatus) + '%');
324          MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_iMidiPort).arg(m_iMidiChannel));      m_iErrorCount = 0;
325      else  
326          MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_iMidiPort));      // And update the both GUI volume elements;
327        // return success if, and only if, intrument is fully loaded...
328      // And update the both GUI volume elements.      return updateChannelVolume() && (iInstrumentStatus == 100);
     updateChannelVolume();  
 }  
   
   
 // Do the dirty volume change.  
 void qsamplerChannelStrip::updateChannelVolume (void)  
 {  
     // Convert...  
 #ifdef CONFIG_ROUND  
     int iVolume = (int) ::round(100.0 * m_fVolume);  
 #else  
     double fIPart = 0.0;  
     double fFPart = ::modf(100.0 * m_fVolume, &fIPart);  
     int iVolume = (int) fIPart;  
     if (fFPart >= +0.5)  
         iVolume++;  
     else  
     if (fFPart <= -0.5)  
         iVolume--;  
 #endif  
   
     // And clip...  
     if (iVolume < 0)  
         iVolume = 0;  
   
     // Flag it here, to avoid infinite recursion.  
     m_iDirtyChange++;  
     VolumeSlider->setValue(iVolume);  
     VolumeSpinBox->setValue(iVolume);  
     m_iDirtyChange--;  
329  }  }
330    
331    
332  // Update whole channel usage state.  // Update whole channel usage state.
333  void qsamplerChannelStrip::updateChannelUsage (void)  bool qsamplerChannelStrip::updateChannelUsage (void)
334  {  {
335      if (client() == NULL)      if (m_pChannel == NULL)
336          return;          return false;
337        if (m_pChannel->client() == NULL)
338      // Conditionally update whole channel status info.          return false;
     if (m_iInstrumentStatus >= 0 && m_iInstrumentStatus < 100) {  
         updateChannelInfo();  
         // Once we get a complete instrument load, try a implied reset channel....  
         if (m_iInstrumentStatus == 100) {  
             if (::lscp_reset_channel(client(), m_iChannelID) != LSCP_OK)  
                 appendMessagesClient("lscp_reset_channel");  
             else  
                 appendMessages(tr("Channel %1 reset.").arg(m_iChannelID));  
         }  
     }  
     // Leave, if we still have an erroneus or incomplete instrument load.  
     if (m_iInstrumentStatus < 100)  
         return;  
339    
340            // This only makes sense on fully loaded channels...
341            if (m_pChannel->instrumentStatus() < 100)
342                return false;
343                
344      // Get current channel voice count.      // Get current channel voice count.
345      int iVoiceCount  = ::lscp_get_channel_voice_count(client(), m_iChannelID);      int iVoiceCount  = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID());
346      // Get current stream count.      // Get current stream count.
347      int iStreamCount = ::lscp_get_channel_stream_count(client(), m_iChannelID);      int iStreamCount = ::lscp_get_channel_stream_count(m_pChannel->client(), m_pChannel->channelID());
348      // Get current channel buffer fill usage.      // Get current channel buffer fill usage.
349      // As benno has suggested this is the percentage usage      // As benno has suggested this is the percentage usage
350      // of the least filled buffer stream...      // of the least filled buffer stream...
351      int iStreamUsage = ::lscp_get_channel_stream_usage(client(), m_iChannelID);;      int iStreamUsage = ::lscp_get_channel_stream_usage(m_pChannel->client(), m_pChannel->channelID());;
352    
353      // Update the GUI elements...      // Update the GUI elements...
354      StreamUsageProgressBar->setProgress(iStreamUsage);      StreamUsageProgressBar->setProgress(iStreamUsage);
355      StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));      StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));
356        
357        // We're clean.
358        return true;
359  }  }
360    
361    
362  // Volume change slot.  // Volume change slot.
363  void qsamplerChannelStrip::volumeChanged ( int iVolume )  void qsamplerChannelStrip::volumeChanged ( int iVolume )
364  {  {
365        if (m_pChannel == NULL)
366            return;
367    
368      // Avoid recursion.      // Avoid recursion.
369      if (m_iDirtyChange > 0)      if (m_iDirtyChange > 0)
370          return;          return;
# Line 493  void qsamplerChannelStrip::volumeChanged Line 375  void qsamplerChannelStrip::volumeChanged
375          fVolume = 0.0;          fVolume = 0.0;
376    
377      // Update the GUI elements.      // Update the GUI elements.
378      if (setVolume(fVolume)) {      if (m_pChannel->setVolume(fVolume)) {
379          updateChannelVolume();          updateChannelVolume();
380          emit channelChanged(this);          emit channelChanged(this);
381      }      }
382  }  }
383    
384    
 // Redirected messages output methods.  
 void qsamplerChannelStrip::appendMessages( const QString& s )  
 {  
     m_pMainForm->appendMessages(s);  
 }  
   
 void qsamplerChannelStrip::appendMessagesColor( const QString& s, const QString& c )  
 {  
     m_pMainForm->appendMessagesColor(s, c);  
 }  
   
 void qsamplerChannelStrip::appendMessagesText( const QString& s )  
 {  
     m_pMainForm->appendMessagesText(s);  
 }  
   
 void qsamplerChannelStrip::appendMessagesError( const QString& s )  
 {  
     m_pMainForm->appendMessagesError(s);  
 }  
   
 void qsamplerChannelStrip::appendMessagesClient( const QString& s )  
 {  
     m_pMainForm->appendMessagesClient(s);  
 }  
   
   
385  // Context menu event handler.  // Context menu event handler.
386  void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )  void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )
387  {  {
388      // We'll just show up the main form's edit menu.      if (m_pChannel == NULL)
389      m_pMainForm->contextMenuEvent(pEvent);          return;
390  }          
391        // We'll just show up the main form's edit menu (thru qsamplerChannel).
392        m_pChannel->contextMenuEvent(pEvent);
 // Maximum volume slider accessors.  
 void qsamplerChannelStrip::setMaxVolume ( int iMaxVolume )  
 {  
     m_iDirtyChange++;  
     VolumeSlider->setRange(0, iMaxVolume);  
     VolumeSpinBox->setRange(0, iMaxVolume);  
     m_iDirtyChange--;  
393  }  }
394    
395    

Legend:
Removed from v.261  
changed lines
  Added in v.400

  ViewVC Help
Powered by ViewVC