/[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 1490 by schoenebeck, Mon Nov 19 04:09:30 2007 UTC revision 1499 by capela, Tue Nov 20 16:48:04 2007 UTC
# Line 20  Line 20 
20    
21  *****************************************************************************/  *****************************************************************************/
22    
 #include "qsamplerUtilities.h"  
23  #include "qsamplerAbout.h"  #include "qsamplerAbout.h"
24  #include "qsamplerChannel.h"  #include "qsamplerChannel.h"
25    #include "qsamplerUtilities.h"
26    
27  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
28  #include "qsamplerChannelForm.h"  #include "qsamplerChannelForm.h"
29    
30  #include <qfileinfo.h>  #include <QFileInfo>
31  #include <qcombobox.h>  #include <QComboBox>
32    
33  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
34  #include "gig.h"  #include "gig.h"
# Line 38  Line 38 
38    
39  #define UNICODE_RIGHT_ARROW     QChar(char(0x92), char(0x21))  #define UNICODE_RIGHT_ARROW     QChar(char(0x92), char(0x21))
40    
41    
42  using namespace QSampler;  using namespace QSampler;
43    
44  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 158  bool qsamplerChannel::loadEngine ( const Line 159  bool qsamplerChannel::loadEngine ( const
159          if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName)          if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName)
160                  return true;                  return true;
161    
162          if (::lscp_load_engine(pMainForm->client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) {          if (::lscp_load_engine(pMainForm->client(),
163                            sEngineName.toUtf8().constData(), m_iChannelID) != LSCP_OK) {
164                  appendMessagesClient("lscp_load_engine");                  appendMessagesClient("lscp_load_engine");
165                  return false;                  return false;
166          }          }
# Line 210  bool qsamplerChannel::loadInstrument ( c Line 212  bool qsamplerChannel::loadInstrument ( c
212          if (          if (
213                  ::lscp_load_instrument_non_modal(                  ::lscp_load_instrument_non_modal(
214                          pMainForm->client(),                          pMainForm->client(),
215                          qsamplerUtilities::lscpEscapePath(sInstrumentFile).latin1(),                          qsamplerUtilities::lscpEscapePath(
216                                    sInstrumentFile).toUtf8().constData(),
217                          iInstrumentNr, m_iChannelID                          iInstrumentNr, m_iChannelID
218                  ) != LSCP_OK                  ) != LSCP_OK
219          ) {          ) {
# Line 257  bool qsamplerChannel::setMidiDriver ( co Line 260  bool qsamplerChannel::setMidiDriver ( co
260          if (m_iInstrumentStatus == 100 && m_sMidiDriver == sMidiDriver)          if (m_iInstrumentStatus == 100 && m_sMidiDriver == sMidiDriver)
261                  return true;                  return true;
262    
263          if (::lscp_set_channel_midi_type(pMainForm->client(), m_iChannelID, sMidiDriver.latin1()) != LSCP_OK) {          if (::lscp_set_channel_midi_type(pMainForm->client(),
264                            m_iChannelID, sMidiDriver.toUtf8().constData()) != LSCP_OK) {
265                  appendMessagesClient("lscp_set_channel_midi_type");                  appendMessagesClient("lscp_set_channel_midi_type");
266                  return false;                  return false;
267          }          }
# Line 425  bool qsamplerChannel::setAudioDriver ( c Line 429  bool qsamplerChannel::setAudioDriver ( c
429          if (m_iInstrumentStatus == 100 && m_sAudioDriver == sAudioDriver)          if (m_iInstrumentStatus == 100 && m_sAudioDriver == sAudioDriver)
430                  return true;                  return true;
431    
432          if (::lscp_set_channel_audio_type(pMainForm->client(), m_iChannelID, sAudioDriver.latin1()) != LSCP_OK) {          if (::lscp_set_channel_audio_type(pMainForm->client(),
433                            m_iChannelID, sAudioDriver.toUtf8().constData()) != LSCP_OK) {
434                  appendMessagesClient("lscp_set_channel_audio_type");                  appendMessagesClient("lscp_set_channel_audio_type");
435                  return false;                  return false;
436          }          }
# Line 804  bool qsamplerChannel::isInstrumentFile ( Line 809  bool qsamplerChannel::isInstrumentFile (
809          bool bResult = false;          bool bResult = false;
810    
811          QFile file(sInstrumentFile);          QFile file(sInstrumentFile);
812          if (file.open(IO_ReadOnly)) {          if (file.open(QIODevice::ReadOnly)) {
813                  char achHeader[16];                  char achHeader[16];
814                  if (file.readBlock(achHeader, 16)) {                  if (file.read(achHeader, 16) > 0) {
815                          bResult = (::memcmp(&achHeader[0], "RIFF", 4)     == 0                          bResult = (::memcmp(&achHeader[0], "RIFF", 4)     == 0
816                                          && ::memcmp(&achHeader[8], "DLS LIST", 8) == 0);                                          && ::memcmp(&achHeader[8], "DLS LIST", 8) == 0);
817                  }                  }
# Line 827  QStringList qsamplerChannel::getInstrume Line 832  QStringList qsamplerChannel::getInstrume
832          if (isInstrumentFile(sInstrumentFile)) {          if (isInstrumentFile(sInstrumentFile)) {
833  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
834                  if (bInstrumentNames) {                  if (bInstrumentNames) {
835                          RIFF::File *pRiff = new RIFF::File(sInstrumentFile.latin1());                          RIFF::File *pRiff
836                                    = new RIFF::File(sInstrumentFile.toUtf8().constData());
837                          gig::File  *pGig  = new gig::File(pRiff);                          gig::File  *pGig  = new gig::File(pRiff);
838                          gig::Instrument *pInstrument = pGig->GetFirstInstrument();                          gig::Instrument *pInstrument = pGig->GetFirstInstrument();
839                          while (pInstrument) {                          while (pInstrument) {
# Line 858  QString qsamplerChannel::getInstrumentNa Line 864  QString qsamplerChannel::getInstrumentNa
864                  sInstrumentName = QFileInfo(sInstrumentFile).fileName();                  sInstrumentName = QFileInfo(sInstrumentFile).fileName();
865  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
866                  if (bInstrumentNames) {                  if (bInstrumentNames) {
867                          RIFF::File *pRiff = new RIFF::File(sInstrumentFile.latin1());                          RIFF::File *pRiff
868                          gig::File  *pGig  = new gig::File(pRiff);                                  = new RIFF::File(sInstrumentFile.toUtf8().constData());
869                            gig::File *pGig = new gig::File(pRiff);
870                          int iIndex = 0;                          int iIndex = 0;
871                          gig::Instrument *pInstrument = pGig->GetFirstInstrument();                          gig::Instrument *pInstrument = pGig->GetFirstInstrument();
872                          while (pInstrument) {                          while (pInstrument) {
# Line 941  QVariant ChannelRoutingModel::data(const Line 948  QVariant ChannelRoutingModel::data(const
948    
949      // The common device port item list.      // The common device port item list.
950      qsamplerDevicePortList& ports = pDevice->ports();      qsamplerDevicePortList& ports = pDevice->ports();
951      qsamplerDevicePort* pPort;          QListIterator<qsamplerDevicePort *> iter(ports);
952      for (pPort = ports.first(); pPort; pPort = ports.next()) {          while (iter.hasNext()) {
953                    qsamplerDevicePort *pPort = iter.next();
954          item.options.append(          item.options.append(
955              pDevice->deviceTypeName()              pDevice->deviceTypeName()
956              + ' ' + pDevice->driverName()              + ' ' + pDevice->driverName()

Legend:
Removed from v.1490  
changed lines
  Added in v.1499

  ViewVC Help
Powered by ViewVC