3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2013 Christian Schoenebeck * |
* Copyright (C) 2005 - 2015 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
69 |
* instrument ID |
* instrument ID |
70 |
*/ |
*/ |
71 |
void InstrumentResourceManager::OnInstrumentLoadingProgress(::gig::progress_t* pProgress) { |
void InstrumentResourceManager::OnInstrumentLoadingProgress(::gig::progress_t* pProgress) { |
72 |
dmsg(7,("gig::InstrumentResourceManager: progress %f%", pProgress->factor)); |
dmsg(7,("gig::InstrumentResourceManager: progress %f%%", pProgress->factor)); |
73 |
progress_callback_arg_t* pArg = static_cast<progress_callback_arg_t*>(pProgress->custom); |
progress_callback_arg_t* pArg = static_cast<progress_callback_arg_t*>(pProgress->custom); |
74 |
// we randomly schedule 90% for the .gig file loading and the remaining 10% later for sample caching |
// we randomly schedule 90% for the .gig file loading and the remaining 10% later for sample caching |
75 |
const float localProgress = 0.9f * pProgress->factor; |
const float localProgress = 0.9f * pProgress->factor; |
676 |
const uint neededSilenceSamples = (maxSamplesPerCycle << CONFIG_MAX_PITCH) + 3; |
const uint neededSilenceSamples = (maxSamplesPerCycle << CONFIG_MAX_PITCH) + 3; |
677 |
const uint currentlyCachedSilenceSamples = pSample->GetCache().NullExtensionSize / pSample->FrameSize; |
const uint currentlyCachedSilenceSamples = pSample->GetCache().NullExtensionSize / pSample->FrameSize; |
678 |
if (currentlyCachedSilenceSamples < neededSilenceSamples) { |
if (currentlyCachedSilenceSamples < neededSilenceSamples) { |
679 |
dmsg(3,("Caching whole sample (sample name: \"%s\", sample size: %d)\n", pSample->pInfo->Name.c_str(), pSample->SamplesTotal)); |
dmsg(3,("Caching whole sample (sample name: \"%s\", sample size: %lu)\n", pSample->pInfo->Name.c_str(), pSample->SamplesTotal)); |
680 |
::gig::buffer_t buf = pSample->LoadSampleDataWithNullSamplesExtension(neededSilenceSamples); |
::gig::buffer_t buf = pSample->LoadSampleDataWithNullSamplesExtension(neededSilenceSamples); |
681 |
dmsg(4,("Cached %d Bytes, %d silence bytes.\n", buf.Size, buf.NullExtensionSize)); |
dmsg(4,("Cached %lu Bytes, %lu silence bytes.\n", buf.Size, buf.NullExtensionSize)); |
682 |
} |
} |
683 |
} |
} |
684 |
else { // we only cache CONFIG_PRELOAD_SAMPLES and stream the other sample points from disk |
else { // we only cache CONFIG_PRELOAD_SAMPLES and stream the other sample points from disk |
689 |
} |
} |
690 |
|
|
691 |
void InstrumentResourceManager::UncacheInitialSamples(::gig::Sample* pSample) { |
void InstrumentResourceManager::UncacheInitialSamples(::gig::Sample* pSample) { |
692 |
dmsg(1,("Uncaching sample %x\n",pSample)); |
dmsg(1,("Uncaching sample %p\n",(void*)pSample)); |
693 |
if (pSample->GetCache().Size) pSample->ReleaseSampleData(); |
if (pSample->GetCache().Size) pSample->ReleaseSampleData(); |
694 |
} |
} |
695 |
|
|