Merge pull request #763 from jpcima/clang-tidy
New fixes for clang-tidy
This commit is contained in:
commit
45115bf393
10 changed files with 31 additions and 31 deletions
|
|
@ -206,7 +206,7 @@ void PLUGIN_API SfizzVstEditor::update(FUnknown* changedUnknown, int32 message)
|
|||
uiReceiveValue(EditId::SfzFile, state.sfzFile);
|
||||
uiReceiveValue(EditId::Volume, state.volume);
|
||||
uiReceiveValue(EditId::Polyphony, state.numVoices);
|
||||
uiReceiveValue(EditId::Oversampling, 1u << state.oversamplingLog2);
|
||||
uiReceiveValue(EditId::Oversampling, float(1u << state.oversamplingLog2));
|
||||
uiReceiveValue(EditId::PreloadSize, state.preloadSize);
|
||||
uiReceiveValue(EditId::ScalaFile, state.scalaFile);
|
||||
uiReceiveValue(EditId::ScalaRootKey, state.scalaRootKey);
|
||||
|
|
@ -237,7 +237,7 @@ void PLUGIN_API SfizzVstEditor::update(FUnknown* changedUnknown, int32 message)
|
|||
uiReceiveValue(EditId::Polyphony, range.denormalize(value));
|
||||
break;
|
||||
case kPidOversampling:
|
||||
uiReceiveValue(EditId::Oversampling, 1u << (int32)range.denormalize(value));
|
||||
uiReceiveValue(EditId::Oversampling, float(1u << (int32)range.denormalize(value)));
|
||||
break;
|
||||
case kPidPreloadSize:
|
||||
uiReceiveValue(EditId::PreloadSize, range.denormalize(value));
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ void SfizzVstProcessor::updateTimeInfo(const Vst::ProcessContext& context)
|
|||
sfz::Sfizz& synth = *_synth;
|
||||
|
||||
if (context.state & context.kTempoValid)
|
||||
synth.tempo(0, 60.0f / context.tempo);
|
||||
synth.tempo(0, float(60.0 / context.tempo));
|
||||
|
||||
if (context.state & context.kTimeSigValid) {
|
||||
_timeSigNumerator = context.timeSigNumerator;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ clang-tidy \
|
|||
src/sfizz/EQPool.cpp \
|
||||
src/sfizz/FilePool.cpp \
|
||||
src/sfizz/FilterPool.cpp \
|
||||
src/sfizz/FloatEnvelopes.cpp \
|
||||
src/sfizz/Logger.cpp \
|
||||
src/sfizz/MidiState.cpp \
|
||||
src/sfizz/Opcode.cpp \
|
||||
|
|
@ -24,13 +23,13 @@ clang-tidy \
|
|||
src/sfizz/effects/Filter.cpp \
|
||||
src/sfizz/effects/Lofi.cpp \
|
||||
src/sfizz/effects/Nothing.cpp \
|
||||
vst/SfizzVstController.cpp \
|
||||
vst/SfizzVstProcessor.cpp \
|
||||
vst/SfizzVstEditor.cpp \
|
||||
vst/SfizzVstState.cpp \
|
||||
plugins/vst/SfizzVstController.cpp \
|
||||
plugins/vst/SfizzVstProcessor.cpp \
|
||||
plugins/vst/SfizzVstEditor.cpp \
|
||||
plugins/vst/SfizzVstState.cpp \
|
||||
-- -Iexternal/abseil-cpp -Iexternal/jsl/include -Iexternal/filesystem/include -Iexternal/atomic_queue/include -Iexternal/threadpool -Isrc/external/hiir -Isrc/external/pugixml/src \
|
||||
-Iexternal/st_audiofile/src -Iexternal/st_audiofile/thirdparty/dr_libs \
|
||||
-Isrc/sfizz -Isrc -Isrc/sfizz/utility/bit_array -Isrc/sfizz/utility/spin_mutex -Isrc/external/spline -Isrc/external/cpuid/src -Iexternal/simde \
|
||||
-Ivst -Ivst/external/VST_SDK/VST3_SDK -Ieditor/external/vstgui4 -Ivst/external/ring_buffer \
|
||||
-Ieditor/src \
|
||||
-Iplugins/vst -Iplugins/vst/external/VST_SDK/VST3_SDK -Iplugins/editor/external/vstgui4 -Iplugins/vst/external/ring_buffer \
|
||||
-Iplugins/editor/src \
|
||||
-DNDEBUG -std=c++17
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ absl::optional<sfz::FileInformation> sfz::FilePool::getFileInformation(const Fil
|
|||
FileInformation returnedValue;
|
||||
returnedValue.end = static_cast<uint32_t>(reader->frames()) - 1;
|
||||
returnedValue.sampleRate = static_cast<double>(reader->sampleRate());
|
||||
returnedValue.numChannels = reader->channels();
|
||||
returnedValue.numChannels = static_cast<int>(reader->channels());
|
||||
|
||||
InstrumentInfo instrumentInfo {};
|
||||
bool haveInstrumentInfo = reader->getInstrument(&instrumentInfo);
|
||||
|
|
@ -267,7 +267,7 @@ absl::optional<sfz::FileInformation> sfz::FilePool::getFileInformation(const Fil
|
|||
}
|
||||
|
||||
if (haveInstrumentInfo)
|
||||
returnedValue.rootKey = clamp<int8_t>(instrumentInfo.basenote, 0, 127);
|
||||
returnedValue.rootKey = clamp<uint8_t>(instrumentInfo.basenote, 0, 127);
|
||||
|
||||
return returnedValue;
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ void sfz::FilePool::setPreloadSize(uint32_t preloadSize) noexcept
|
|||
}
|
||||
}
|
||||
|
||||
void sfz::FilePool::loadingJob(QueuedFileData data) noexcept
|
||||
void sfz::FilePool::loadingJob(const QueuedFileData& data) noexcept
|
||||
{
|
||||
raiseCurrentThreadPriority();
|
||||
|
||||
|
|
@ -496,17 +496,17 @@ bool is_ready(std::future<R> const& f)
|
|||
|
||||
void sfz::FilePool::dispatchingJob() noexcept
|
||||
{
|
||||
QueuedFileData queuedData;
|
||||
while (dispatchBarrier.wait(), dispatchFlag) {
|
||||
std::lock_guard<std::mutex> guard { loadingJobsMutex };
|
||||
|
||||
QueuedFileData queuedData;
|
||||
if (filesToLoad->try_pop(queuedData)) {
|
||||
if (queuedData.id.expired()) {
|
||||
// file ID was nulled, it means the region was deleted, ignore
|
||||
}
|
||||
else
|
||||
loadingJobs.push_back(
|
||||
threadPool->enqueue([this](const QueuedFileData& data) { loadingJob(data); }, queuedData));
|
||||
threadPool->enqueue([this](const QueuedFileData& data) { loadingJob(data); }, std::move(queuedData)));
|
||||
}
|
||||
|
||||
// Clear finished jobs
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ private:
|
|||
|
||||
void dispatchingJob() noexcept;
|
||||
void garbageJob() noexcept;
|
||||
void loadingJob(QueuedFileData data) noexcept;
|
||||
void loadingJob(const QueuedFileData& data) noexcept;
|
||||
std::mutex loadingJobsMutex;
|
||||
std::vector<std::future<void>> loadingJobs;
|
||||
std::thread dispatchThread { &FilePool::dispatchingJob, this };
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void sfz::FilterHolder::setup(const Region& region, unsigned filterId, int noteN
|
|||
fast_real_distribution<float> dist { 0.0f, description->random };
|
||||
baseCutoff *= centsFactor(dist(Random::randomGenerator));
|
||||
}
|
||||
const auto keytrack = description->keytrack * (noteNumber - description->keycenter);
|
||||
const auto keytrack = description->keytrack * float(noteNumber - description->keycenter);
|
||||
baseCutoff *= centsFactor(keytrack);
|
||||
const auto veltrack = description->veltrack * velocity;
|
||||
baseCutoff *= centsFactor(veltrack);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ static const auto panData = []()
|
|||
float panLookup(float pan)
|
||||
{
|
||||
// reduce range, round to nearest
|
||||
const int index = lroundPositive(pan * (panSize - 1));
|
||||
const long index = lroundPositive(pan * (panSize - 1));
|
||||
return panData[index];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -920,10 +920,10 @@ bool sfz::Region::parseLFOOpcode(const Opcode& opcode, LFODescription& lfo)
|
|||
getOrCreateConnection(sourceKey, targetKey).sourceDepthMod = sourceDepthKey;
|
||||
processGenericCc(opcode, depthModSpec, sourceDepthKey);
|
||||
break;
|
||||
case_any_lfo("depthchanaft"):
|
||||
case_any_lfo("depthchanaft"): // NOLINT bugprone-branch-clone
|
||||
// TODO(jpc) LFO v1
|
||||
break;
|
||||
case_any_lfo("depthpolyaft"):
|
||||
case_any_lfo("depthpolyaft"): // NOLINT bugprone-branch-clone
|
||||
// TODO(jpc) LFO v1
|
||||
break;
|
||||
case_any_lfo("fade"):
|
||||
|
|
@ -935,10 +935,10 @@ bool sfz::Region::parseLFOOpcode(const Opcode& opcode, LFODescription& lfo)
|
|||
case_any_lfo_any_ccN("freq"): // also freqcc&
|
||||
processGenericCc(opcode, Default::lfoFreqMod, lfo.freqKey);
|
||||
break;
|
||||
case_any_lfo("freqchanaft"):
|
||||
case_any_lfo("freqchanaft"): // NOLINT bugprone-branch-clone
|
||||
// TODO(jpc) LFO v1
|
||||
break;
|
||||
case_any_lfo("freqpolyaft"):
|
||||
case_any_lfo("freqpolyaft"): // NOLINT bugprone-branch-clone
|
||||
// TODO(jpc) LFO v1
|
||||
break;
|
||||
|
||||
|
|
@ -1638,7 +1638,7 @@ float sfz::Region::getBasePitchVariation(float noteNumber, float velocity) const
|
|||
ASSERT(velocity >= 0.0f && velocity <= 1.0f);
|
||||
|
||||
fast_real_distribution<float> pitchDistribution { 0.0f, pitchRandom };
|
||||
float pitchVariationInCents = pitchKeytrack * (noteNumber - pitchKeycenter); // note difference with pitch center
|
||||
float pitchVariationInCents = pitchKeytrack * (noteNumber - float(pitchKeycenter)); // note difference with pitch center
|
||||
pitchVariationInCents += pitch; // sample tuning
|
||||
pitchVariationInCents += config::centPerSemitone * transpose; // sample transpose
|
||||
pitchVariationInCents += velocity * pitchVeltrack; // track velocity
|
||||
|
|
|
|||
|
|
@ -1016,9 +1016,10 @@ void Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
|||
// Send the set of changed CCs
|
||||
Client broadcaster = impl.getBroadcaster();
|
||||
const BitArray<config::numCCs>& changedCCs = impl.changedCCsThisCycle_;
|
||||
const int finalFrameNumber = int(numFrames - 1);
|
||||
if (broadcaster.canReceive()) {
|
||||
sfizz_blob_t blob { changedCCs.data(), static_cast<uint32_t>(changedCCs.byte_size()) };
|
||||
broadcaster.receive<'b'>(numFrames - 1, "/cc/changed", &blob);
|
||||
broadcaster.receive<'b'>(finalFrameNumber, "/cc/changed", &blob);
|
||||
}
|
||||
impl.changedCCsThisCycle_.clear();
|
||||
// Send the changed keyswitch
|
||||
|
|
@ -1027,7 +1028,7 @@ void Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
|||
int32_t value = -1;
|
||||
if (impl.currentSwitch_)
|
||||
value = *impl.currentSwitch_;
|
||||
broadcaster.receive<'i'>(numFrames - 1, "/sw/last/current", value);
|
||||
broadcaster.receive<'i'>(finalFrameNumber, "/sw/last/current", value);
|
||||
}
|
||||
impl.currentSwitchChanged_ = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ bool Voice::startVoice(Layer* layer, int delay, const TriggerEvent& event) noexc
|
|||
impl.triggerDelay_ = delay;
|
||||
impl.initialDelay_ = delay + static_cast<int>(region.getDelay(resources.midiState) * impl.sampleRate_);
|
||||
impl.baseFrequency_ = resources.tuning.getFrequencyOfKey(impl.triggerEvent_.number);
|
||||
impl.sampleSize_ = region.getSampleEnd(resources.midiState, resources.filePool.getOversamplingFactor()) - impl.sourcePosition_ - 1;
|
||||
impl.sampleSize_ = int(region.getSampleEnd(resources.midiState, resources.filePool.getOversamplingFactor()) - impl.sourcePosition_ - 1);
|
||||
impl.bendStepFactor_ = centsFactor(region.bendStep);
|
||||
impl.bendSmoother_.setSmoothing(region.bendSmooth, impl.sampleRate_);
|
||||
impl.bendSmoother_.reset(centsFactor(region.getBendInCents(resources.midiState.getPitchBend())));
|
||||
|
|
@ -1129,7 +1129,7 @@ void Voice::Impl::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
}
|
||||
|
||||
if (!released())
|
||||
off(i, true);
|
||||
off(int(i), true);
|
||||
|
||||
fill<int>(indices->subspan(i), sampleEnd);
|
||||
fill<float>(coeffs->subspan(i), 0x1.fffffep-1);
|
||||
|
|
@ -1167,8 +1167,8 @@ void Voice::Impl::fillWithData(AudioSpan<float> buffer) noexcept
|
|||
|
||||
// compute crossfade positions
|
||||
for (unsigned i = 0; i < ptSize; ++i) {
|
||||
float pos = ptIndices[i] + ptCoeffs[i];
|
||||
xfCurvePos[i] = (pos - loop.xfOutStart) / loop.xfSize;
|
||||
float pos = float(ptIndices[i]) + ptCoeffs[i];
|
||||
xfCurvePos[i] = (pos - float(loop.xfOutStart)) / float(loop.xfSize);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------//
|
||||
|
|
@ -1390,8 +1390,8 @@ const Curve& Voice::Impl::getSCurve()
|
|||
constexpr unsigned N = Curve::NumValues;
|
||||
float values[N];
|
||||
for (unsigned i = 0; i < N; ++i) {
|
||||
double x = i / static_cast<double>(N - 1);
|
||||
values[i] = (1.0 - std::cos(M_PI * x)) * 0.5;
|
||||
double x = i / double(N - 1);
|
||||
values[i] = float((1.0 - std::cos(M_PI * x)) * 0.5);
|
||||
}
|
||||
return Curve::buildFromPoints(values);
|
||||
}();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue