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

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

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

revision 264 by capela, Wed Sep 29 13:12:45 2004 UTC revision 430 by capela, Tue Mar 8 17:23:29 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 26  Line 26 
26  #include <qfileinfo.h>  #include <qfileinfo.h>
27  #include <qlistbox.h>  #include <qlistbox.h>
28    
29    #include "qsamplerDevice.h"
30    
31  #include "config.h"  #include "config.h"
32    
33    
# Line 50  void qsamplerChannelForm::destroy (void) Line 52  void qsamplerChannelForm::destroy (void)
52    
53    
54  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
55  void qsamplerChannelForm::setup ( qsamplerChannel *pChannel, bool bNew )  void qsamplerChannelForm::setup ( qsamplerChannel *pChannel )
56  {  {
57      m_pChannel = pChannel;      m_pChannel = pChannel;
58    
# Line 60  void qsamplerChannelForm::setup ( qsampl Line 62  void qsamplerChannelForm::setup ( qsampl
62      if (m_pChannel == NULL)      if (m_pChannel == NULL)
63          return;          return;
64    
65      setCaption(tr("Channel %1").arg(m_pChannel->channelID()));      // It can be a brand new channel, remember?
66        bool bNew = (m_pChannel->channelID() < 0);
67        setCaption(m_pChannel->channelName());
68    
69      // Check if we're up and connected.      // Check if we're up and connected.
70      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
# Line 86  void qsamplerChannelForm::setup ( qsampl Line 90  void qsamplerChannelForm::setup ( qsampl
90      else m_pChannel->appendMessagesClient("lscp_get_available_engines");      else m_pChannel->appendMessagesClient("lscp_get_available_engines");
91    
92      // Populate Audio output type list.      // Populate Audio output type list.
93      const char **ppszAudioDrivers = ::lscp_get_available_audio_drivers(m_pChannel->client());      AudioDriverComboBox->clear();
94      if (ppszAudioDrivers) {      AudioDriverComboBox->insertStringList(
95          AudioDriverComboBox->clear();                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Audio));
         for (int iAudioDriver = 0; ppszAudioDrivers[iAudioDriver]; iAudioDriver++)  
             AudioDriverComboBox->insertItem(ppszAudioDrivers[iAudioDriver]);  
     }  
     else m_pChannel->appendMessagesClient("lscp_get_available_audio_drivers");  
96    
97      // Populate MIDI input type list.      // Populate MIDI input type list.
98      const char **ppszMidiDrivers = ::lscp_get_available_midi_drivers(m_pChannel->client());      MidiDriverComboBox->clear();
99      if (ppszMidiDrivers) {      MidiDriverComboBox->insertStringList(
100          MidiDriverComboBox->clear();                  qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Midi));
         for (int iMidiDriver = 0; ppszMidiDrivers[iMidiDriver]; iMidiDriver++)  
             MidiDriverComboBox->insertItem(ppszMidiDrivers[iMidiDriver]);  
     }  
     else m_pChannel->appendMessagesClient("lscp_get_available_midi_drivers");  
