Changeset 2265
- Timestamp:
- 07/12/11 14:37:08 (23 months ago)
- Location:
- trunk/src/core
- Files:
-
- 2 modified
-
include/hydrogen/basics/pattern.h (modified) (1 diff)
-
src/basics/pattern.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/include/hydrogen/basics/pattern.h
r2264 r2265 83 83 */ 84 84 void insert_note( Note* note, int position=-1 ); 85 /** 86 * \brief search for a note at a given index within __notes wich correspond to the given arguments 87 * \param idx the index to search in within __notes 88 * \param instrument the instrument the note should be playing 89 * \param key the key that should be set to the note 90 * \param octave the octave that should be set to the note 91 * \param strict if set to false, will search for a note around the given idx 92 * \return the note if found, 0 otherwise 93 */ 94 Note* find_note( int idx, Instrument* instrument, Note::Key key, Note::Octave octave, bool strict=true); 95 /** 96 * \brief removes a given note from __notes, it's not deleted 97 * \param note the note to be removed 98 */ 99 void remove_note( Note* note ); 85 100 86 101 /** -
trunk/src/core/src/basics/pattern.cpp
r2262 r2265 59 59 } 60 60 61 Note* Pattern::find_note( int idx, Instrument* instrument, Note::Key key, Note::Octave octave, bool strict ) { 62 if (strict) { 63 for( notes_cst_it_t it=note_map.lower_bound(idx); it!=note_map.upper_bound(idx); ++it ) { 64 Note* note = it->second; 65 if (note->match( instrument, key, octave )) return note; 66 } 67 } else { 68 // TODO maybe not start from 0 but idx-X 69 for ( int n=0; n<idx; n++ ) { 70 for( notes_cst_it_t it=note_map.lower_bound(n); it!=note_map.upper_bound(n); ++it ) { 71 Note *note = it->second; 72 if (note->match( instrument, key, octave ) && ( (idx<=note->get_position()+note->get_length()) && idx>=note->get_position() ) ) return note; 73 } 74 } 75 } 76 return 0; 77 } 78 79 void Pattern::remove_note( Note* note ) { 80 for( notes_it_t it=note_map.begin(); it!=note_map.end(); ++it ) { 81 if(it->second==note) { 82 note_map.erase( it ); 83 break; 84 } 85 } 86 } 87 61 88 bool Pattern::references( Instrument* instr ) 62 89 {