41 |
m_pMainForm = NULL; |
m_pMainForm = NULL; |
42 |
m_iChannelID = 0; |
m_iChannelID = 0; |
43 |
|
|
44 |
// m_sEngineName = "(No engine)"; |
// m_sEngineName = tr("(No engine)"); |
45 |
// m_sInstrumentFile = "(No instrument)"; |
// m_sInstrumentFile = tr("(No instrument)"); |
46 |
m_iInstrumentNr = 0; |
m_iInstrumentNr = -1; |
47 |
m_sMidiDriver = "ALSA"; // DEPRECATED. |
m_iInstrumentStatus = -1; |
48 |
m_iMidiDevice = 0; |
m_sMidiDriver = "Alsa"; // DEPRECATED. |
49 |
m_iMidiPort = 0; |
m_iMidiDevice = -1; |
50 |
m_iMidiChannel = 0; |
m_iMidiPort = -1; |
51 |
m_sAudioDriver = "ALSA"; // DEPRECATED. |
m_iMidiChannel = -1; |
52 |
m_iAudioDevice = 0; |
m_sAudioDriver = "Alsa"; // DEPRECATED. |
53 |
m_fVolume = 0.8; |
m_iAudioDevice = -1; |
54 |
|
m_fVolume = 0.0; |
55 |
|
|
56 |
m_iDirtyChange = 0; |
m_iDirtyChange = 0; |
57 |
|
|
131 |
} |
} |
132 |
|
|
133 |
|
|
134 |
// Instrument filename accessors. |
// Instrument filename accessor. |
135 |
QString& qsamplerChannelStrip::instrumentFile (void) |
QString& qsamplerChannelStrip::instrumentFile (void) |
136 |
{ |
{ |
137 |
return m_sInstrumentFile; |
return m_sInstrumentFile; |
138 |
} |
} |
139 |
|
|
140 |
// Instrument index accessors. |
// Instrument index accessor. |
141 |
int qsamplerChannelStrip::instrumentNr (void) |
int qsamplerChannelStrip::instrumentNr (void) |
142 |
{ |
{ |
143 |
return m_iInstrumentNr; |
return m_iInstrumentNr; |
144 |
} |
} |
145 |
|
|
146 |
|
// Instrument status accessor. |
147 |
|
int qsamplerChannelStrip::instrumentStatus (void) |
148 |
|
{ |
149 |
|
return m_iInstrumentStatus; |
150 |
|
} |
151 |
|
|
152 |
|
// Instrument file loader. |
153 |
bool qsamplerChannelStrip::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr ) |
bool qsamplerChannelStrip::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr ) |
154 |
{ |
{ |
155 |
if (client() == NULL) |
if (client() == NULL) |
156 |
return false; |
return false; |
157 |
|
|
158 |
if (::lscp_load_instrument(client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) { |
if (::lscp_load_instrument_non_modal(client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) { |
159 |
appendMessagesClient("lscp_load_instrument"); |
appendMessagesClient("lscp_load_instrument"); |
160 |
return false; |
return false; |
161 |
} |
} |
162 |
|
|
163 |
m_sInstrumentFile = sInstrumentFile; |
m_sInstrumentFile = sInstrumentFile; |
164 |
m_iInstrumentNr = iInstrumentNr; |
m_iInstrumentNr = iInstrumentNr; |
165 |
|
m_iInstrumentStatus = 0; |
166 |
|
|
167 |
return true; |
return true; |
168 |
} |
} |
169 |
|
|
200 |
if (client() == NULL) |
if (client() == NULL) |
201 |
return false; |
return false; |
202 |
|
|
203 |
// FIXME: call this when LSCP becomes stable. |
if (::lscp_set_channel_midi_device(client(), m_iChannelID, iMidiDevice) != LSCP_OK) { |
204 |
// if (::lscp_set_channel_midi_device(client(), m_iChannelID, iMidiDevice) != LSCP_OK) { |
appendMessagesClient("lscp_set_channel_midi_device"); |
205 |
// appendMessagesClient("lscp_set_channel_midi_device"); |
return false; |
206 |
// return false; |
} |
|
// } |
|
207 |
|
|
208 |
m_iMidiDevice = iMidiDevice; |
m_iMidiDevice = iMidiDevice; |
209 |
return true; |
return true; |
221 |
if (client() == NULL) |
if (client() == NULL) |
222 |
return false; |
return false; |
223 |
|
|
224 |
// FIXME: call this when LSCP becomes stable. |
if (::lscp_set_channel_midi_port(client(), m_iChannelID, iMidiPort) != LSCP_OK) { |
225 |
// if (::lscp_set_channel_midi_port(client(), m_iChannelID, iMidiPort) != LSCP_OK) { |
appendMessagesClient("lscp_set_channel_midi_port"); |
226 |
// appendMessagesClient("lscp_set_channel_midi_port"); |
return false; |
227 |
// return false; |
} |
|
// } |
|
228 |
|
|
229 |
m_iMidiPort = iMidiPort; |
m_iMidiPort = iMidiPort; |
230 |
return true; |
return true; |
242 |
if (client() == NULL) |
if (client() == NULL) |
243 |
return false; |
return false; |
244 |
|
|
245 |
// FIXME: call this when LSCP becomes stable. |
if (::lscp_set_channel_midi_channel(client(), m_iChannelID, iMidiChannel) != LSCP_OK) { |
246 |
// if (::lscp_set_channel_midi_channel(client(), m_iChannelID, iMidiChannel) != LSCP_OK) { |
appendMessagesClient("lscp_set_channel_midi_channel"); |
247 |
// appendMessagesClient("lscp_set_channel_midi_channel"); |
return false; |
248 |
// return false; |
} |
|
// } |
|
249 |
|
|
250 |
m_iMidiChannel = iMidiChannel; |
m_iMidiChannel = iMidiChannel; |
251 |
return true; |
return true; |
263 |
if (client() == NULL) |
if (client() == NULL) |
264 |
return false; |
return false; |
265 |
|
|
266 |
// FIXME: call this when LSCP becomes stable. |
if (::lscp_set_channel_audio_device(client(), m_iChannelID, iAudioDevice) != LSCP_OK) { |
267 |
// if (::lscp_set_channel_audio_device(client(), m_iChannelID, iAudioDevice) != LSCP_OK) { |
appendMessagesClient("lscp_set_channel_audio_device"); |
268 |
// appendMessagesClient("lscp_set_channel_audio_device"); |
return false; |
269 |
// return false; |
} |
|
// } |
|
270 |
|
|
271 |
m_iAudioDevice = iAudioDevice; |
m_iAudioDevice = iAudioDevice; |
272 |
return true; |
return true; |
324 |
void qsamplerChannelStrip::setDisplayFont ( const QFont & font ) |
void qsamplerChannelStrip::setDisplayFont ( const QFont & font ) |
325 |
{ |
{ |
326 |
EngineNameTextLabel->setFont(font); |
EngineNameTextLabel->setFont(font); |
|
InstrumentNameTextLabel->setFont(font); |
|
327 |
MidiPortChannelTextLabel->setFont(font); |
MidiPortChannelTextLabel->setFont(font); |
328 |
|
InstrumentNameTextLabel->setFont(font); |
329 |
|
InstrumentStatusTextLabel->setFont(font); |
330 |
} |
} |
331 |
|
|
332 |
// Channel setup dialog. |
// Channel setup dialog. |
360 |
lscp_channel_info_t *pChannelInfo = ::lscp_get_channel_info(client(), m_iChannelID); |
lscp_channel_info_t *pChannelInfo = ::lscp_get_channel_info(client(), m_iChannelID); |
361 |
if (pChannelInfo == NULL) { |
if (pChannelInfo == NULL) { |
362 |
appendMessagesClient("lscp_get_channel_info"); |
appendMessagesClient("lscp_get_channel_info"); |
363 |
// appendMessagesError(tr("Could not get channel information.\n\nSorry.")); |
appendMessagesError(tr("Could not get channel information.\n\nSorry.")); |
364 |
} else { |
} else { |
365 |
// Cache in channel information. |
// Cache in channel information. |
366 |
m_sEngineName = pChannelInfo->engine_name; |
m_sEngineName = pChannelInfo->engine_name; |
367 |
m_sInstrumentFile = pChannelInfo->instrument_file; |
m_sInstrumentFile = pChannelInfo->instrument_file; |
368 |
m_iInstrumentNr = pChannelInfo->instrument_nr; |
m_iInstrumentNr = pChannelInfo->instrument_nr; |
369 |
m_iMidiDevice = pChannelInfo->midi_device; |
m_iInstrumentStatus = pChannelInfo->instrument_status; |
370 |
m_iMidiPort = pChannelInfo->midi_port; |
m_iMidiDevice = pChannelInfo->midi_device; |
371 |
m_iMidiChannel = pChannelInfo->midi_channel; |
m_iMidiPort = pChannelInfo->midi_port; |
372 |
m_iAudioDevice = pChannelInfo->audio_device; |
m_iMidiChannel = pChannelInfo->midi_channel; |
373 |
m_fVolume = pChannelInfo->volume; |
m_iAudioDevice = pChannelInfo->audio_device; |
374 |
|
m_fVolume = pChannelInfo->volume; |
375 |
|
// Some sanity checks. |
376 |
|
if (m_sEngineName == "NONE") |
377 |
|
m_sEngineName = QString::null; |
378 |
|
if (m_sInstrumentFile == "NONE") |
379 |
|
m_sInstrumentFile = QString::null; |
380 |
} |
} |
381 |
|
|
382 |
// Set some proper display values. |
// Set some proper display values. |
394 |
InstrumentNameTextLabel->setText(QString("%1 [%2]") |
InstrumentNameTextLabel->setText(QString("%1 [%2]") |
395 |
.arg(QFileInfo(m_sInstrumentFile).fileName()).arg(m_iInstrumentNr)); |
.arg(QFileInfo(m_sInstrumentFile).fileName()).arg(m_iInstrumentNr)); |
396 |
|
|
397 |
|
// Instrument status... |
398 |
|
if (m_iInstrumentStatus < 0) { |
399 |
|
InstrumentStatusTextLabel->setPaletteForegroundColor(Qt::red); |
400 |
|
InstrumentStatusTextLabel->setText(tr("ERR%1").arg(m_iInstrumentStatus)); |
401 |
|
} else { |
402 |
|
InstrumentStatusTextLabel->setPaletteForegroundColor(m_iInstrumentStatus < 100 ? Qt::yellow : Qt::green); |
403 |
|
InstrumentStatusTextLabel->setText(QString::number(m_iInstrumentStatus) + "%"); |
404 |
|
} |
405 |
|
|
406 |
// MIDI Port/Channel... |
// MIDI Port/Channel... |
407 |
MidiPortChannelTextLabel->setText(QString("%1 / %2") |
MidiPortChannelTextLabel->setText(QString("%1 / %2") |
408 |
.arg(m_iMidiPort).arg(m_iMidiChannel)); |
.arg(m_iMidiPort).arg(m_iMidiChannel)); |
447 |
if (client() == NULL) |
if (client() == NULL) |
448 |
return; |
return; |
449 |
|
|
450 |
|
// Conditionally update whole channel status info. |
451 |
|
if (m_iInstrumentStatus >= 0 && m_iInstrumentStatus < 100) |
452 |
|
updateChannelInfo(); |
453 |
|
|
454 |
// Get current channel voice count. |
// Get current channel voice count. |
455 |
int iVoiceCount = ::lscp_get_channel_voice_count(client(), m_iChannelID); |
int iVoiceCount = ::lscp_get_channel_voice_count(client(), m_iChannelID); |
456 |
// Get current stream count. |
// Get current stream count. |