1 |
// qsamplerChannel.cpp |
// qsamplerChannel.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2003-2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
7 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
38 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
39 |
// qsamplerChannel - Sampler channel structure. |
// qsamplerChannel - Sampler channel structure. |
40 |
// |
// |
41 |
|
bool qsamplerChannel::g_bInstrumentNames = false; |
42 |
|
|
43 |
// Constructor. |
// Constructor. |
44 |
qsamplerChannel::qsamplerChannel ( qsamplerMainForm *pMainForm, int iChannelID ) |
qsamplerChannel::qsamplerChannel ( qsamplerMainForm *pMainForm, int iChannelID ) |
463 |
|
|
464 |
if (fileinfo.exists()) { |
if (fileinfo.exists()) { |
465 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
466 |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile); |
if (g_bInstrumentNames) { |
467 |
gig::File *pGig = new gig::File(pRiff); |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile); |
468 |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
gig::File *pGig = new gig::File(pRiff); |
469 |
while (pInstrument) { |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
470 |
sInstrumentName = (pInstrument->pInfo)->Name; |
while (pInstrument) { |
471 |
instlist.append(sInstrumentName); |
instlist.append((pInstrument->pInfo)->Name.c_str()); |
472 |
pInstrument = pGig->GetNextInstrument(); |
pInstrument = pGig->GetNextInstrument(); |
473 |
} |
} |
474 |
delete pGig; |
delete pGig; |
475 |
delete pRiff; |
delete pRiff; |
476 |
|
} |
477 |
|
else |
478 |
#else |
#else |
479 |
for (int iInstrumentNr = 0; iInstrumentNr < QSAMPLER_INSTRUMENT_MAX; iInstrumentNr++) |
for (int iInstrumentNr = 0; iInstrumentNr < QSAMPLER_INSTRUMENT_MAX; iInstrumentNr++) |
480 |
instlist.append(sInstrumentName + " [" + QString::number(iInstrumentNr) + "]"); |
instlist.append(sInstrumentName + " [" + QString::number(iInstrumentNr) + "]"); |
481 |
#endif |
#endif |
482 |
} |
} |
483 |
else instlist.append(sInstrumentName); |
else instlist.append(sInstrumentName); |
484 |
|
|
485 |
return instlist; |
return instlist; |
486 |
} |
} |
487 |
|
|
494 |
|
|
495 |
if (fileinfo.exists()) { |
if (fileinfo.exists()) { |
496 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
497 |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile); |
if (g_bInstrumentNames) { |
498 |
gig::File *pGig = new gig::File(pRiff); |
RIFF::File *pRiff = new RIFF::File(sInstrumentFile); |
499 |
int iIndex = 0; |
gig::File *pGig = new gig::File(pRiff); |
500 |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
int iIndex = 0; |
501 |
while (pInstrument) { |
gig::Instrument *pInstrument = pGig->GetFirstInstrument(); |
502 |
if (iIndex == iInstrumentNr) { |
while (pInstrument) { |
503 |
sInstrumentName = (pInstrument->pInfo)->Name; |
if (iIndex == iInstrumentNr) { |
504 |
break; |
sInstrumentName = (pInstrument->pInfo)->Name.c_str(); |
505 |
} |
break; |
506 |
iIndex++; |
} |
507 |
pInstrument = pGig->GetNextInstrument(); |
iIndex++; |
508 |
} |
pInstrument = pGig->GetNextInstrument(); |
509 |
delete pGig; |
} |
510 |
delete pRiff; |
delete pGig; |
511 |
|
delete pRiff; |
512 |
|
} |
513 |
|
else |
514 |
#else |
#else |
515 |
sInstrumentName += " [" + QString::number(iInstrumentNr) + "]"; |
sInstrumentName += " [" + QString::number(iInstrumentNr) + "]"; |
516 |
#endif |
#endif |
520 |
} |
} |
521 |
|
|
522 |
|
|
523 |
|
// Instrument name(s) retrieval mode--global option. |
524 |
|
bool qsamplerChannel::instrumentNames (void) |
525 |
|
{ |
526 |
|
return g_bInstrumentNames; |
527 |
|
} |
528 |
|
|
529 |
|
void qsamplerChannel::setInstrumentNames ( bool bInstrumentNames ) |
530 |
|
{ |
531 |
|
g_bInstrumentNames = bInstrumentNames; |
532 |
|
} |
533 |
|
|
534 |
|
|
535 |
// end of qsamplerChannel.cpp |
// end of qsamplerChannel.cpp |