50 |
// m_sInstrumentFile = m_sInstrumentName; |
// m_sInstrumentFile = m_sInstrumentName; |
51 |
m_iInstrumentNr = -1; |
m_iInstrumentNr = -1; |
52 |
m_iInstrumentStatus = -1; |
m_iInstrumentStatus = -1; |
53 |
m_sMidiDriver = "Alsa"; // DEPRECATED. |
m_sMidiDriver = "ALSA"; |
54 |
m_iMidiDevice = -1; |
m_iMidiDevice = -1; |
55 |
m_iMidiPort = -1; |
m_iMidiPort = -1; |
56 |
m_iMidiChannel = -1; |
m_iMidiChannel = -1; |
57 |
m_sAudioDriver = "Alsa"; // DEPRECATED. |
m_sAudioDriver = "ALSA"; |
58 |
m_iAudioDevice = -1; |
m_iAudioDevice = -1; |
59 |
m_fVolume = 0.0; |
m_fVolume = 0.0; |
60 |
|
|
66 |
} |
} |
67 |
|
|
68 |
|
|
69 |
|
// Main application form accessor. |
70 |
|
qsamplerMainForm *qsamplerChannel::mainForm(void) const |
71 |
|
{ |
72 |
|
return m_pMainForm; |
73 |
|
} |
74 |
|
|
75 |
|
|
76 |
// The global options settings delegated property. |
// The global options settings delegated property. |
77 |
qsamplerOptions *qsamplerChannel::options (void) |
qsamplerOptions *qsamplerChannel::options (void) const |
78 |
{ |
{ |
79 |
if (m_pMainForm == NULL) |
if (m_pMainForm == NULL) |
80 |
return NULL; |
return NULL; |
84 |
|
|
85 |
|
|
86 |
// The client descriptor delegated property. |
// The client descriptor delegated property. |
87 |
lscp_client_t *qsamplerChannel::client (void) |
lscp_client_t *qsamplerChannel::client (void) const |
88 |
{ |
{ |
89 |
if (m_pMainForm == NULL) |
if (m_pMainForm == NULL) |
90 |
return NULL; |
return NULL; |
131 |
m_iChannelID = -1; |
m_iChannelID = -1; |
132 |
} |
} |
133 |
} |
} |
134 |
|
|
135 |
// Return whether we've removed the channel... |
// Return whether we've removed the channel... |
136 |
return (m_iChannelID < 0); |
return (m_iChannelID < 0); |
137 |
} |
} |
138 |
|
|
139 |
|
|
140 |
// Channel-ID (aka Sammpler-Channel) accessors. |
// Channel-ID (aka Sammpler-Channel) accessors. |
141 |
int qsamplerChannel::channelID (void) |
int qsamplerChannel::channelID (void) const |
142 |
{ |
{ |
143 |
return m_iChannelID; |
return m_iChannelID; |
144 |
} |
} |
150 |
|
|
151 |
|
|
152 |
// Readable channel name. |
// Readable channel name. |
153 |
QString qsamplerChannel::channelName (void) |
QString qsamplerChannel::channelName (void) const |
154 |
{ |
{ |
155 |
return (m_iChannelID < 0 ? QObject::tr("New Channel") : QObject::tr("Channel %1").arg(m_iChannelID)); |
return (m_iChannelID < 0 ? QObject::tr("New Channel") : QObject::tr("Channel %1").arg(m_iChannelID)); |
156 |
} |
} |
157 |
|
|
158 |
|
|
159 |
// Engine name accessors. |
// Engine name accessors. |
160 |
QString& qsamplerChannel::engineName (void) |
const QString& qsamplerChannel::engineName (void) const |
161 |
{ |
{ |
162 |
return m_sEngineName; |
return m_sEngineName; |
163 |
} |
} |
168 |
return false; |
return false; |
169 |
if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName) |
if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName) |
170 |
return true; |
return true; |
171 |
|
|
172 |
if (::lscp_load_engine(client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) { |
if (::lscp_load_engine(client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) { |
173 |
appendMessagesClient("lscp_load_engine"); |
appendMessagesClient("lscp_load_engine"); |
174 |
return false; |
return false; |
181 |
|
|
182 |
|
|
183 |
// Instrument filename accessor. |
// Instrument filename accessor. |
184 |
QString& qsamplerChannel::instrumentFile (void) |
const QString& qsamplerChannel::instrumentFile (void) const |
185 |
{ |
{ |
186 |
return m_sInstrumentFile; |
return m_sInstrumentFile; |
187 |
} |
} |
188 |
|
|
189 |
// Instrument index accessor. |
// Instrument index accessor. |
190 |
int qsamplerChannel::instrumentNr (void) |
int qsamplerChannel::instrumentNr (void) const |
191 |
{ |
{ |
192 |
return m_iInstrumentNr; |
return m_iInstrumentNr; |
193 |
} |
} |
194 |
|
|
195 |
// Instrument name accessor. |
// Instrument name accessor. |
196 |
QString& qsamplerChannel::instrumentName (void) |
const QString& qsamplerChannel::instrumentName (void) const |
197 |
{ |
{ |
198 |
return m_sInstrumentName; |
return m_sInstrumentName; |
199 |
} |
} |
200 |
|
|
201 |
// Instrument status accessor. |
// Instrument status accessor. |
202 |
int qsamplerChannel::instrumentStatus (void) |
int qsamplerChannel::instrumentStatus (void) const |
203 |
{ |
{ |
204 |
return m_iInstrumentStatus; |
return m_iInstrumentStatus; |
205 |
} |
} |
221 |
|
|
222 |
appendMessages(QObject::tr("Instrument: \"%1\" (%2).") |
appendMessages(QObject::tr("Instrument: \"%1\" (%2).") |
223 |
.arg(sInstrumentFile).arg(iInstrumentNr)); |
.arg(sInstrumentFile).arg(iInstrumentNr)); |
224 |
|
|
225 |
return setInstrument(sInstrumentFile, iInstrumentNr); |
return setInstrument(sInstrumentFile, iInstrumentNr); |
226 |
} |
} |
227 |
|
|
243 |
|
|
244 |
|
|
245 |
// MIDI driver type accessors (DEPRECATED). |
// MIDI driver type accessors (DEPRECATED). |
246 |
QString& qsamplerChannel::midiDriver (void) |
const QString& qsamplerChannel::midiDriver (void) const |
247 |
{ |
{ |
248 |
return m_sMidiDriver; |
return m_sMidiDriver; |
249 |
} |
} |
268 |
|
|
269 |
|
|
270 |
// MIDI device accessors. |
// MIDI device accessors. |
271 |
int qsamplerChannel::midiDevice (void) |
int qsamplerChannel::midiDevice (void) const |
272 |
{ |
{ |
273 |
return m_iMidiDevice; |
return m_iMidiDevice; |
274 |
} |
} |
293 |
|
|
294 |
|
|
295 |
// MIDI port number accessor. |
// MIDI port number accessor. |
296 |
int qsamplerChannel::midiPort (void) |
int qsamplerChannel::midiPort (void) const |
297 |
{ |
{ |
298 |
return m_iMidiPort; |
return m_iMidiPort; |
299 |
} |
} |
318 |
|
|
319 |
|
|
320 |
// MIDI channel accessor. |
// MIDI channel accessor. |
321 |
int qsamplerChannel::midiChannel (void) |
int qsamplerChannel::midiChannel (void) const |
322 |
{ |
{ |
323 |
return m_iMidiChannel; |
return m_iMidiChannel; |
324 |
} |
} |
343 |
|
|
344 |
|
|
345 |
// Audio device accessor. |
// Audio device accessor. |
346 |
int qsamplerChannel::audioDevice (void) |
int qsamplerChannel::audioDevice (void) const |
347 |
{ |
{ |
348 |
return m_iAudioDevice; |
return m_iAudioDevice; |
349 |
} |
} |
368 |
|
|
369 |
|
|
370 |
// Audio driver type accessors (DEPRECATED). |
// Audio driver type accessors (DEPRECATED). |
371 |
QString& qsamplerChannel::audioDriver (void) |
const QString& qsamplerChannel::audioDriver (void) const |
372 |
{ |
{ |
373 |
return m_sAudioDriver; |
return m_sAudioDriver; |
374 |
} |
} |
393 |
|
|
394 |
|
|
395 |
// Channel volume accessors. |
// Channel volume accessors. |
396 |
float qsamplerChannel::volume (void) |
float qsamplerChannel::volume (void) const |
397 |
{ |
{ |
398 |
return m_fVolume; |
return m_fVolume; |
399 |
} |
} |
472 |
m_sInstrumentFile = QString::null; |
m_sInstrumentFile = QString::null; |
473 |
m_sInstrumentName = QString::null; |
m_sInstrumentName = QString::null; |
474 |
} |
} |
475 |
|
|
476 |
// FIXME: DEPRECATED... |
// Time for device info grabbing... |
477 |
lscp_device_info_t *pDeviceInfo; |
lscp_device_info_t *pDeviceInfo; |
478 |
const QString sNone = QObject::tr("(none)"); |
const QString sNone = QObject::tr("(none)"); |
479 |
// Audio device driver type. |
// Audio device driver type. |
520 |
bool bResult = false; |
bool bResult = false; |
521 |
|
|
522 |
appendMessages(QObject::tr("setup...")); |
appendMessages(QObject::tr("setup...")); |
523 |
|
|
524 |
qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(pParent); |
qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(pParent); |
525 |
if (pChannelForm) { |
if (pChannelForm) { |
526 |
pChannelForm->setup(this); |
pChannelForm->setup(this); |
533 |
|
|
534 |
|
|
535 |
// Redirected messages output methods. |
// Redirected messages output methods. |
536 |
void qsamplerChannel::appendMessages( const QString& s ) |
void qsamplerChannel::appendMessages( const QString& s ) const |
537 |
{ |
{ |
538 |
if (m_pMainForm) |
if (m_pMainForm) |
539 |
m_pMainForm->appendMessages(channelName() + ' ' + s); |
m_pMainForm->appendMessages(channelName() + ' ' + s); |
540 |
} |
} |
541 |
|
|
542 |
void qsamplerChannel::appendMessagesColor( const QString& s, const QString& c ) |
void qsamplerChannel::appendMessagesColor( const QString& s, |
543 |
|
const QString& c ) const |
544 |
{ |
{ |
545 |
if (m_pMainForm) |
if (m_pMainForm) |
546 |
m_pMainForm->appendMessagesColor(channelName() + ' ' + s, c); |
m_pMainForm->appendMessagesColor(channelName() + ' ' + s, c); |
547 |
} |
} |
548 |
|
|
549 |
void qsamplerChannel::appendMessagesText( const QString& s ) |
void qsamplerChannel::appendMessagesText( const QString& s ) const |
550 |
{ |
{ |
551 |
if (m_pMainForm) |
if (m_pMainForm) |
552 |
m_pMainForm->appendMessagesText(channelName() + ' ' + s); |
m_pMainForm->appendMessagesText(channelName() + ' ' + s); |
553 |
} |
} |
554 |
|
|
555 |
void qsamplerChannel::appendMessagesError( const QString& s ) |
void qsamplerChannel::appendMessagesError( const QString& s ) const |
556 |
{ |
{ |
557 |
if (m_pMainForm) |
if (m_pMainForm) |
558 |
m_pMainForm->appendMessagesError(channelName() + "\n\n" + s); |
m_pMainForm->appendMessagesError(channelName() + "\n\n" + s); |
559 |
} |
} |
560 |
|
|
561 |
void qsamplerChannel::appendMessagesClient( const QString& s ) |
void qsamplerChannel::appendMessagesClient( const QString& s ) const |
562 |
{ |
{ |
563 |
if (m_pMainForm) |
if (m_pMainForm) |
564 |
m_pMainForm->appendMessagesClient(channelName() + ' ' + s); |
m_pMainForm->appendMessagesClient(channelName() + ' ' + s); |
602 |
if (isInstrumentFile(sInstrumentFile)) { |
if (isInstrumentFile(sInstrumentFile)) { |
603 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
604 |
if (bInstrumentNames) { |
if (bInstrumentNames) { |
605 |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile); |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile.latin1()); |
606 |
gig::File *pGig = new gig::File(pRiff); |
gig::File *pGig = new gig::File(pRiff); |
607 |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
608 |
while (pInstrument) { |
while (pInstrument) { |
633 |
sInstrumentName = QFileInfo(sInstrumentFile).fileName(); |
sInstrumentName = QFileInfo(sInstrumentFile).fileName(); |
634 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
635 |
if (bInstrumentNames) { |
if (bInstrumentNames) { |
636 |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile); |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile.latin1()); |
637 |
gig::File *pGig = new gig::File(pRiff); |
gig::File *pGig = new gig::File(pRiff); |
638 |
int iIndex = 0; |
int iIndex = 0; |
639 |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
669 |
return QObject::tr("(No instrument)"); |
return QObject::tr("(No instrument)"); |
670 |
} |
} |
671 |
|
|
672 |
|
QString qsamplerChannel::loadingInstrument (void) { |
673 |
|
return QObject::tr("(Loading instrument...)"); |
674 |
|
} |
675 |
|
|
676 |
|
|
677 |
// end of qsamplerChannel.cpp |
// end of qsamplerChannel.cpp |