Skip to content

Commit 941a9b6

Browse files
committed
KeyComparisonEffect: add m_ prefix to all class members
1 parent f34d7d1 commit 941a9b6

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

src/effects/backends/builtin/keycomparisoneffect.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ std::span<CSAMPLE> syncedNoteOutput(
9797
// BPM counter. Mirrors metronomeeffect's unsyncedClickOutput.
9898
std::span<CSAMPLE> unsyncedNoteOutput(
9999
mixxx::audio::SampleRate framesPerSecond,
100-
std::size_t framesSinceLastNote,
100+
std::size_t m_framesSinceLastNote,
101101
double bpm,
102102
double periodMultiplier,
103103
std::span<CSAMPLE> output) {
@@ -106,7 +106,7 @@ std::span<CSAMPLE> unsyncedNoteOutput(
106106
if (period == 0) {
107107
return {};
108108
}
109-
const std::size_t offset = framesSinceLastNote % period;
109+
const std::size_t offset = m_framesSinceLastNote % period;
110110
return subspanClamped(output, offset * mixxx::kEngineChannelOutputCount);
111111
}
112112

@@ -121,8 +121,8 @@ double periodMultiplierFromMeasure(int measure) {
121121
void KeyComparisonGroupState::audioParametersChanged(
122122
const mixxx::EngineParameters& engineParameters) {
123123
m_sampleRate = engineParameters.sampleRate();
124-
pianoSample = generatePianoSample(m_sampleRate);
125-
tempMono.resize(engineParameters.framesPerBuffer());
124+
m_pianoSample = generatePianoSample(m_sampleRate);
125+
m_tempMono.resize(engineParameters.framesPerBuffer());
126126
}
127127

128128
// static
@@ -249,7 +249,7 @@ void KeyComparisonEffect::processChannel(
249249
}
250250

251251
const std::span<CSAMPLE> output(pOutput, engineParameters.samplesPerBuffer());
252-
const std::span<const CSAMPLE> pianoSample(pGroupState->pianoSample);
252+
const std::span<const CSAMPLE> m_pianoSample(pGroupState->m_pianoSample);
253253

254254
const bool shouldSync = m_pSyncParameter->toBool();
255255
const bool hasBeatInfo = groupFeatures.beat_length.has_value() &&
@@ -270,15 +270,15 @@ void KeyComparisonEffect::processChannel(
270270
*groupFeatures.beat_fraction_buffer_end < 0.25;
271271
pGroupState->m_fireImmediately = justMissedBeat;
272272
pGroupState->m_srcFramePos =
273-
static_cast<double>(pianoSample.size());
274-
pGroupState->framesSinceLastNote = pianoSample.size();
273+
static_cast<double>(m_pianoSample.size());
274+
pGroupState->m_framesSinceLastNote = m_pianoSample.size();
275275
} else {
276276
// In unsynced mode, fire the first note immediately via
277277
// m_fireImmediately. Silence the tail path so the note
278278
// does not play twice on the first buffer.
279279
pGroupState->m_srcFramePos =
280-
static_cast<double>(pianoSample.size());
281-
pGroupState->framesSinceLastNote = 0;
280+
static_cast<double>(m_pianoSample.size());
281+
pGroupState->m_framesSinceLastNote = 0;
282282
pGroupState->m_fireImmediately = true;
283283
}
284284
// Initialise to measure - 1 so the first synced beat fires immediately
@@ -309,14 +309,14 @@ void KeyComparisonEffect::processChannel(
309309
// pitchRatio mid-note does not cause a position jump and crack.
310310
{
311311
const std::size_t tailFrames = output.size() / mixxx::kEngineChannelOutputCount;
312-
std::span<CSAMPLE> tailMono(pGroupState->tempMono.data(), tailFrames);
312+
std::span<CSAMPLE> tailMono(pGroupState->m_tempMono.data(), tailFrames);
313313
const auto srcOffset = static_cast<std::size_t>(pGroupState->m_srcFramePos);
314-
resampleMono(subspanClamped(pianoSample, srcOffset), tailMono, pitchRatio);
314+
resampleMono(subspanClamped(m_pianoSample, srcOffset), tailMono, pitchRatio);
315315
SampleUtil::addMonoToStereoWithGain(gain, pOutput, tailMono.data(), tailFrames);
316316
pGroupState->m_srcFramePos +=
317317
static_cast<double>(engineParameters.framesPerBuffer()) * pitchRatio;
318318
}
319-
pGroupState->framesSinceLastNote += engineParameters.framesPerBuffer();
319+
pGroupState->m_framesSinceLastNote += engineParameters.framesPerBuffer();
320320

321321
std::span<CSAMPLE> noteStart;
322322
if (pGroupState->m_fireImmediately) {
@@ -333,7 +333,7 @@ void KeyComparisonEffect::processChannel(
333333
} else {
334334
noteStart = unsyncedNoteOutput(
335335
engineParameters.sampleRate(),
336-
pGroupState->framesSinceLastNote,
336+
pGroupState->m_framesSinceLastNote,
337337
m_pBpmParameter->value(),
338338
periodMultiplier,
339339
output);
@@ -354,13 +354,13 @@ void KeyComparisonEffect::processChannel(
354354

355355
{
356356
const std::size_t onsetFrames = noteStart.size() / mixxx::kEngineChannelOutputCount;
357-
std::span<CSAMPLE> onsetMono(pGroupState->tempMono.data(), onsetFrames);
357+
std::span<CSAMPLE> onsetMono(pGroupState->m_tempMono.data(), onsetFrames);
358358
const std::size_t srcConsumed =
359-
resampleMono(pianoSample, onsetMono, pitchRatio);
359+
resampleMono(m_pianoSample, onsetMono, pitchRatio);
360360
SampleUtil::addMonoToStereoWithGain(
361361
gain, noteStart.data(), onsetMono.data(), onsetFrames);
362362
// Reset source position and output counter from the onset playback.
363363
pGroupState->m_srcFramePos = static_cast<double>(srcConsumed);
364-
pGroupState->framesSinceLastNote = srcConsumed;
364+
pGroupState->m_framesSinceLastNote = srcConsumed;
365365
}
366366
}

src/effects/backends/builtin/keycomparisoneffect.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ class KeyComparisonGroupState final : public EffectState {
2424
void audioParametersChanged(
2525
const mixxx::EngineParameters& engineParameters);
2626

27-
std::vector<CSAMPLE> pianoSample;
27+
std::vector<CSAMPLE> m_pianoSample;
2828
// Temporary mono buffer for the resampling step. Sized to framesPerBuffer
2929
// in audioParametersChanged so no allocation happens on the audio thread.
30-
std::vector<CSAMPLE> tempMono;
30+
std::vector<CSAMPLE> m_tempMono;
3131
// Tracks position in the piano sample in source frames. Stored as double
3232
// so that changing pitchRatio mid-note does not cause a position jump and
3333
// the resulting crack.
3434
double m_srcFramePos = 0.0;
35-
std::size_t framesSinceLastNote = 0;
35+
std::size_t m_framesSinceLastNote = 0;
3636
mixxx::audio::SampleRate m_sampleRate;
3737
// Counts beats since last note fired, used to implement the Measure knob
3838
// in sync mode.

0 commit comments

Comments
 (0)