101    
102      // Read proper channel information,      // Read proper channel information,
103      // and populate the channel form fields.      // and populate the channel form fields.
104    
105      // Engine name...      // Engine name...
106      QString sEngineName = pChannel->engineName();      QString sEngineName = pChannel->engineName();
107      if (sEngineName.isEmpty() && bNew)      if (sEngineName.isEmpty() || bNew)
108          sEngineName = pOptions->sEngineName;          sEngineName = pOptions->sEngineName;
109      if (sEngineName.isEmpty())      if (sEngineName.isEmpty())
110          sEngineName = tr("(No engine)");          sEngineName = qsamplerChannel::noEngineName();
111      if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)      if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL)
112          EngineNameComboBox->insertItem(sEngineName);          EngineNameComboBox->insertItem(sEngineName);
113      EngineNameComboBox->setCurrentText(sEngineName);      EngineNameComboBox->setCurrentText(sEngineName);
114      // Instrument filename and index...      // Instrument filename and index...
115      QString sInstrumentFile = pChannel->instrumentFile();      QString sInstrumentFile = pChannel->instrumentFile();
116      if (sInstrumentFile.isEmpty())      if (sInstrumentFile.isEmpty())
117          sInstrumentFile = tr("(No instrument)");          sInstrumentFile = qsamplerChannel::noInstrumentName();
118      InstrumentFileComboBox->setCurrentText(sInstrumentFile);      InstrumentFileComboBox->setCurrentText(sInstrumentFile);
119      InstrumentNrSpinBox->setValue(pChannel->instrumentNr());      InstrumentNrComboBox->clear();
120        InstrumentNrComboBox->insertStringList(
121                    qsamplerChannel::getInstrumentList(sInstrumentFile,
122                    pOptions->bInstrumentNames));
123        InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
124      // MIDI input driver...      // MIDI input driver...
125      QString sMidiDriver = pChannel->midiDriver();      QString sMidiDriver = pChannel->midiDriver();
126      if (sMidiDriver.isEmpty() && bNew)      if (sMidiDriver.isEmpty() || bNew)
127          sMidiDriver = pOptions->sMidiDriver;          sMidiDriver = pOptions->sMidiDriver;
128      if (!sMidiDriver.isEmpty()) {      if (!sMidiDriver.isEmpty()) {
129          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)
# Line 134  void qsamplerChannelForm::setup ( qsampl Line 134  void qsamplerChannelForm::setup ( qsampl
134      MidiPortSpinBox->setValue(pChannel->midiPort());      MidiPortSpinBox->setValue(pChannel->midiPort());
135      // MIDI input channel...      // MIDI input channel...
136      int iMidiChannel = pChannel->midiChannel();      int iMidiChannel = pChannel->midiChannel();
137      if (bNew)      // When new, try to suggest a sensible MIDI channel...
138          iMidiChannel = (pChannel->channelID() + 1) % 16;      if (iMidiChannel < 0)
139            iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);
140      MidiChannelComboBox->setCurrentItem(iMidiChannel);      MidiChannelComboBox->setCurrentItem(iMidiChannel);
141      // Audio output driver...      // Audio output driver...
142      QString sAudioDriver = pChannel->audioDriver();      QString sAudioDriver = pChannel->audioDriver();
143      if (sAudioDriver.isEmpty() && bNew)      if (sAudioDriver.isEmpty() || bNew)
144          sAudioDriver = pOptions->sAudioDriver;          sAudioDriver = pOptions->sAudioDriver;
145      if (!sAudioDriver.isEmpty()) {      if (!sAudioDriver.isEmpty()) {
146          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)
147              AudioDriverComboBox->insertItem(sAudioDriver);              AudioDriverComboBox->insertItem(sAudioDriver);
148          AudioDriverComboBox->setCurrentText(sAudioDriver);          AudioDriverComboBox->setCurrentText(sAudioDriver);
149      }      }
150            // As convenient, make it ready on stabilizeForm() for
151            // prompt acceptance, if we got the minimum required...
152            if (sEngineName != qsamplerChannel::noEngineName() &&
153                    sInstrumentFile != qsamplerChannel::noInstrumentName())
154                    m_iDirtyCount++;
155            // FIXME: These are better leave diabled...
156        MidiPortTextLabel->setEnabled(false);
157        MidiPortSpinBox->setEnabled(false);
158      // Done.      // Done.
159      m_iDirtySetup--;      m_iDirtySetup--;
160      stabilizeForm();      stabilizeForm();
# Line 165  void qsamplerChannelForm::accept (void) Line 174  void qsamplerChannelForm::accept (void)
174      // We'll go for it!      // We'll go for it!
175      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
176          int iErrors = 0;          int iErrors = 0;
177            // Are we a new channel?
178            if (!m_pChannel->addChannel())
179                iErrors++;
180          // Audio output driver type...          // Audio output driver type...
181          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
182              iErrors++;              iErrors++;
# Line 181  void qsamplerChannelForm::accept (void) Line 193  void qsamplerChannelForm::accept (void)
193          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
194              iErrors++;              iErrors++;
195          // Instrument file and index...          // Instrument file and index...
196          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrSpinBox->value()))          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))
197              iErrors++;              iErrors++;
198          // Show error messages?          // Show error messages?
199          if (iErrors > 0)          if (iErrors > 0)
# Line 252  void qsamplerChannelForm::openInstrument Line 264  void qsamplerChannelForm::openInstrument
264  // Refresh the actual instrument name.  // Refresh the actual instrument name.
265  void qsamplerChannelForm::updateInstrumentName (void)  void qsamplerChannelForm::updateInstrumentName (void)
266  {  {
267      // FIXME: A better idea would be to use libgig      qsamplerOptions *pOptions = m_pChannel->options();
268      // to retrieve the REAL instrument name.      if (pOptions == NULL)
269      InstrumentNameTextLabel->setText(QFileInfo(InstrumentFileComboBox->currentText()).fileName()          return;
270          + " [" + QString::number(InstrumentNrSpinBox->value()) + "]");  
271        // Finally this better idea would be to use libgig
272        // to retrieve the REAL instrument names.
273        InstrumentNrComboBox->clear();
274        InstrumentNrComboBox->insertStringList(
275            qsamplerChannel::getInstrumentList(
276                            InstrumentFileComboBox->currentText(),
277                            pOptions->bInstrumentNames)
278        );
279    
280      optionsChanged();      optionsChanged();
281  }  }

Legend:
Removed from v.264  
changed lines
  Added in v.430

  ViewVC Help
Powered by ViewVC