Trying to make tidy happy

This commit is contained in:
Paul Fd 2020-04-19 00:29:47 +02:00 committed by Jean Pierre Cimalando
parent fb190340a3
commit 0c68e40cc4
3 changed files with 22 additions and 7 deletions

View file

@ -70,7 +70,8 @@ sfz::Logger::~Logger()
loadLogFile << time.waitDuration.count() << ','
<< time.loadDuration.count() << ','
<< time.fileSize << ','
<< time.filename << '\n';
<< "disabled" << '\n';
// << time.filename << '\n';
}
if (!callbackTimes.empty()) {

View file

@ -31,10 +31,25 @@ public:
};
template <class T>
class ModifierArray : public std::array<T, (size_t)Mod::sentinel> {
class ModifierArray {
public:
T& operator[](sfz::Mod idx) { return this->std::array<T, (size_t)Mod::sentinel>::operator[](static_cast<size_t>(idx)); }
const T& operator[](sfz::Mod idx) const { return this->std::array<T, (size_t)Mod::sentinel>::operator[](static_cast<size_t>(idx)); }
using ContainerType = typename std::array<T, (size_t)Mod::sentinel>;
using iterator = typename ContainerType::iterator;
using const_iterator = typename ContainerType::const_iterator;
ModifierArray() = default;
ModifierArray(T val)
{
std::fill(underlying.begin(), underlying.end(), val);
}
ModifierArray(std::array<T, (size_t)Mod::sentinel>&& array) : underlying(array) {}
T& operator[](sfz::Mod idx) { return underlying.operator[](static_cast<size_t>(idx)); }
const T& operator[](sfz::Mod idx) const { return underlying.operator[](static_cast<size_t>(idx)); }
iterator begin() { return underlying.begin(); }
iterator end() { return underlying.end(); }
const_iterator begin() const { return underlying.begin(); }
const_iterator end() const { return underlying.end(); }
private:
ContainerType underlying {};
};
/**
@ -42,7 +57,7 @@ public:
* Should fail at compile time if you update the modifiers but not this.
*
*/
static const ModifierArray<Mod> allModifiers = {{
static const ModifierArray<Mod> allModifiers {{
Mod::amplitude,
Mod::pan,
Mod::width,

View file

@ -845,8 +845,7 @@ void sfz::Voice::resetSmoothers() noexcept
for (auto& mod : allModifiers) {
const auto resetValue = [mod] {
switch (mod) {
case Mod::volume:
return 1.0f;
case Mod::volume: // fallthrough
case Mod::pitch:
return 1.0f;
default: