/[svn]/linuxsampler/trunk/src/db/InstrumentsDb.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/db/InstrumentsDb.cpp

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

revision 1603 by iliev, Mon Dec 31 10:17:51 2007 UTC revision 1644 by persson, Sat Jan 19 16:55:03 2008 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2007 Grigor Iliev                                       *   *   Copyright (C) 2007, 2008 Grigor Iliev                                 *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 33  Line 33 
33    
34  namespace LinuxSampler {  namespace LinuxSampler {
35    
36      InstrumentsDb* InstrumentsDb::pInstrumentsDb = new InstrumentsDb;      InstrumentsDb InstrumentsDb::instance;
37    
38      void InstrumentsDb::CreateInstrumentsDb(String File) {      void InstrumentsDb::CreateInstrumentsDb(String File) {
39          struct stat statBuf;          struct stat statBuf;
# Line 95  namespace LinuxSampler { Line 95  namespace LinuxSampler {
95          if (db != NULL) sqlite3_close(db);          if (db != NULL) sqlite3_close(db);
96      }      }
97            
     void InstrumentsDb::Destroy() {  
         if (pInstrumentsDb != NULL) {  
             delete pInstrumentsDb;  
             pInstrumentsDb = NULL;  
         }  
     }  
   
98      void InstrumentsDb::AddInstrumentsDbListener(InstrumentsDb::Listener* l) {      void InstrumentsDb::AddInstrumentsDbListener(InstrumentsDb::Listener* l) {
99          llInstrumentsDbListeners.AddListener(l);          llInstrumentsDbListeners.AddListener(l);
100      }      }
# Line 111  namespace LinuxSampler { Line 104  namespace LinuxSampler {
104      }      }
105            
106      InstrumentsDb* InstrumentsDb::GetInstrumentsDb() {      InstrumentsDb* InstrumentsDb::GetInstrumentsDb() {
107          return pInstrumentsDb;          return &instance;
108      }      }
109            
110      void InstrumentsDb::SetDbFile(String File) {      void InstrumentsDb::SetDbFile(String File) {
# Line 128  namespace LinuxSampler { Line 121  namespace LinuxSampler {
121          if ( db != NULL) return db;          if ( db != NULL) return db;
122    
123          if (DbFile.empty()) DbFile = CONFIG_DEFAULT_INSTRUMENTS_DB_LOCATION;          if (DbFile.empty()) DbFile = CONFIG_DEFAULT_INSTRUMENTS_DB_LOCATION;
124                    #if defined(__APPLE__)  /* 20071224 Toshi Nagata  */
125                    if (DbFile.find("~") == 0)
126                            DbFile.replace(0, 1, getenv("HOME"));
127                    #endif
128          int rc = sqlite3_open(DbFile.c_str(), &db);          int rc = sqlite3_open(DbFile.c_str(), &db);
129          if (rc) {          if (rc) {
130              sqlite3_close(db);              sqlite3_close(db);

Legend:
Removed from v.1603  
changed lines
  Added in v.1644

  ViewVC Help
Powered by ViewVC