190 |
// with the very same key (bank, program); |
// with the very same key (bank, program); |
191 |
// if yes, just remove it without prejudice... |
// if yes, just remove it without prejudice... |
192 |
InstrumentList& list = m_instruments[iMap]; |
InstrumentList& list = m_instruments[iMap]; |
193 |
for (int i = 0; i < list.size(); ++i) { |
|
194 |
|
int i = 0; |
195 |
|
for ( ; i < list.size(); ++i) { |
196 |
const Instrument *pInstr = list.at(i); |
const Instrument *pInstr = list.at(i); |
197 |
if (pInstr->bank() == iBank && pInstr->prog() == iProg) { |
if (pInstr->bank() == iBank && pInstr->prog() == iProg) { |
198 |
delete pInstr; |
delete pInstr; |
202 |
} |
} |
203 |
|
|
204 |
// Resolve the appropriate place, we keep the list sorted that way... |
// Resolve the appropriate place, we keep the list sorted that way... |
205 |
int i = 0; |
for (i = 0; i < list.size(); ++i) { |
|
for ( ; i < list.size(); ++i) { |
|
206 |
const Instrument *pInstr = list.at(i); |
const Instrument *pInstr = list.at(i); |
207 |
if (iBank < pInstr->bank() |
if (iBank < pInstr->bank() |
208 |
|| (iBank == pInstr->bank() && iProg < pInstr->prog())) { |
|| (iBank == pInstr->bank() && iProg < pInstr->prog())) { |
224 |
|
|
225 |
void InstrumentListModel::removeInstrument ( Instrument *pInstrument ) |
void InstrumentListModel::removeInstrument ( Instrument *pInstrument ) |
226 |
{ |
{ |
227 |
const int iMap = pInstrument->map(); |
const int iMap = pInstrument->map(); |
|
const int iBank = pInstrument->bank(); |
|
|
const int iProg = pInstrument->prog(); |
|
228 |
|
|
229 |
if (m_instruments.contains(iMap)) { |
if (m_instruments.contains(iMap)) { |
230 |
InstrumentList& list = m_instruments[iMap]; |
InstrumentList& list = m_instruments[iMap]; |
231 |
for (int i = 0; i < list.size(); ++i) { |
for (int i = 0; i < list.size(); ++i) { |
232 |
const Instrument *pInstr = list.at(i); |
if (pInstrument == list.at(i)) { |
233 |
if (pInstr->bank() == iBank && pInstr->prog() == iProg) { |
delete pInstrument; |
|
delete pInstr; |
|
234 |
list.removeAt(i); |
list.removeAt(i); |
235 |
break; |
break; |
236 |
} |
} |