/[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 176 by capela, Tue Jul 6 10:54:45 2004 UTC revision 344 by capela, Tue Jan 18 13:53:04 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    
 #include "qsamplerOptions.h"  
 #include "qsamplerChannelStrip.h"  
   
29  #include "config.h"  #include "config.h"
30    
31    
# Line 53  void qsamplerChannelForm::destroy (void) Line 50  void qsamplerChannelForm::destroy (void)
50    
51    
52  // Channel dialog setup formal initializer.  // Channel dialog setup formal initializer.
53  void qsamplerChannelForm::setup ( qsamplerChannelStrip *pChannel, bool bNew )  void qsamplerChannelForm::setup ( qsamplerChannel *pChannel )
54  {  {
55      m_pChannel = pChannel;      m_pChannel = pChannel;
56    
# Line 63  void qsamplerChannelForm::setup ( qsampl Line 60  void qsamplerChannelForm::setup ( qsampl
60      if (m_pChannel == NULL)      if (m_pChannel == NULL)
61          return;          return;
62    
63      setCaption(m_pChannel->caption());      // It can be a brand new channel, remember?
64        bool bNew = (m_pChannel->channelID() < 0);
65        setCaption(m_pChannel->channelName());
66    
67      // Check if we're up and connected.      // Check if we're up and connected.
68      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
# Line 123  void qsamplerChannelForm::setup ( qsampl Line 122  void qsamplerChannelForm::setup ( qsampl
122      if (sInstrumentFile.isEmpty())      if (sInstrumentFile.isEmpty())
123          sInstrumentFile = tr("(No instrument)");          sInstrumentFile = tr("(No instrument)");
124      InstrumentFileComboBox->setCurrentText(sInstrumentFile);      InstrumentFileComboBox->setCurrentText(sInstrumentFile);
125      InstrumentNrSpinBox->setValue(pChannel->instrumentNr());      InstrumentNrComboBox->clear();
126        InstrumentNrComboBox->insertStringList(
127                    qsamplerChannel::getInstrumentList(sInstrumentFile,
128                    pOptions->bInstrumentNames));
129        InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
130      // MIDI input driver...      // MIDI input driver...
131      QString sMidiDriver = pChannel->midiDriver();      QString sMidiDriver = pChannel->midiDriver();
132      if (sMidiDriver.isEmpty() && bNew)      if (sMidiDriver.isEmpty() || bNew)
133          sMidiDriver = pOptions->sMidiDriver;          sMidiDriver = pOptions->sMidiDriver;
134      if (!sMidiDriver.isEmpty()) {      if (!sMidiDriver.isEmpty()) {
135          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)          if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL)
# Line 137  void qsamplerChannelForm::setup ( qsampl Line 140  void qsamplerChannelForm::setup ( qsampl
140      MidiPortSpinBox->setValue(pChannel->midiPort());      MidiPortSpinBox->setValue(pChannel->midiPort());
141      // MIDI input channel...      // MIDI input channel...
142      int iMidiChannel = pChannel->midiChannel();      int iMidiChannel = pChannel->midiChannel();
143      if (bNew)      // When new, try to suggest a sensible MIDI channel...
144          iMidiChannel = (pChannel->channelID() + 1) % 16;      if (iMidiChannel < 0)
145      MidiChannelSpinBox->setValue(iMidiChannel);          iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);
146        MidiChannelComboBox->setCurrentItem(iMidiChannel);
147      // Audio output driver...      // Audio output driver...
148      QString sAudioDriver = pChannel->audioDriver();      QString sAudioDriver = pChannel->audioDriver();
149      if (sAudioDriver.isEmpty() && bNew)      if (sAudioDriver.isEmpty() || bNew)
150          sAudioDriver = pOptions->sAudioDriver;          sAudioDriver = pOptions->sAudioDriver;
151      if (!sAudioDriver.isEmpty()) {      if (!sAudioDriver.isEmpty()) {
152          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)          if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL)
# Line 168  void qsamplerChannelForm::accept (void) Line 172  void qsamplerChannelForm::accept (void)
172      // We'll go for it!      // We'll go for it!
173      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
174          int iErrors = 0;          int iErrors = 0;
175            // Are we a new channel?
176            if (!m_pChannel->addChannel())
177                iErrors++;
178          // Audio output driver type...          // Audio output driver type...
179          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))          if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText()))
180              iErrors++;              iErrors++;
# Line 178  void qsamplerChannelForm::accept (void) Line 185  void qsamplerChannelForm::accept (void)
185          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))          if (!m_pChannel->setMidiPort(MidiPortSpinBox->value()))
186              iErrors++;              iErrors++;
187          // MIDI input channel...          // MIDI input channel...
188          if (!m_pChannel->setMidiChannel(MidiChannelSpinBox->value()))          if (!m_pChannel->setMidiChannel(MidiChannelComboBox->currentItem()))
189              iErrors++;              iErrors++;
190          // Engine name...          // Engine name...
191          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))          if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
192              iErrors++;              iErrors++;
193          // Instrument file and index...          // Instrument file and index...
194          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrSpinBox->value()))          if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))
195              iErrors++;              iErrors++;
196          // Show error messages?          // Show error messages?
197          if (iErrors > 0)          if (iErrors > 0)
# Line 255  void qsamplerChannelForm::openInstrument Line 262  void qsamplerChannelForm::openInstrument
262  // Refresh the actual instrument name.  // Refresh the actual instrument name.
263  void qsamplerChannelForm::updateInstrumentName (void)  void qsamplerChannelForm::updateInstrumentName (void)
264  {  {
265      // FIXME: A better idea would be to use libgig      qsamplerOptions *pOptions = m_pChannel->options();
266      // to retrieve the REAL instrument name.      if (pOptions == NULL)
267      InstrumentNameTextLabel->setText(QFileInfo(InstrumentFileComboBox->currentText()).fileName()          return;
268          + " [" + QString::number(InstrumentNrSpinBox->value()) + "]");  
269        // Finally this better idea would be to use libgig
270        // to retrieve the REAL instrument names.
271        InstrumentNrComboBox->clear();
272        InstrumentNrComboBox->insertStringList(
273            qsamplerChannel::getInstrumentList(
274                            InstrumentFileComboBox->currentText(),
275                            pOptions->bInstrumentNames)
276        );
277    
278      optionsChanged();      optionsChanged();
279  }  }

Legend:
Removed from v.176  
changed lines
  Added in v.344

  ViewVC Help
Powered by ViewVC