/[svn]/linuxsampler/trunk/src/drivers/midi/MidiInstrumentMapper.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/midi/MidiInstrumentMapper.h

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

revision 947 by schoenebeck, Mon Nov 27 21:34:55 2006 UTC revision 973 by schoenebeck, Fri Dec 15 21:40:27 2006 UTC
# Line 41  namespace LinuxSampler { Line 41  namespace LinuxSampler {
41       * an actual (Sampler Engine, Instrument File, Index) triple, so the       * an actual (Sampler Engine, Instrument File, Index) triple, so the
42       * sampler knows which instrument to load on the respective MIDI program       * sampler knows which instrument to load on the respective MIDI program
43       * change messages.       * change messages.
44         *
45         * The sampler allows to manage arbitrary amount of MIDI instrument
46         * maps. For example you might create (at least) two MIDI instrument
47         * maps: one for "normal" instruments and one for drumkits.
48       */       */
49      class MidiInstrumentMapper {      class MidiInstrumentMapper {
50          public:          public:
# Line 64  namespace LinuxSampler { Line 68  namespace LinuxSampler {
68                  uint   InstrumentIndex; ///< Index of the instrument within its file.                  uint   InstrumentIndex; ///< Index of the instrument within its file.
69                  mode_t LoadMode;        ///< Life-time strategy of instrument.                  mode_t LoadMode;        ///< Life-time strategy of instrument.
70                  float  Volume;          ///< Global volume factor for this instrument.                  float  Volume;          ///< Global volume factor for this instrument.
71                  String Name;            ///< Display name that should be associated with this mapping.                  String Name;            ///< Display name that should be associated with this mapping entry.
72              };              };
73    
74              /**              /**
75               * Adds a new entry to the sampler's MIDI instrument map in case               * Adds a new entry to the given MIDI instrument map in case
76               * an entry with \a Index does not exist yet, otherwise it will               * an entry with \a Index does not exist yet, otherwise it will
77               * replace the existing entry. Note that some given settings               * replace the existing entry. Note that some given settings
78               * might simply be ignored or might change the settings of other               * might simply be ignored or might change the settings of other
# Line 84  namespace LinuxSampler { Line 88  namespace LinuxSampler {
88               * (in that case you won't catch loading errors though, i.e. if               * (in that case you won't catch loading errors though, i.e. if
89               * the file does not exist or might be corrupt for example).               * the file does not exist or might be corrupt for example).
90               *               *
91                 * @param Map   - map index
92               * @param Index - unique index of the new entry to add               * @param Index - unique index of the new entry to add
93               * @param Entry - the actual instrument and settings               * @param Entry - the actual instrument and settings
94               * @throws Exception - if the given engine type does not exist or instrument loading failed               * @param bInBackground - avoid this method to block for long time
95                 * @throws Exception - if the given map or engine type does not
96                 *                     exist or instrument loading failed
97               */               */
98              static void AddOrReplaceMapping(midi_prog_index_t Index, entry_t Entry, bool bInBackground = false) throw (Exception);              static void AddOrReplaceEntry(int Map, midi_prog_index_t Index, entry_t Entry, bool bInBackground = false) throw (Exception);
99    
100              /**              /**
101               * Remove an existing entry from the MIDI instrument map.               * Remove an existing entry from the MIDI instrument map.
102               *               *
103                 * @param Map   - map index
104               * @param Index - index of entry to delete               * @param Index - index of entry to delete
105               */               */
106              static void RemoveMapping(midi_prog_index_t Index);              static void RemoveEntry(int Map, midi_prog_index_t Index);
107    
108              /**              /**
109               * Clear the whole MIDI instrument map, that is delete all               * Clear the whole given MIDI instrument map, that is delete all
110               * entries.               * its entries.
111                 *
112                 * @param Map - map index
113               */               */
114              static void RemoveAllMappings();              static void RemoveAllEntries(int Map);
115    
116              /**              /**
117               * Returns the currently existing MIDI instrument map entries               * Returns the currently existing MIDI instrument map entries
118               * with their current settings.               * of the given map with their current settings.
119                 *
120                 * @param Map - map index
121                 * @throws Exception - in case \a Map does not exist
122                 */
123                static std::map<midi_prog_index_t,entry_t> Entries(int Map) throw (Exception);
124    
125                /**
126                 * Returns the IDs of all currently existing MIDI instrument
127                 * maps.
128                 */
129                static std::vector<int> Maps();
130    
131                /**
132                 * Create a new MIDI instrument map. Optionally you can assign
133                 * a custom name for the map. Map names don't have to be unique.
134                 *
135                 * @param MapName - (optional) name for the map
136                 * @returns ID of the new map
137                 * @throws Exception - if there's no free map ID left
138                 */
139                static int AddMap(String MapName = "") throw (Exception) ;
140    
141                /**
142                 * Returns the custom name of the given map.
143                 *
144                 * @param Map - map index
145                 * @throws Exception - if given map does not exist
146                 */
147                static String MapName(int Map) throw (Exception);
148    
149                /**
150                 * Rename the given, already existing map. Map names don't have
151                 * to be unique.
152                 *
153                 * @param Map - map index
154                 * @param NewName - the map's new name to be assigned
155                 * @throws Exception - if the given map does not exist
156                 */
157                static void RenameMap(int Map, String NewName) throw (Exception);
158    
159                /**
160                 * Delete the given map.
161                 *
162                 * @param Map - ID of the map to delete
163                 */
164                static void RemoveMap(int Map);
165    
166                /**
167                 * Completely delete all existing maps.
168               */               */
169              static std::map<midi_prog_index_t,entry_t> Mappings();              static void RemoveAllMaps();
170    
171          protected:          protected:
172              static optional<entry_t> GetEntry(midi_prog_index_t Index); // shall only be used by MidiInputPort ATM (see source comment)              static optional<entry_t> GetEntry(int Map, midi_prog_index_t Index); // shall only be used by MidiInputPort ATM (see source comment)
173              friend class MidiInputPort; // allow MidiInputPort to access GetEntry()              friend class MidiInputPort; // allow MidiInputPort to access GetEntry()
174      };      };
175    

Legend:
Removed from v.947  
changed lines
  Added in v.973

  ViewVC Help
Powered by ViewVC