Skip to content

Commit

Permalink
remove lamda
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer authored Nov 7, 2024
1 parent 221879c commit 4b77bd5
Showing 1 changed file with 28 additions and 35 deletions.
63 changes: 28 additions & 35 deletions src/effects/backends/builtin/metronomeeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,41 +135,34 @@ void MetronomeEffect::processChannel(
}
gs->framesSinceLastClick += engineParameters.framesPerBuffer();

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 22.04

expected ‘)’ before ‘;’ token

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 22.04

suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / coverage

expected ‘)’ before ‘;’ token

Check warning on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / coverage

suggest braces around empty body in an ‘if’ statement [-Wempty-body]

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

'->': trailing return type is not allowed after a non-function declarator

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

missing return type after '->' ('int' assumed)

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

missing type specifier - int assumed. Note: C++ does not support default-int

Check failure on line 136 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

syntax error: missing ';' before identifier 'framesSinceLastClick'

std::span<CSAMPLE> outputBufferOffset = [&] {
if (shouldSync && hasBeatInfo) {
double beatFractionBufferEnd = *groupFeatures.beat_fraction_buffer_end;
std::optional<GroupFeatureBeatLength> beatLengthAndScratch = groupFeatures.beat_length;
if (!beatLengthAndScratch.has_value() || beatLengthAndScratch->scratch_rate == 0.0) {
return std::span<CSAMPLE>();
}
double beatLength = beatLengthAndScratch->frames / beatLengthAndScratch->scratch_rate;

const bool needsPreviousBeat = beatLength < 0;
double beatToBufferEndFrames = std::abs(beatLength) *
(needsPreviousBeat ? (1 - beatFractionBufferEnd)
: beatFractionBufferEnd);
std::size_t beatToBufferEndSamples =
static_cast<std::size_t>(beatToBufferEndFrames) *
mixxx::kEngineChannelOutputCount;

if (beatToBufferEndSamples <= output.size()) {
return output.last(beatToBufferEndSamples);
}
return std::span<CSAMPLE>();
} else {
// EngineParameters::sampleRate in reality returns the framerate.
mixxx::audio::SampleRate framesPerSecond = engineParameters.sampleRate();
std::size_t offset = (gs->framesSinceLastClick %
framesPerBeat(framesPerSecond, m_pBpmParameter->value())) *
mixxx::kEngineChannelOutputCount;
if (offset < output.size()) {
return output.subspan(offset);
}
return std::span<CSAMPLE>();
if (shouldSync && hasBeatInfo) {

Check failure on line 138 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

syntax error: 'if'

Check failure on line 138 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

syntax error: missing ';' before '{'

Check failure on line 138 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

'{': missing function header (old-style formal list?)
double beatFractionBufferEnd = *groupFeatures.beat_fraction_buffer_end;
std::optional<GroupFeatureBeatLength> beatLengthAndScratch = groupFeatures.beat_length;
if (!beatLengthAndScratch.has_value() || beatLengthAndScratch->scratch_rate == 0.0) {
return;
}
}();

if (!outputBufferOffset.empty()) {
gs->framesSinceLastClick = playMonoSamplesWithGain(click, outputBufferOffset, gain);
double beatLength = beatLengthAndScratch->frames / beatLengthAndScratch->scratch_rate;
const bool needsPreviousBeat = beatLength < 0;
double beatToBufferEndFrames = std::abs(beatLength) *
(needsPreviousBeat ? (1 - beatFractionBufferEnd)
: beatFractionBufferEnd);
std::size_t beatToBufferEndSamples =
static_cast<std::size_t>(beatToBufferEndFrames) *
mixxx::kEngineChannelOutputCount;

if (beatToBufferEndSamples <= output.size()) {
gs->framesSinceLastClick = playMonoSamplesWithGain(click, output.last(beatToBufferEndSamples), gain);
}
} else {

Check failure on line 156 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

syntax error: 'else'

Check failure on line 156 in src/effects/backends/builtin/metronomeeffect.cpp

View workflow job for this annotation

GitHub Actions / Windows 2019 (MSVC)

syntax error: missing ';' before '{'
// EngineParameters::sampleRate in reality returns the framerate.
mixxx::audio::SampleRate framesPerSecond = engineParameters.sampleRate();
std::size_t offset = (gs->framesSinceLastClick %
framesPerBeat(framesPerSecond, m_pBpmParameter->value())) *
mixxx::kEngineChannelOutputCount;
if (offset < output.size()) {
gs->framesSinceLastClick = playMonoSamplesWithGain(click, output.subspan(offset), gain);
}
}
}


0 comments on commit 4b77bd5

Please sign in to comment.