53 |
|
|
54 |
|
|
55 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
56 |
// MidiInstrumentsModel - data model for MIDI prog mappings (used for QTableView) |
// QSampler::MidiInstrumentsModel - data model for MIDI prog mappings |
57 |
// |
// (used for QTableView) |
58 |
|
|
59 |
MidiInstrumentsModel::MidiInstrumentsModel ( QObject* pParent) |
MidiInstrumentsModel::MidiInstrumentsModel ( QObject* pParent) |
60 |
: QAbstractTableModel(pParent) |
: QAbstractTableModel(pParent) |
89 |
if (!index.isValid()) |
if (!index.isValid()) |
90 |
return QVariant(); |
return QVariant(); |
91 |
|
|
92 |
const qsamplerInstrument* pInstr = NULL; |
const Instrument* pInstr = NULL; |
93 |
|
|
94 |
if (m_iMidiMap == LSCP_MIDI_MAP_ALL) { |
if (m_iMidiMap == LSCP_MIDI_MAP_ALL) { |
95 |
int n = 0; |
int n = 0; |
162 |
} |
} |
163 |
|
|
164 |
|
|
165 |
qsamplerInstrument* MidiInstrumentsModel::addInstrument ( |
Instrument* MidiInstrumentsModel::addInstrument ( |
166 |
int iMap, int iBank, int iProg ) |
int iMap, int iBank, int iProg ) |
167 |
{ |
{ |
168 |
// Check it there's already one instrument item |
// Check it there's already one instrument item |
186 |
} |
} |
187 |
} |
} |
188 |
|
|
189 |
m_instruments[iMap].insert(i, qsamplerInstrument(iMap, iBank, iProg)); |
m_instruments[iMap].insert(i, Instrument(iMap, iBank, iProg)); |
190 |
qsamplerInstrument& instr = m_instruments[iMap][i]; |
Instrument& instr = m_instruments[iMap][i]; |
191 |
if (!instr.getInstrument()) |
if (!instr.getInstrument()) |
192 |
m_instruments[iMap].removeAt(i); |
m_instruments[iMap].removeAt(i); |
193 |
|
|
196 |
|
|
197 |
|
|
198 |
void MidiInstrumentsModel::removeInstrument ( |
void MidiInstrumentsModel::removeInstrument ( |
199 |
const qsamplerInstrument& instrument ) |
const Instrument& instrument ) |
200 |
{ |
{ |
201 |
const int iMap = instrument.map(); |
const int iMap = instrument.map(); |
202 |
const int iBank = instrument.bank(); |
const int iBank = instrument.bank(); |
212 |
|
|
213 |
|
|
214 |
// Reposition the instrument in the model (called when map/bank/prg changed) |
// Reposition the instrument in the model (called when map/bank/prg changed) |
215 |
void MidiInstrumentsModel::resort ( const qsamplerInstrument& instrument ) |
void MidiInstrumentsModel::resort ( const Instrument& instrument ) |
216 |
{ |
{ |
217 |
const int iMap = instrument.map(); |
const int iMap = instrument.map(); |
218 |
const int iBank = instrument.bank(); |
const int iBank = instrument.bank(); |
276 |
|
|
277 |
|
|
278 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
279 |
// MidiInstrumentsDelegate - table cell renderer for MIDI prog mappings |
// QSampler::MidiInstrumentsDelegate - table cell renderer for MIDI prog |
280 |
// (doesn't actually do anything ATM, but is already there for a future |
// mappings (doesn't actually do anything ATM, but is already there for a |
281 |
// cell editor widget implementation) |
// future cell editor widget implementation) |
282 |
|
|
283 |
MidiInstrumentsDelegate::MidiInstrumentsDelegate ( QObject* pParent ) |
MidiInstrumentsDelegate::MidiInstrumentsDelegate ( QObject* pParent ) |
284 |
: QItemDelegate(pParent) |
: QItemDelegate(pParent) |