68 |
instr_entry_t* pEntry = new instr_entry_t; |
instr_entry_t* pEntry = new instr_entry_t; |
69 |
pEntry->iInstrument = Key.iInstrument; |
pEntry->iInstrument = Key.iInstrument; |
70 |
pEntry->pGig = pGig; |
pEntry->pGig = pGig; |
71 |
|
|
72 |
gig::EngineChannel* pEngineChannel = dynamic_cast<gig::EngineChannel*>(pConsumer); |
gig::EngineChannel* pEngineChannel = dynamic_cast<gig::EngineChannel*>(pConsumer); |
73 |
// and we save this to check if we need to reallocate for a engine with higher value of 'MaxSamplesPerSecond' |
// and we save this to check if we need to reallocate for a engine with higher value of 'MaxSamplesPerSecond' |
74 |
pEntry->MaxSamplesPerCycle = |
pEntry->MaxSamplesPerCycle = |
105 |
* @param pSample - points to the sample to be cached |
* @param pSample - points to the sample to be cached |
106 |
* @param pEngineChannel - pointer to Gig Engine Channel which caused this call |
* @param pEngineChannel - pointer to Gig Engine Channel which caused this call |
107 |
*/ |
*/ |
108 |
void InstrumentResourceManager::CacheInitialSamples(::gig::Sample* pSample, gig::EngineChannel* pEngineChannel) { |
void InstrumentResourceManager::CacheInitialSamples(::gig::Sample* pSample, gig::EngineChannel* pEngineChannel) { |
109 |
if (!pSample) { |
if (!pSample) { |
110 |
dmsg(1,("gig::InstrumentResourceManager: Warning, skipping sample (pSample == NULL)\n")); |
dmsg(4,("gig::InstrumentResourceManager: Skipping sample (pSample == NULL)\n")); |
111 |
return; |
return; |
112 |
} |
} |
113 |
if (!pSample->SamplesTotal) return; // skip zero size samples |
if (!pSample->SamplesTotal) return; // skip zero size samples |
114 |
|
|
115 |
if (pSample->SamplesTotal <= NUM_RAM_PRELOAD_SAMPLES) { |
if (pSample->SamplesTotal <= NUM_RAM_PRELOAD_SAMPLES) { |
116 |
// Sample is too short for disk streaming, so we load the whole |
// Sample is too short for disk streaming, so we load the whole |
117 |
// sample into RAM and place 'pAudioIO->FragmentSize << MAX_PITCH' |
// sample into RAM and place 'pAudioIO->FragmentSize << MAX_PITCH' |
118 |
// number of '0' samples (silence samples) behind the official buffer |
// number of '0' samples (silence samples) behind the official buffer |
119 |
// border, to allow the interpolator do it's work even at the end of |
// border, to allow the interpolator do it's work even at the end of |
120 |
// the sample. |
// the sample. |
121 |
const uint maxSamplesPerCycle = |
const uint maxSamplesPerCycle = |
122 |
(pEngineChannel->GetEngine()) ? dynamic_cast<gig::Engine*>(pEngineChannel->GetEngine())->pAudioOutputDevice->MaxSamplesPerCycle() |
(pEngineChannel->GetEngine()) ? dynamic_cast<gig::Engine*>(pEngineChannel->GetEngine())->pAudioOutputDevice->MaxSamplesPerCycle() |
123 |
: GIG_RESOURCE_MANAGER_DEFAULT_MAX_SAMPLES_PER_CYCLE; |
: GIG_RESOURCE_MANAGER_DEFAULT_MAX_SAMPLES_PER_CYCLE; |