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 - 2008 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 - 2015 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009 Christian Schoenebeck and Grigor Iliev * |
8 |
|
* Copyright (C) 2010-2016 Christian Schoenebeck and Andreas Persson * |
9 |
* * |
* * |
10 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
11 |
* 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 * |
210 |
// number of '0' samples (silence samples) behind the official buffer |
// number of '0' samples (silence samples) behind the official buffer |
211 |
// 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 |
212 |
// the sample. |
// the sample. |
213 |
const uint neededSilenceSamples = (maxSamplesPerCycle << CONFIG_MAX_PITCH) + 3; |
const uint neededSilenceSamples = uint((maxSamplesPerCycle << CONFIG_MAX_PITCH) + 3); |
214 |
const uint currentlyCachedSilenceSamples = pSample->GetCache().NullExtensionSize / pSample->GetFrameSize(); |
const uint currentlyCachedSilenceSamples = uint(pSample->GetCache().NullExtensionSize / pSample->GetFrameSize()); |
215 |
if (currentlyCachedSilenceSamples < neededSilenceSamples) { |
if (currentlyCachedSilenceSamples < neededSilenceSamples) { |
216 |
dmsg(3,("Caching whole sample (sample name: \"%s\", sample size: %ld)\n", pSample->GetName().c_str(), pSample->GetTotalFrameCount())); |
dmsg(3,("Caching whole sample (sample name: \"%s\", sample size: %ld)\n", pSample->GetName().c_str(), pSample->GetTotalFrameCount())); |
217 |
typename S::buffer_t buf = pSample->LoadSampleDataWithNullSamplesExtension(neededSilenceSamples); |
typename S::buffer_t buf = pSample->LoadSampleDataWithNullSamplesExtension(neededSilenceSamples); |
226 |
} |
} |
227 |
|
|
228 |
// implementation of derived abstract methods from 'InstrumentManager' |
// implementation of derived abstract methods from 'InstrumentManager' |
229 |
std::vector<instrument_id_t> Instruments() { |
std::vector<instrument_id_t> Instruments() OVERRIDE { |
230 |
return ResourceManager<InstrumentManager::instrument_id_t, I>::Entries(); |
return ResourceManager<InstrumentManager::instrument_id_t, I>::Entries(); |
231 |
} |
} |
232 |
|
|
233 |
// implementation of derived abstract methods from 'ResourceManager' |
// implementation of derived abstract methods from 'ResourceManager' |
234 |
void OnBorrow(I* pResource, InstrumentConsumer* pConsumer, void*& pArg) { |
void OnBorrow(I* pResource, InstrumentConsumer* pConsumer, void*& pArg) OVERRIDE { |
235 |
instr_entry_t* pEntry = static_cast<instr_entry_t*>(pArg); |
instr_entry_t* pEntry = static_cast<instr_entry_t*>(pArg); |
236 |
|
|
237 |
uint maxSamplesPerCycle = GetMaxSamplesPerCycle(pConsumer); |
uint maxSamplesPerCycle = GetMaxSamplesPerCycle(pConsumer); |