/[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 2563 by capela, Tue May 20 10:59:37 2014 UTC revision 2647 by capela, Wed Jun 18 11:00:40 2014 UTC
# Line 32  Line 32 
32    
33  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
34  #include "gig.h"  #include "gig.h"
35    #ifdef CONFIG_LIBGIG_SF2
36  #include "SF.h"  #include "SF.h"
37  #endif  #endif
38    #endif
39    
40  namespace QSampler {  namespace QSampler {
41    
# Line 830  bool Channel::isSf2InstrumentFile ( cons Line 832  bool Channel::isSf2InstrumentFile ( cons
832    
833          QFile file(sInstrumentFile);          QFile file(sInstrumentFile);
834          if (file.open(QIODevice::ReadOnly)) {          if (file.open(QIODevice::ReadOnly)) {
835                  char achHeader[8];                  char achHeader[12];
836                  if (file.read(achHeader, 8) > 0) {                  if (file.read(achHeader, 12) > 0) {
837                          bResult = (::memcmp(&achHeader[0], "RIFF", 4) == 0                          bResult = (::memcmp(&achHeader[0], "RIFF", 4) == 0
838                                          && ::memcmp(&achHeader[4], "sfbk", 4) == 0);                                          && ::memcmp(&achHeader[8], "sfbk", 4) == 0);
839                  }                  }
840                  file.close();                  file.close();
841          }          }
# Line 843  bool Channel::isSf2InstrumentFile ( cons Line 845  bool Channel::isSf2InstrumentFile ( cons
845    
846    
847  // Retrieve the instrument list of a instrument file (.gig).  // Retrieve the instrument list of a instrument file (.gig).
848  QStringList Channel::getInstrumentList(  QStringList Channel::getInstrumentList (
849          const QString& sInstrumentFile, bool bInstrumentNames )          const QString& sInstrumentFile, bool bInstrumentNames )
850  {  {
851          QStringList instlist;          QStringList instlist;
# Line 859  QStringList Channel::getInstrumentList( Line 861  QStringList Channel::getInstrumentList(
861                  if (isDlsInstrumentFile(sInstrumentFile)) {                  if (isDlsInstrumentFile(sInstrumentFile)) {
862                          RIFF::File *pRiff                          RIFF::File *pRiff
863                                  = new RIFF::File(sInstrumentFile.toUtf8().constData());                                  = new RIFF::File(sInstrumentFile.toUtf8().constData());
864                          gig::File  *pGig  = new gig::File(pRiff);                          gig::File *pGig = new gig::File(pRiff);
865                  #if HAVE_LIBGIG_SETAUTOLOAD                  #ifdef CONFIG_LIBGIG_SETAUTOLOAD
866                          // prevent sleepy response time on large .gig files                          // prevent sleepy response time on large .gig files
867                          pGig->SetAutoLoad(false);                          pGig->SetAutoLoad(false);
868                  #endif                  #endif
# Line 872  QStringList Channel::getInstrumentList( Line 874  QStringList Channel::getInstrumentList(
874                          delete pGig;                          delete pGig;
875                          delete pRiff;                          delete pRiff;
876                  }                  }
877            #ifdef CONFIG_LIBGIG_SF2
878                  else                  else
879                  if (isSf2InstrumentFile(sInstrumentFile)) {                  if (isSf2InstrumentFile(sInstrumentFile)) {
880                          RIFF::File *pRiff                          RIFF::File *pRiff
# Line 890  QStringList Channel::getInstrumentList( Line 893  QStringList Channel::getInstrumentList(
893                          delete pSf2;                          delete pSf2;
894                          delete pRiff;                          delete pRiff;
895                  }                  }
896            #endif
897          }          }
898  #endif  #endif
899    
# Line 920  QString Channel::getInstrumentName ( Line 924  QString Channel::getInstrumentName (
924                          RIFF::File *pRiff                          RIFF::File *pRiff
925                                  = new RIFF::File(sInstrumentFile.toUtf8().constData());                                  = new RIFF::File(sInstrumentFile.toUtf8().constData());
926                          gig::File *pGig = new gig::File(pRiff);                          gig::File *pGig = new gig::File(pRiff);
927                  #if HAVE_LIBGIG_SETAUTOLOAD                  #ifdef CONFIG_LIBGIG_SETAUTOLOAD
928                          // prevent sleepy response time on large .gig files                          // prevent sleepy response time on large .gig files
929                          pGig->SetAutoLoad(false);                          pGig->SetAutoLoad(false);
930                  #endif                  #endif
# Line 937  QString Channel::getInstrumentName ( Line 941  QString Channel::getInstrumentName (
941                          delete pGig;                          delete pGig;
942                          delete pRiff;                          delete pRiff;
943                  }                  }
944            #ifdef CONFIG_LIBGIG_SF2
945                  else                  else
946                  if (isSf2InstrumentFile(sInstrumentFile)) {                  if (isSf2InstrumentFile(sInstrumentFile)) {
947                          RIFF::File *pRiff                          RIFF::File *pRiff
# Line 948  QString Channel::getInstrumentName ( Line 953  QString Channel::getInstrumentName (
953                          delete pSf2;                          delete pSf2;
954                          delete pRiff;                          delete pRiff;
955                  }                  }
956            #endif
957          }          }
958  #endif  #endif
959    

Legend:
Removed from v.2563  
changed lines
  Added in v.2647

  ViewVC Help
Powered by ViewVC