/[svn]/qsampler/trunk/src/qsamplerInstrumentList.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerInstrumentList.cpp

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

revision 2070 by capela, Mon Mar 15 17:06:46 2010 UTC revision 2071 by capela, Mon Mar 15 18:21:28 2010 UTC
# Line 190  const Instrument *InstrumentListModel::a Line 190  const Instrument *InstrumentListModel::a
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;
# Line 200  const Instrument *InstrumentListModel::a Line 202  const Instrument *InstrumentListModel::a
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())) {
# Line 223  const Instrument *InstrumentListModel::a Line 224  const Instrument *InstrumentListModel::a
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                          }                          }

Legend:
Removed from v.2070  
changed lines
  Added in v.2071

  ViewVC Help
Powered by ViewVC