Changeset 333 for trunk/libs/hydrogen/src/hydrogen.cpp
- Timestamp:
- 08/17/08 21:45:13 (5 years ago)
- Files:
-
- 1 modified
-
trunk/libs/hydrogen/src/hydrogen.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/hydrogen/src/hydrogen.cpp
r332 r333 1 #include "libs/hydrogen/include/hydrogen/note.h" /* defines Note */ 1 2 /* 2 3 * Hydrogen … … 2239 2240 void Hydrogen::functionDeleteInstrument( int instrumentnumber) 2240 2241 { 2241 AudioEngine::get_instance()->lock("InstrumentLine::Hydrogen::functionDeleteInstrument"); 2242 // hi seems that it not necessary to lock the audio engine for this process 2243 // AudioEngine::get_instance()->lock("InstrumentLine::Hydrogen::functionDeleteInstrument"); 2242 2244 Instrument *pInstr = m_pSong->get_instrument_list()->get( instrumentnumber ); 2243 2245 … … 2247 2249 } 2248 2250 2251 2252 // new! this check if a pattern has an active note 2253 //if there is an note inside the pattern the intrument would not be deleted 2254 PatternList* pPatternList = getSong()->get_pattern_list(); 2255 for ( int nPattern = 0; nPattern < (int)pPatternList->get_size(); ++nPattern ) { 2256 H2Core::Pattern *pPattern = pPatternList->get( nPattern ); 2257 2258 std::multimap <int, Note*>::iterator pos; 2259 for ( pos = pPattern->note_map.begin(); pos != pPattern->note_map.end(); ++pos ) { 2260 Note *pNote = pos->second; 2261 assert( pNote ); 2262 if ( pNote->get_instrument() == pInstr ) { 2263 if( pNote->get_velocity() >= 0.0){ 2264 // AudioEngine::get_instance()->unlock(); 2265 return; 2266 } 2267 } 2268 } 2269 } 2270 2249 2271 // delete the instrument from the instruments list 2250 2272 getSong()->get_instrument_list()->del( instrumentnumber ); 2251 2273 getSong()->__is_modified = true; 2252 2274 2253 2254 2275 // delete all the notes using this instrument 2255 PatternList* pPatternList = getSong()->get_pattern_list();2276 // PatternList* pPatternList = getSong()->get_pattern_list(); 2256 2277 for ( int nPattern = 0; nPattern < (int)pPatternList->get_size(); ++nPattern ) { 2257 2278 H2Core::Pattern *pPattern = pPatternList->get( nPattern ); … … 2273 2294 delete pInstr; 2274 2295 2275 AudioEngine::get_instance()->unlock();2296 // AudioEngine::get_instance()->unlock(); 2276 2297 2277 2298 // this will force an update...