Prevent a warning about std::move redundancy (#280)
* Prevent a warning about std::move redundancy * Rewrite differently for clang-tidy
This commit is contained in:
parent
0213a561d0
commit
40a1fb5c5c
10 changed files with 42 additions and 33 deletions
|
|
@ -10,10 +10,8 @@
|
|||
|
||||
#if __cplusplus > 201103L
|
||||
#define CXX14_CONSTEXPR constexpr
|
||||
#define CXX11_MOVE(x) x
|
||||
#else
|
||||
#define CXX14_CONSTEXPR
|
||||
#define CXX11_MOVE(x) std::move(x)
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
|
|
|
|||
|
|
@ -75,41 +75,42 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Apan::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
std::unique_ptr<Apan> fx { new Apan };
|
||||
Apan* apan = new Apan;
|
||||
std::unique_ptr<Effect> fx { apan };
|
||||
|
||||
for (const Opcode& opc : members) {
|
||||
switch (opc.lettersOnlyHash) {
|
||||
case hash("apan_waveform"):
|
||||
if (auto value = readOpcode(opc.value, Default::apanWaveformRange))
|
||||
fx->_lfoWave = *value;
|
||||
apan->_lfoWave = *value;
|
||||
break;
|
||||
case hash("apan_freq"):
|
||||
if (auto value = readOpcode(opc.value, Default::apanFrequencyRange))
|
||||
fx->_lfoFrequency = *value;
|
||||
apan->_lfoFrequency = *value;
|
||||
break;
|
||||
case hash("apan_phase"):
|
||||
if (auto value = readOpcode(opc.value, Default::apanPhaseRange)) {
|
||||
float phase = *value / 360.0f;
|
||||
phase -= static_cast<int>(phase);
|
||||
fx->_lfoPhaseOffset = phase;
|
||||
apan->_lfoPhaseOffset = phase;
|
||||
}
|
||||
break;
|
||||
case hash("apan_dry"):
|
||||
if (auto value = readOpcode(opc.value, Default::apanLevelRange))
|
||||
fx->_dry = *value / 100.0f;
|
||||
apan->_dry = *value / 100.0f;
|
||||
break;
|
||||
case hash("apan_wet"):
|
||||
if (auto value = readOpcode(opc.value, Default::apanLevelRange))
|
||||
fx->_wet = *value / 100.0f;
|
||||
apan->_wet = *value / 100.0f;
|
||||
break;
|
||||
case hash("apan_depth"):
|
||||
if (auto value = readOpcode(opc.value, Default::apanLevelRange))
|
||||
fx->_depth = *value / 100.0f;
|
||||
apan->_depth = *value / 100.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
void Apan::computeLfos(float* left, float* right, unsigned nframes)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,9 @@ namespace fx {
|
|||
}
|
||||
}
|
||||
|
||||
return absl::make_unique<Eq>(desc);
|
||||
Eq* eq = new Eq(desc);
|
||||
std::unique_ptr<Effect> fx { eq };
|
||||
return fx;
|
||||
}
|
||||
|
||||
void Eq::prepareFilter()
|
||||
|
|
|
|||
|
|
@ -95,7 +95,9 @@ namespace fx {
|
|||
}
|
||||
}
|
||||
|
||||
return absl::make_unique<Filter>(desc);
|
||||
Filter* filter = new Filter(desc);
|
||||
std::unique_ptr<Effect> fx { filter };
|
||||
return fx;
|
||||
}
|
||||
|
||||
void Filter::prepareFilter()
|
||||
|
|
|
|||
|
|
@ -56,17 +56,18 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Gain::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
auto fx = absl::make_unique<Gain>();
|
||||
Gain* gain = new Gain;
|
||||
std::unique_ptr<Effect> fx { gain };
|
||||
|
||||
for (const Opcode& opc : members) {
|
||||
switch (opc.lettersOnlyHash) {
|
||||
case hash("gain"):
|
||||
setValueFromOpcode(opc, fx->_gain, {-96.0f, 96.0f});
|
||||
setValueFromOpcode(opc, gain->_gain, {-96.0f, 96.0f});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
} // namespace fx
|
||||
|
|
|
|||
|
|
@ -71,14 +71,15 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Limiter::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
auto fx = absl::make_unique<Limiter>();
|
||||
Limiter* limiter = new Limiter;
|
||||
std::unique_ptr<Effect> fx { limiter };
|
||||
|
||||
for (const Opcode& opc : members) {
|
||||
// no opcodes
|
||||
(void)opc;
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
} // namespace fx
|
||||
|
|
|
|||
|
|
@ -79,20 +79,21 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Lofi::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
auto fx = absl::make_unique<Lofi>();
|
||||
Lofi* lofi = new Lofi;
|
||||
std::unique_ptr<Effect> fx { lofi };
|
||||
|
||||
for (const Opcode& opcode : members) {
|
||||
switch (opcode.lettersOnlyHash) {
|
||||
case hash("bitred"):
|
||||
setValueFromOpcode(opcode, fx->_bitred_depth, { 0.0, 100.0 });
|
||||
setValueFromOpcode(opcode, lofi->_bitred_depth, { 0.0, 100.0 });
|
||||
break;
|
||||
case hash("decim"):
|
||||
setValueFromOpcode(opcode, fx->_decim_depth, { 0.0, 100.0 });
|
||||
setValueFromOpcode(opcode, lofi->_decim_depth, { 0.0, 100.0 });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
|||
|
|
@ -83,23 +83,24 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Rectify::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
auto fx = absl::make_unique<Rectify>();
|
||||
Rectify* rectify = new Rectify;
|
||||
std::unique_ptr<Effect> fx { rectify };
|
||||
|
||||
for (const Opcode& opc : members) {
|
||||
switch (opc.lettersOnlyHash) {
|
||||
case hash("rectify_mode"):
|
||||
if (opc.value == "full")
|
||||
fx->_full = true;
|
||||
rectify->_full = true;
|
||||
else if (opc.value == "half")
|
||||
fx->_full = false;
|
||||
rectify->_full = false;
|
||||
break;
|
||||
case hash("rectify"):
|
||||
setValueFromOpcode(opc, fx->_amount, { 0.0, 100.0 });
|
||||
setValueFromOpcode(opc, rectify->_amount, { 0.0, 100.0 });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
} // namespace fx
|
||||
|
|
|
|||
|
|
@ -126,20 +126,21 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Strings::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
auto fx = absl::make_unique<Strings>();
|
||||
Strings* strings = new Strings;
|
||||
std::unique_ptr<Effect> fx { strings };
|
||||
|
||||
for (const Opcode& opc : members) {
|
||||
switch (opc.lettersOnlyHash) {
|
||||
case hash("strings_number"):
|
||||
setValueFromOpcode(opc, fx->_numStrings, {0, MaximumNumStrings});
|
||||
setValueFromOpcode(opc, strings->_numStrings, {0, MaximumNumStrings});
|
||||
break;
|
||||
case hash("strings_wet"):
|
||||
setValueFromOpcode(opc, fx->_wet, {0.0f, 100.0f});
|
||||
setValueFromOpcode(opc, strings->_wet, {0.0f, 100.0f});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
} // namespace fx
|
||||
|
|
|
|||
|
|
@ -63,17 +63,18 @@ namespace fx {
|
|||
|
||||
std::unique_ptr<Effect> Width::makeInstance(absl::Span<const Opcode> members)
|
||||
{
|
||||
auto fx = absl::make_unique<Width>();
|
||||
Width* width = new Width;
|
||||
std::unique_ptr<Effect> fx { width };
|
||||
|
||||
for (const Opcode& opc : members) {
|
||||
switch (opc.lettersOnlyHash) {
|
||||
case hash("width"):
|
||||
setValueFromOpcode(opc, fx->_width, {-100.0f, 100.0f});
|
||||
setValueFromOpcode(opc, width->_width, {-100.0f, 100.0f});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CXX11_MOVE(fx);
|
||||
return fx;
|
||||
}
|
||||
|
||||
} // namespace fx
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue