/[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 1372 by capela, Wed Oct 3 11:34:30 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    
681            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
682            if (pMainForm == NULL)
683                    return false;
684            if (pMainForm->client() == NULL || m_iChannelID < 0)
685                    return false;
686    
687            if (::lscp_edit_instrument(pMainForm->client(), m_iChannelID) != LSCP_OK) {
688                    appendMessagesClient("lscp_edit_instrument");
689                    appendMessagesError(QObject::tr(
690                            "Could not launch an appropriate instrument editor "
691                            "for the given instrument!\n"
692                            "Make sure you have an appropriate "
693                            "instrument editor like 'gigedit' installed\n"
694                            "and that it placed its mandatory DLL file "
695                            "into the sampler's plugin directory.")
696                    );
697                    return false;
698            }
699    
700            appendMessages(QObject::tr("edit instrument."));
701    
702            return true;
703    
704    #else
705    
706            appendMessagesError(QObject::tr(
707                    "Sorry, QSampler was compiled for a version of liblscp "
708                    "which lacks this feature.\n"
709                    "You may want to update liblscp and recompile QSampler afterwards.")
710            );
711    
712            return false;
713    
714    #endif
715    }
716    
717    
718  // Channel setup dialog form.  // Channel setup dialog form.
719  bool qsamplerChannel::channelSetup ( QWidget *pParent )  bool qsamplerChannel::channelSetup ( QWidget *pParent )
720  {  {

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

  ViewVC Help
Powered by ViewVC