175 |
} |
} |
176 |
} |
} |
177 |
|
|
178 |
// resolve the appropriate place, we keep the list sorted that way ... |
// Resolve the appropriate place, we keep the list sorted that way ... |
179 |
int i = 0; |
int i = 0; |
180 |
for (; i < m_instruments[iMap].size(); i++) |
for (; i < m_instruments[iMap].size(); ++i) { |
181 |
if (iBank > m_instruments[iMap][i].bank() |
if (iBank < m_instruments[iMap][i].bank() |
182 |
|| (iBank == m_instruments[iMap][i].bank() && |
|| (iBank == m_instruments[iMap][i].bank() && |
183 |
iProg > m_instruments[iMap][i].prog())) |
iProg < m_instruments[iMap][i].prog())) { |
184 |
break; |
break; |
185 |
|
} |
186 |
|
} |
187 |
|
|
188 |
m_instruments[iMap].insert(i, qsamplerInstrument(iMap, iBank, iProg)); |
m_instruments[iMap].insert(i, qsamplerInstrument(iMap, iBank, iProg)); |
189 |
qsamplerInstrument& instr = m_instruments[iMap][i]; |
qsamplerInstrument& instr = m_instruments[iMap][i]; |
211 |
|
|
212 |
|
|
213 |
// Reposition the instrument in the model (called when map/bank/prg changed) |
// Reposition the instrument in the model (called when map/bank/prg changed) |
214 |
void MidiInstrumentsModel::resort ( const qsamplerInstrument instrument ) |
void MidiInstrumentsModel::resort ( const qsamplerInstrument& instrument ) |
215 |
{ |
{ |
216 |
const int iMap = instrument.map(); |
const int iMap = instrument.map(); |
217 |
const int iBank = instrument.bank(); |
const int iBank = instrument.bank(); |
218 |
const int iProg = instrument.prog(); |
const int iProg = instrument.prog(); |
219 |
// remove given instrument from its current list |
// Remove given instrument from its current list |
220 |
removeInstrument(instrument); |
removeInstrument(instrument); |
221 |
// re-add the instrument |
// Re-add the instrument |
222 |
addInstrument(iMap, iBank, iProg); |
addInstrument(iMap, iBank, iProg); |
223 |
} |
} |
224 |
|
|