/[svn]/qsampler/trunk/src/qsamplerChannel.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerChannel.cpp

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

revision 961 by capela, Sun Dec 3 18:26:13 2006 UTC revision 1366 by schoenebeck, Mon Oct 1 18:26:06 2007 UTC
# Line 1  Line 1 
1  // qsamplerChannel.cpp  // qsamplerChannel.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5    
6     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
7     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 53  qsamplerChannel::qsamplerChannel ( int i Line 53  qsamplerChannel::qsamplerChannel ( int i
53          m_iMidiDevice       = -1;          m_iMidiDevice       = -1;
54          m_iMidiPort         = -1;          m_iMidiPort         = -1;
55          m_iMidiChannel      = -1;          m_iMidiChannel      = -1;
56            m_iMidiMap          = -1;
57          m_sAudioDriver      = "ALSA";          m_sAudioDriver      = "ALSA";
58          m_iAudioDevice      = -1;          m_iAudioDevice      = -1;
59          m_fVolume           = 0.0;          m_fVolume           = 0.0;
# Line 341  bool qsamplerChannel::setMidiChannel ( i Line 342  bool qsamplerChannel::setMidiChannel ( i
342  }  }
343    
344    
345    // MIDI instrument map accessor.
346    int qsamplerChannel::midiMap (void) const
347    {
348            return m_iMidiMap;
349    }
350    
351    bool qsamplerChannel::setMidiMap ( int iMidiMap )
352    {
353            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
354            if (pMainForm == NULL)
355                    return false;
356            if (pMainForm->client() == NULL || m_iChannelID < 0)
357                    return false;
358            if (m_iInstrumentStatus == 100 && m_iMidiMap == iMidiMap)
359                    return true;
360    #ifdef CONFIG_MIDI_INSTRUMENT
361            if (::lscp_set_channel_midi_map(pMainForm->client(), m_iChannelID, iMidiMap) != LSCP_OK) {
362                    appendMessagesClient("lscp_set_channel_midi_map");
363                    return false;
364            }
365    #endif
366            appendMessages(QObject::tr("MIDI map: %1.").arg(iMidiMap));
367    
368            m_iMidiMap = iMidiMap;
369            return true;
370    }
371    
372    
373  // Audio device accessor.  // Audio device accessor.
374  int qsamplerChannel::audioDevice (void) const  int qsamplerChannel::audioDevice (void) const
375  {  {
# Line 571  bool qsamplerChannel::updateChannelInfo Line 600  bool qsamplerChannel::updateChannelInfo
600          m_iMidiDevice       = pChannelInfo->midi_device;          m_iMidiDevice       = pChannelInfo->midi_device;
601          m_iMidiPort         = pChannelInfo->midi_port;          m_iMidiPort         = pChannelInfo->midi_port;
602          m_iMidiChannel      = pChannelInfo->midi_channel;          m_iMidiChannel      = pChannelInfo->midi_channel;
603    #ifdef CONFIG_MIDI_INSTRUMENT
604            m_iMidiMap          = pChannelInfo->midi_map;
605    #endif
606          m_iAudioDevice      = pChannelInfo->audio_device;          m_iAudioDevice      = pChannelInfo->audio_device;
607          m_fVolume           = pChannelInfo->volume;          m_fVolume           = pChannelInfo->volume;
608  #ifdef CONFIG_MUTE_SOLO  #ifdef CONFIG_MUTE_SOLO
# Line 607  bool qsamplerChannel::updateChannelInfo Line 639  bool qsamplerChannel::updateChannelInfo
639    
640          // Set the audio routing map.          // Set the audio routing map.
641          m_audioRouting.clear();          m_audioRouting.clear();
642          char **ppszRouting = pChannelInfo->audio_routing;  #ifdef CONFIG_AUDIO_ROUTING
643          for (int i = 0; ppszRouting && ppszRouting[i]; i++) {          int *piAudioRouting = pChannelInfo->audio_routing;
644                  m_audioRouting[i] = ::atoi(ppszRouting[i]);          for (int i = 0; piAudioRouting && piAudioRouting[i] >= 0; i++)
645          }                  m_audioRouting[i] = piAudioRouting[i];
646    #else
647            char **ppszAudioRouting = pChannelInfo->audio_routing;
648            for (int i = 0; ppszAudioRouting && ppszAudioRouting[i]; i++)
649                    m_audioRouting[i] = ::atoi(ppszAudioRouting[i]);
650    #endif
651    
652          return true;          return true;
653  }  }
# Line 636  bool qsamplerChannel::channelReset (void Line 673  bool qsamplerChannel::channelReset (void
673  }  }
674    
675    
676    // Spawn instrument editor method.
677    bool qsamplerChannel::editChannel (void)
678    {
679    #ifdef CONFIG_EDIT_INSTRUMENT
680            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
681            if (pMainForm == NULL)
682                    return false;
683            if (pMainForm->client() == NULL || m_iChannelID < 0)
684                    return false;
685    
686            if (::lscp_edit_instrument(pMainForm->client(), m_iChannelID) != LSCP_OK) {
687                    appendMessagesClient("lscp_edit_instrument");
688                    appendMessagesError(
689                            "Could not launch an appropriate instrument editor for the\n"
690                            "given instrument! Make sure you have an appropriate\n"
691                            "instrument editor like 'gigedit' installed and that it placed\n"
692                            "its mandatory DLL file into the sampler's plugin directory."
693                    );
694                    return false;
695            }
696    
697            appendMessages(QObject::tr("edit instrument."));
698    
699            return true;
700    #else
701            appendMessagesError(
702                    "Sorry, QSampler was compiled for a version of liblscp which lacks\n"
703                    "this feature. You may want to update liblscp and recompile\n"
704                    "QSampler afterwards."
705            );
706            return false;
707    #endif
708    }
709    
710    
711  // Channel setup dialog form.  // Channel setup dialog form.
712  bool qsamplerChannel::channelSetup ( QWidget *pParent )  bool qsamplerChannel::channelSetup ( QWidget *pParent )
713  {  {

Legend:
Removed from v.961  
changed lines
  Added in v.1366

  ViewVC Help
Powered by ViewVC