Simplify sample frame operations (make it a class) (#7156)

* Remove the struct StereoSample

Remove the struct `StereoSample`. Let `AudioEngine::getPeakValues` return a `sampleFrame` instead.

Adjust the calls in `Mixer`  and `Oscilloscope`.

* Simplify AudioEngine::getPeakValues

* Remove surroundSampleFrame

Some code assumes that `surroundSampleFrame` is interchangeable with `sampleFrame`. Thus, if the line `#define LMMS_DISABLE_SURROUND` is commented out in `lmms_basics.h` then the code does not compile anymore because `surroundSampleFrame` now is defined to be an array with four values instead of two. There also does not seem to be any support for surround sound (four channels instead of two) in the application. The faders and mixers do not seem to support more that two channels and the instruments and effects all expect a `sampleFrame`, i.e. stereo channels. It therefore makes sense to remove the "feature" because it also hinders the improvement of `sampleFrame`, e.g. by making it a class with some convenience methods that act on `sampleFrame` instances.

All occurrences of `surroundSampleFrame` are replaced with `sampleFrame`.

The version of `BufferManager::clear` that takes a `surroundSampleFrame` is removed completely.

The define `SURROUND_CHANNELS` is removed. All its occurrences are replaced with `DEFAULT_CHANNELS`.

Most of the audio devices classes, i.e. classes that inherit from `AudioDevice`, now clamp the configuration parameter between two values of `DEFAULT_CHANNELS`. This can be improved/streamlined later.

`BYTES_PER_SURROUND_FRAME` has been removed as it was not used anywhere anyway.

* Make sampleFrame a class

Make `sampleFrame` a class with several convenience methods. As a first step and demonstration adjust the follow methods to make use of the new functionality:
* `AudioEngine::getPeakValues`: Much more concise now.
* `lmms::MixHelpers::sanitize`: Better structure, better readable, less dereferencing and juggling with indices.
* `AddOp`, `AddMultipliedOp`, `multiply`: Make use of operators. Might become superfluous in the future.

* More operators and methods for sampleFrame

Add some more operators and methods to `sampleFrame`:
* Constructor which initializes both channels from a single sample value
* Assignment operator from a single sample value
* Addition/multiplication operators
* Scalar product

Adjust some more plugins to the new functionality of `sampleFrame`.

* Adjust DelayEffect to methods in sampleFrame

* Use composition instead of inheritance

Using inheritance was the quickest way to enable adding methods to `sampleFrame` without having to reimpement much of `std::array`s interface.

This is changed with this commit. The array is now a member of `sampleFrame` and the interface is extended with the necessary methods `data` and the index operator.

An `average` method was added so that no iterators need to be implemented (see changes in `SampleWaveform.cpp`).

* Apply suggestions from code review

Apply Veratil's suggestions from the code review

Co-authored-by: Kevin Zander <veratil@gmail.com>

* Fix warnings: zeroing non-trivial type

Fix several warnings of the following form:

Warnung: »void* memset(void*, int, size_t)« Säubern eines Objekts von nichttrivialem Typ »class lmms::sampleFrame«; use assignment or value-initialization instead [-Wclass-memaccess]

* Remove unnecessary reinterpret_casts

Remove some unnecessary reinterpret_casts with regards to `sampleFrame` buffers.

`PlayHandle::m_playHandleBuffer` already is a `sampleFrame*` and does not need a reinterpret_cast anymore.

In `LadspaEffect::processAudioBuffer` the `QVarLengthArray` is now directly initialized as an array of `sampleFrame` instances.

I guess in both places the `sampleFrame` previously was a `surroundSampleFrame` which has been removed.

* Clean up zeroSampleFrames code

* Fix warnings in RemotePlugin

Fix some warnings related to calls to `memcpy` in conjunction with`sampleFrame` which is now a class.

Add the helper functions `copyToSampleFrames` and `copyFromSampleFrames` and use them. The first function copies data from a `float` buffer into a `sampleFrame` buffer and the second copies vice versa.

* Rename "sampleFrame" to "SampleFrame"

Uppercase the name of `sampleFrame` so that it uses UpperCamelCase convention.

* Move SampleFrame into its own file

Move the class `SampleFrame` into its own class and remove it from `lmms_basics.h`.

Add forward includes to all headers where possible or include the `SampleFrame` header if it's not just referenced but used.

Add include to all cpp files where necessary.

It's a bit surprising that the `SampleFrame` header does not need to be included much more often in the implementation/cpp files. This is an indicator that it seems to be included via an include chain that at one point includes one of the headers where an include instead of a forward declaration had to be added in this commit.

* Return reference for += and *=

Return a reference for the compound assignment operators `+=` and `-=`.

* Explicit float constructor

Make the  constructor that takes a `float` explicit.

Remove the assignment operator that takes a `float`. Clients must use the
explicit `float` constructor and assign the result.

Adjust the code in "BitInvader" accordingly.

* Use std::fill in zeroSampleFrames

* Use zeroSampleFrames in sanitize

* Replace max with absMax

Replace `SampleFrame::max` with `SampleFrame::absMax`.

Use `absMax` in `DelayEffect::processAudioBuffer`. This should also fix
a buggy implementation of the peak computation.

Add the function `getAbsPeakValues`. It  computes the absolute peak
values for a buffer.

Remove `AudioEngine::getPeakValues`. It's not really the business of the
audio engine. Let `Mixer` and `Oscilloscope` use `getAbsPeakValues`.

* Replace scalarProduct

Replace the rather mathematical method `scalarProduct` with
`sumOfSquaredAmplitudes`. It was always called on itself anyway.

* Remove comment/TODO

* Simplify sanitize

Simplify the `sanitize` function by getting rid of the `bool found` and
by zeroing the buffer as soon as a problem is found.

* Put pointer symbols next to type

* Code review adjustments

* Remove "#pragme once"
* Adjust name of include guard
* Remove superfluous includes (leftovers from previous code changes)

---------

Co-authored-by: Kevin Zander <veratil@gmail.com>
This commit is contained in:
Michael Gregorius
2024-06-30 20:21:19 +02:00
committed by GitHub
parent a0fbd7e7b4
commit 286e62adf5
199 changed files with 879 additions and 668 deletions

View File

@@ -57,7 +57,7 @@ AmplifierEffect::AmplifierEffect(Model* parent, const Descriptor::SubPluginFeatu
}
bool AmplifierEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
bool AmplifierEffect::processAudioBuffer(SampleFrame* buf, const fpp_t frames)
{
if (!isEnabled() || !isRunning()) { return false ; }
@@ -80,14 +80,14 @@ bool AmplifierEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
const float panLeft = std::min(1.0f, 1.0f - pan);
const float panRight = std::min(1.0f, 1.0f + pan);
auto s = std::array{buf[f][0], buf[f][1]};
auto& currentFrame = buf[f];
s[0] *= volume * left * panLeft;
s[1] *= volume * right * panRight;
const auto s = currentFrame * SampleFrame(left * panLeft, right * panRight) * volume;
buf[f][0] = d * buf[f][0] + w * s[0];
buf[f][1] = d * buf[f][1] + w * s[1];
outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
// Dry/wet mix
currentFrame = currentFrame * d + s * w;
outSum += currentFrame.sumOfSquaredAmplitudes();
}
checkGate(outSum / frames);

View File

@@ -37,7 +37,7 @@ class AmplifierEffect : public Effect
public:
AmplifierEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
~AmplifierEffect() override = default;
bool processAudioBuffer(sampleFrame* buf, const fpp_t frames) override;
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames) override;
EffectControls* controls() override
{

View File

@@ -105,7 +105,7 @@ AudioFileProcessor::AudioFileProcessor( InstrumentTrack * _instrument_track ) :
void AudioFileProcessor::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();
@@ -165,7 +165,7 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
}
else
{
memset( _working_buffer, 0, ( frames + offset ) * sizeof( sampleFrame ) );
zeroSampleFrames(_working_buffer, frames + offset);
emit isPlaying( 0 );
}
}

View File

@@ -44,7 +44,7 @@ public:
AudioFileProcessor( InstrumentTrack * _instrument_track );
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
void saveSettings(QDomDocument& doc, QDomElement& elem) override;

View File

@@ -69,7 +69,7 @@ BassBoosterEffect::BassBoosterEffect( Model* parent, const Descriptor::SubPlugin
bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
bool BassBoosterEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{
@@ -91,23 +91,19 @@ bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
const float d = dryLevel();
const float w = wetLevel();
for( fpp_t f = 0; f < frames; ++f )
for (fpp_t f = 0; f < frames; ++f)
{
float gain = const_gain;
if (gainBuffer) {
//process period using sample exact data
gain = gainBuffer->value( f );
}
//float gain = gainBuffer ? gainBuffer[f] : gain;
m_bbFX.leftFX().setGain( gain );
m_bbFX.rightFX().setGain( gain);
auto& currentFrame = buf[f];
auto s = std::array{buf[f][0], buf[f][1]};
m_bbFX.nextSample( s[0], s[1] );
// Process copy of current sample frame
m_bbFX.setGain(gainBuffer ? gainBuffer->value(f) : const_gain);
auto s = currentFrame;
m_bbFX.nextSample(s);
buf[f][0] = d * buf[f][0] + w * s[0];
buf[f][1] = d * buf[f][1] + w * s[1];
outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
// Dry/wet mix
currentFrame = currentFrame * d + s * w;
outSum += currentFrame.sumOfSquaredAmplitudes();
}
checkGate( outSum / frames );

View File

@@ -38,7 +38,7 @@ class BassBoosterEffect : public Effect
public:
BassBoosterEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
~BassBoosterEffect() override = default;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{

View File

@@ -256,7 +256,7 @@ QString BitInvader::nodeName() const
void BitInvader::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
if (!_n->m_pluginData)
{
@@ -274,11 +274,7 @@ void BitInvader::playNote( NotePlayHandle * _n,
auto ps = static_cast<BSynth*>(_n->m_pluginData);
for( fpp_t frame = offset; frame < frames + offset; ++frame )
{
const sample_t cur = ps->nextStringSample( m_graph.length() );
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
{
_working_buffer[frame][chnl] = cur;
}
_working_buffer[frame] = SampleFrame(ps->nextStringSample(m_graph.length()));
}
applyRelease( _working_buffer, _n );

View File

@@ -75,7 +75,7 @@ public:
~BitInvader() override = default;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

View File

@@ -62,7 +62,7 @@ BitcrushEffect::BitcrushEffect( Model * parent, const Descriptor::SubPluginFeatu
m_sampleRate( Engine::audioEngine()->outputSampleRate() ),
m_filter( m_sampleRate )
{
m_buffer = new sampleFrame[Engine::audioEngine()->framesPerPeriod() * OS_RATE];
m_buffer = new SampleFrame[Engine::audioEngine()->framesPerPeriod() * OS_RATE];
m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) );
m_needsUpdate = true;
@@ -100,7 +100,7 @@ inline float BitcrushEffect::noise( float amt )
return fastRandf( amt * 2.0f ) - amt;
}
bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
bool BitcrushEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{

View File

@@ -41,7 +41,7 @@ class BitcrushEffect : public Effect
public:
BitcrushEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
~BitcrushEffect() override;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{
@@ -55,7 +55,7 @@ private:
BitcrushControls m_controls;
sampleFrame * m_buffer;
SampleFrame* m_buffer;
float m_sampleRate;
StereoLinkwitzRiley m_filter;

View File

@@ -495,11 +495,11 @@ void CarlaInstrument::loadSettings(const QDomElement& elem)
#endif
}
void CarlaInstrument::play(sampleFrame* workingBuffer)
void CarlaInstrument::play(SampleFrame* workingBuffer)
{
const uint bufsize = Engine::audioEngine()->framesPerPeriod();
std::memset(workingBuffer, 0, sizeof(sample_t)*bufsize*DEFAULT_CHANNELS);
zeroSampleFrames(workingBuffer, bufsize);
if (fHandle == nullptr)
{

View File

@@ -193,7 +193,7 @@ public:
QString nodeName() const override;
void saveSettings(QDomDocument& doc, QDomElement& parent) override;
void loadSettings(const QDomElement& elem) override;
void play(sampleFrame* workingBuffer) override;
void play(SampleFrame* workingBuffer) override;
bool handleMidiEvent(const MidiEvent& event, const TimePos& time, f_cnt_t offset) override;
gui::PluginView* instantiateView(QWidget* parent) override;

View File

@@ -233,7 +233,7 @@ void CompressorEffect::calcMix()
bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
bool CompressorEffect::processAudioBuffer(SampleFrame* buf, const fpp_t frames)
{
if (!isEnabled() || !isRunning())
{

View File

@@ -43,7 +43,7 @@ class CompressorEffect : public Effect
public:
CompressorEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
~CompressorEffect() override = default;
bool processAudioBuffer(sampleFrame* buf, const fpp_t frames) override;
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames) override;
EffectControls* controls() override
{
@@ -105,7 +105,7 @@ private:
float m_coeffPrecalc;
sampleFrame m_maxLookaheadVal;
SampleFrame m_maxLookaheadVal;
int m_maxLookaheadTimer[2] = {1, 1};

View File

@@ -64,9 +64,9 @@ CrossoverEQEffect::CrossoverEQEffect( Model* parent, const Descriptor::SubPlugin
m_hp4( m_sampleRate ),
m_needsUpdate( true )
{
m_tmp2 = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_tmp1 = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_work = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_tmp2 = new SampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_tmp1 = new SampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_work = new SampleFrame[Engine::audioEngine()->framesPerPeriod()];
}
CrossoverEQEffect::~CrossoverEQEffect()
@@ -89,7 +89,7 @@ void CrossoverEQEffect::sampleRateChanged()
}
bool CrossoverEQEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
bool CrossoverEQEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{
@@ -139,7 +139,7 @@ bool CrossoverEQEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
m_needsUpdate = false;
memset( m_work, 0, sizeof( sampleFrame ) * frames );
zeroSampleFrames(m_work, frames);
// run temp bands
for( int f = 0; f < frames; ++f )

View File

@@ -40,7 +40,7 @@ class CrossoverEQEffect : public Effect
public:
CrossoverEQEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
~CrossoverEQEffect() override;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{
@@ -69,9 +69,9 @@ private:
StereoLinkwitzRiley m_hp3;
StereoLinkwitzRiley m_hp4;
sampleFrame * m_tmp1;
sampleFrame * m_tmp2;
sampleFrame * m_work;
SampleFrame* m_tmp1;
SampleFrame* m_tmp2;
SampleFrame* m_work;
bool m_needsUpdate;

View File

@@ -81,7 +81,7 @@ DelayEffect::~DelayEffect()
bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
bool DelayEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{
@@ -91,9 +91,8 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
const float sr = Engine::audioEngine()->outputSampleRate();
const float d = dryLevel();
const float w = wetLevel();
auto dryS = std::array<sample_t, 2>{};
float lPeak = 0.0;
float rPeak = 0.0;
SampleFrame peak;
float length = m_delayControls.m_delayTimeModel.value();
float amplitude = m_delayControls.m_lfoAmountModel.value() * sr;
float lfoTime = 1.0 / m_delayControls.m_lfoTimeModel.value();
@@ -116,26 +115,28 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
m_outGain = dbfsToAmp( m_delayControls.m_outGainModel.value() );
}
for( fpp_t f = 0; f < frames; ++f )
for (fpp_t f = 0; f < frames; ++f)
{
dryS[0] = buf[f][0];
dryS[1] = buf[f][1];
auto& currentFrame = buf[f];
const auto dryS = currentFrame;
// Prepare delay for current sample
m_delay->setFeedback( *feedbackPtr );
m_lfo->setFrequency( *lfoTimePtr );
m_currentLength = static_cast<int>(*lengthPtr * Engine::audioEngine()->outputSampleRate());
m_delay->setLength( m_currentLength + ( *amplitudePtr * ( float )m_lfo->tick() ) );
m_delay->tick( buf[f] );
buf[f][0] *= m_outGain;
buf[f][1] *= m_outGain;
// Process the wet signal
m_delay->tick( currentFrame );
currentFrame *= m_outGain;
lPeak = buf[f][0] > lPeak ? buf[f][0] : lPeak;
rPeak = buf[f][1] > rPeak ? buf[f][1] : rPeak;
// Calculate peak of wet signal
peak = peak.absMax(currentFrame);
buf[f][0] = ( d * dryS[0] ) + ( w * buf[f][0] );
buf[f][1] = ( d * dryS[1] ) + ( w * buf[f][1] );
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];
// Dry/wet mix
currentFrame = dryS * d + currentFrame * w;
outSum += currentFrame.sumOfSquaredAmplitudes();
lengthPtr += lengthInc;
amplitudePtr += amplitudeInc;
@@ -143,8 +144,8 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
feedbackPtr += feedbackInc;
}
checkGate( outSum / frames );
m_delayControls.m_outPeakL = lPeak;
m_delayControls.m_outPeakR = rPeak;
m_delayControls.m_outPeakL = peak.left();
m_delayControls.m_outPeakR = peak.right();
return isRunning();
}

View File

@@ -39,7 +39,7 @@ class DelayEffect : public Effect
public:
DelayEffect(Model* parent , const Descriptor::SubPluginFeatures::Key* key );
~DelayEffect() override;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{
return &m_delayControls;

View File

@@ -23,7 +23,9 @@
*/
#include "StereoDelay.h"
#include "lmms_basics.h"
#include "SampleFrame.h"
namespace lmms
{
@@ -55,7 +57,7 @@ StereoDelay::~StereoDelay()
void StereoDelay::tick( sampleFrame& frame )
void StereoDelay::tick( SampleFrame& frame )
{
m_writeIndex = ( m_writeIndex + 1 ) % ( int )m_maxLength;
int readIndex = m_writeIndex - static_cast<int>(m_length);
@@ -81,7 +83,7 @@ void StereoDelay::setSampleRate( int sampleRate )
}
int bufferSize = ( int )( sampleRate * m_maxTime );
m_buffer = new sampleFrame[bufferSize];
m_buffer = new SampleFrame[bufferSize];
for( int i = 0 ; i < bufferSize ; i++)
{
m_buffer[i][0] = 0.0;

View File

@@ -31,6 +31,8 @@
namespace lmms
{
class SampleFrame;
class StereoDelay
{
public:
@@ -49,11 +51,11 @@ public:
m_feedback = feedback;
}
void tick( sampleFrame& frame );
void tick( SampleFrame& frame );
void setSampleRate( int sampleRate );
private:
sampleFrame* m_buffer;
SampleFrame* m_buffer;
int m_maxLength;
float m_length;
int m_writeIndex;

View File

@@ -58,7 +58,7 @@ DispersionEffect::DispersionEffect(Model* parent, const Descriptor::SubPluginFea
}
bool DispersionEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
bool DispersionEffect::processAudioBuffer(SampleFrame* buf, const fpp_t frames)
{
if (!isEnabled() || !isRunning())
{

View File

@@ -41,7 +41,7 @@ class DispersionEffect : public Effect
public:
DispersionEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
~DispersionEffect() override = default;
bool processAudioBuffer(sampleFrame* buf, const fpp_t frames) override;
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames) override;
EffectControls* controls() override
{

View File

@@ -77,7 +77,7 @@ DualFilterEffect::~DualFilterEffect()
bool DualFilterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
bool DualFilterEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{

View File

@@ -40,7 +40,7 @@ class DualFilterEffect : public Effect
public:
DualFilterEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
~DualFilterEffect() override;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{

View File

@@ -91,7 +91,7 @@ inline void DynProcEffect::calcRelease()
}
bool DynProcEffect::processAudioBuffer( sampleFrame * _buf,
bool DynProcEffect::processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames )
{
if( !isEnabled() || !isRunning () )

View File

@@ -42,7 +42,7 @@ public:
DynProcEffect( Model * _parent,
const Descriptor::SubPluginFeatures::Key * _key );
~DynProcEffect() override;
bool processAudioBuffer( sampleFrame * _buf,
bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) override;
EffectControls * controls() override

View File

@@ -64,7 +64,7 @@ EqEffect::EqEffect( Model *parent, const Plugin::Descriptor::SubPluginFeatures::
bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
bool EqEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
const int sampleRate = Engine::audioEngine()->outputSampleRate();
@@ -157,7 +157,7 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
}
const float outGain = m_outGain;
sampleFrame m_inPeak = { 0, 0 };
SampleFrame m_inPeak = { 0, 0 };
if(m_eqControls.m_analyseInModel.value( true ) && outSum > 0 && m_eqControls.isViewVisible() )
{
@@ -263,7 +263,7 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
}
sampleFrame outPeak = { 0, 0 };
SampleFrame outPeak = { 0, 0 };
gain( buf, frames, outGain, &outPeak );
m_eqControls.m_outPeakL = m_eqControls.m_outPeakL < outPeak[0] ? outPeak[0] : m_eqControls.m_outPeakL;
m_eqControls.m_outPeakR = m_eqControls.m_outPeakR < outPeak[1] ? outPeak[1] : m_eqControls.m_outPeakR;

View File

@@ -40,12 +40,12 @@ class EqEffect : public Effect
public:
EqEffect( Model * parent , const Descriptor::SubPluginFeatures::Key * key );
~EqEffect() override = default;
bool processAudioBuffer( sampleFrame * buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls * controls() override
{
return &m_eqControls;
}
inline void gain( sampleFrame * buf, const fpp_t frames, float scale, sampleFrame * peak )
inline void gain( SampleFrame* buf, const fpp_t frames, float scale, SampleFrame* peak )
{
peak[0][0] = 0.0f; peak[0][1] = 0.0f;
for( fpp_t f = 0; f < frames; ++f )

View File

@@ -432,7 +432,7 @@ public:
virtual void processBuffer( sampleFrame* buf, const fpp_t frames )
virtual void processBuffer( SampleFrame* buf, const fpp_t frames )
{
for ( fpp_t f = 0 ; f < frames ; ++f)
{

View File

@@ -75,7 +75,7 @@ EqAnalyser::~EqAnalyser()
void EqAnalyser::analyze( sampleFrame *buf, const fpp_t frames )
void EqAnalyser::analyze( SampleFrame* buf, const fpp_t frames )
{
//only analyse if the view is visible
if ( m_active )

View File

@@ -32,6 +32,7 @@
namespace lmms
{
class SampleFrame;
const int MAX_BANDS = 2048;
class EqAnalyser
@@ -44,7 +45,7 @@ public:
bool getInProgress();
void clear();
void analyze( sampleFrame *buf, const fpp_t frames );
void analyze( SampleFrame* buf, const fpp_t frames );
float getEnergy() const;
int getSampleRate() const;

View File

@@ -90,7 +90,7 @@ FlangerEffect::~FlangerEffect()
bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
bool FlangerEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{

View File

@@ -42,7 +42,7 @@ class FlangerEffect : public Effect
public:
FlangerEffect( Model* parent , const Descriptor::SubPluginFeatures::Key* key );
~FlangerEffect() override;
bool processAudioBuffer( sampleFrame *buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{
return &m_flangerControls;

View File

@@ -228,7 +228,7 @@ float FreeBoyInstrument::desiredReleaseTimeMs() const
void FreeBoyInstrument::playNote(NotePlayHandle* nph, sampleFrame* workingBuffer)
void FreeBoyInstrument::playNote(NotePlayHandle* nph, SampleFrame* workingBuffer)
{
const f_cnt_t tfp = nph->totalFramesPlayed();
const int samplerate = Engine::audioEngine()->outputSampleRate();

View File

@@ -55,7 +55,7 @@ public:
FreeBoyInstrument( InstrumentTrack * _instrument_track );
~FreeBoyInstrument() override = default;
void playNote(NotePlayHandle* nph, sampleFrame* workingBuffer) override;
void playNote(NotePlayHandle* nph, SampleFrame* workingBuffer) override;
void deleteNotePluginData(NotePlayHandle* nph) override;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;

View File

@@ -289,7 +289,7 @@ QString GigInstrument::getCurrentPatchName()
// A key has been pressed
void GigInstrument::playNote( NotePlayHandle * _n, sampleFrame * )
void GigInstrument::playNote( NotePlayHandle * _n, SampleFrame* )
{
const float LOG440 = 2.643452676f;
@@ -320,7 +320,7 @@ void GigInstrument::playNote( NotePlayHandle * _n, sampleFrame * )
// Process the notes and output a certain number of frames (e.g. 256, set in
// the preferences)
void GigInstrument::play( sampleFrame * _working_buffer )
void GigInstrument::play( SampleFrame* _working_buffer )
{
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
const int rate = Engine::audioEngine()->outputSampleRate();
@@ -441,7 +441,7 @@ void GigInstrument::play( sampleFrame * _working_buffer )
}
// Load this note's data
sampleFrame sampleData[samples];
SampleFrame sampleData[samples];
loadSample(sample, sampleData, samples);
// Apply ADSR using a copy so if we don't use these samples when
@@ -458,7 +458,7 @@ void GigInstrument::play( sampleFrame * _working_buffer )
// Output the data resampling if needed
if( resample == true )
{
sampleFrame convertBuf[frames];
SampleFrame convertBuf[frames];
// Only output if resampling is successful (note that "used" is output)
if (sample.convertSampleRate(*sampleData, *convertBuf, samples, frames, freq_factor, used))
@@ -499,7 +499,7 @@ void GigInstrument::play( sampleFrame * _working_buffer )
void GigInstrument::loadSample( GigSample& sample, sampleFrame* sampleData, f_cnt_t samples )
void GigInstrument::loadSample( GigSample& sample, SampleFrame* sampleData, f_cnt_t samples )
{
if( sampleData == nullptr || samples < 1 )
{
@@ -1182,7 +1182,7 @@ void GigSample::updateSampleRate()
bool GigSample::convertSampleRate( sampleFrame & oldBuf, sampleFrame & newBuf,
bool GigSample::convertSampleRate( SampleFrame & oldBuf, SampleFrame & newBuf,
f_cnt_t oldSize, f_cnt_t newSize, float freq_factor, f_cnt_t& used )
{
if( srcState == nullptr )

View File

@@ -157,7 +157,7 @@ public:
// Needed since libsamplerate stores data internally between calls
void updateSampleRate();
bool convertSampleRate( sampleFrame & oldBuf, sampleFrame & newBuf,
bool convertSampleRate( SampleFrame & oldBuf, SampleFrame & newBuf,
f_cnt_t oldSize, f_cnt_t newSize, float freq_factor, f_cnt_t& used );
gig::Sample * sample;
@@ -243,10 +243,10 @@ public:
GigInstrument( InstrumentTrack * _instrument_track );
~GigInstrument() override;
void play( sampleFrame * _working_buffer ) override;
void play( SampleFrame* _working_buffer ) override;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
@@ -312,7 +312,7 @@ private:
Dimension getDimensions( gig::Region * pRegion, int velocity, bool release );
// Load sample data from the Gig file, looping the sample where needed
void loadSample( GigSample& sample, sampleFrame* sampleData, f_cnt_t samples );
void loadSample( GigSample& sample, SampleFrame* sampleData, f_cnt_t samples );
f_cnt_t getLoopedIndex( f_cnt_t index, f_cnt_t startf, f_cnt_t endf ) const;
f_cnt_t getPingPongIndex( f_cnt_t index, f_cnt_t startf, f_cnt_t endf ) const;

View File

@@ -60,7 +60,7 @@ GranularPitchShifterEffect::GranularPitchShifterEffect(Model* parent, const Desc
}
bool GranularPitchShifterEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
bool GranularPitchShifterEffect::processAudioBuffer(SampleFrame* buf, const fpp_t frames)
{
if (!isEnabled() || !isRunning()) { return false; }

View File

@@ -48,7 +48,7 @@ class GranularPitchShifterEffect : public Effect
public:
GranularPitchShifterEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
~GranularPitchShifterEffect() override = default;
bool processAudioBuffer(sampleFrame* buf, const fpp_t frames) override;
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames) override;
EffectControls* controls() override
{

View File

@@ -156,7 +156,7 @@ using DistFX = DspEffectLibrary::Distortion;
using SweepOsc = KickerOsc<DspEffectLibrary::MonoToStereoAdaptor<DistFX>>;
void KickerInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

View File

@@ -56,7 +56,7 @@ public:
~KickerInstrument() override = default;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
void saveSettings(QDomDocument& doc, QDomElement& elem) override;

View File

@@ -60,7 +60,7 @@ public:
virtual ~KickerOsc() = default;
void update( sampleFrame* buf, const fpp_t frames, const float sampleRate )
void update( SampleFrame* buf, const fpp_t frames, const float sampleRate )
{
for( fpp_t frame = 0; frame < frames; ++frame )
{

View File

@@ -101,7 +101,7 @@ void LOMMEffect::changeSampleRate()
}
bool LOMMEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
bool LOMMEffect::processAudioBuffer(SampleFrame* buf, const fpp_t frames)
{
if (!isEnabled() || !isRunning())
{

View File

@@ -45,7 +45,7 @@ class LOMMEffect : public Effect
public:
LOMMEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
~LOMMEffect() override = default;
bool processAudioBuffer(sampleFrame* buf, const fpp_t frames) override;
bool processAudioBuffer(SampleFrame* buf, const fpp_t frames) override;
EffectControls* controls() override
{

View File

@@ -129,7 +129,7 @@ void LadspaEffect::changeSampleRate()
bool LadspaEffect::processAudioBuffer( sampleFrame * _buf,
bool LadspaEffect::processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames )
{
m_pluginMutex.lock();
@@ -140,13 +140,13 @@ bool LadspaEffect::processAudioBuffer( sampleFrame * _buf,
}
int frames = _frames;
sampleFrame * o_buf = nullptr;
QVarLengthArray<sample_t> sBuf(_frames * DEFAULT_CHANNELS);
SampleFrame* o_buf = nullptr;
QVarLengthArray<SampleFrame> sBuf(_frames);
if( m_maxSampleRate < Engine::audioEngine()->outputSampleRate() )
{
o_buf = _buf;
_buf = reinterpret_cast<sampleFrame*>(sBuf.data());
_buf = sBuf.data();
sampleDown( o_buf, _buf, m_maxSampleRate );
frames = _frames * m_maxSampleRate /
Engine::audioEngine()->outputSampleRate();

View File

@@ -47,7 +47,7 @@ public:
const Descriptor::SubPluginFeatures::Key * _key );
~LadspaEffect() override;
bool processAudioBuffer( sampleFrame * _buf,
bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) override;
void setControl( int _control, LADSPA_Data _data );

View File

@@ -462,7 +462,7 @@ inline float GET_INC(float freq) {
return freq/Engine::audioEngine()->outputSampleRate(); // TODO: Use actual sampling rate.
}
int Lb302Synth::process(sampleFrame *outbuf, const int size)
int Lb302Synth::process(SampleFrame* outbuf, const int size)
{
const float sampleRatio = 44100.f / Engine::audioEngine()->outputSampleRate();
@@ -732,7 +732,7 @@ void Lb302Synth::initSlide()
}
void Lb302Synth::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer )
void Lb302Synth::playNote( NotePlayHandle * _n, SampleFrame* _working_buffer )
{
if( _n->isMasterNote() || ( _n->hasParent() && _n->isReleased() ) )
{
@@ -791,7 +791,7 @@ void Lb302Synth::processNote( NotePlayHandle * _n )
void Lb302Synth::play( sampleFrame * _working_buffer )
void Lb302Synth::play( SampleFrame* _working_buffer )
{
m_notesMutex.lock();
while( ! m_notes.isEmpty() )

View File

@@ -152,9 +152,9 @@ public:
Lb302Synth( InstrumentTrack * _instrument_track );
~Lb302Synth() override;
void play( sampleFrame * _working_buffer ) override;
void play( SampleFrame* _working_buffer ) override;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
@@ -246,7 +246,7 @@ private:
void recalcFilter();
int process(sampleFrame *outbuf, const int size);
int process(SampleFrame* outbuf, const int size);
friend class gui::Lb302SynthView;

View File

@@ -68,7 +68,7 @@ Lv2Effect::Lv2Effect(Model* parent, const Descriptor::SubPluginFeatures::Key *ke
bool Lv2Effect::processAudioBuffer(sampleFrame *buf, const fpp_t frames)
bool Lv2Effect::processAudioBuffer(SampleFrame* buf, const fpp_t frames)
{
if (!isEnabled() || !isRunning()) { return false; }
Q_ASSERT(frames <= static_cast<fpp_t>(m_tmpOutputSmps.size()));

View File

@@ -42,7 +42,7 @@ public:
*/
Lv2Effect(Model* parent, const Descriptor::SubPluginFeatures::Key* _key);
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override { return &m_controls; }
Lv2FxControls* lv2Controls() { return &m_controls; }
@@ -50,7 +50,7 @@ public:
private:
Lv2FxControls m_controls;
std::vector<sampleFrame> m_tmpOutputSmps;
std::vector<SampleFrame> m_tmpOutputSmps;
};

View File

@@ -177,7 +177,7 @@ bool Lv2Instrument::handleMidiEvent(
// not yet working
#ifndef LV2_INSTRUMENT_USE_MIDI
void Lv2Instrument::playNote(NotePlayHandle *nph, sampleFrame *)
void Lv2Instrument::playNote(NotePlayHandle *nph, SampleFrame*)
{
}
#endif
@@ -185,7 +185,7 @@ void Lv2Instrument::playNote(NotePlayHandle *nph, sampleFrame *)
void Lv2Instrument::play(sampleFrame *buf)
void Lv2Instrument::play(SampleFrame* buf)
{
copyModelsFromLmms();

View File

@@ -77,9 +77,9 @@ public:
bool handleMidiEvent(const MidiEvent &event,
const TimePos &time = TimePos(), f_cnt_t offset = 0) override;
#else
void playNote(NotePlayHandle *nph, sampleFrame *) override;
void playNote(NotePlayHandle *nph, SampleFrame*) override;
#endif
void play(sampleFrame *buf) override;
void play(SampleFrame* buf) override;
/*
misc

View File

@@ -110,7 +110,7 @@ MonstroSynth::MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph ) :
}
void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
void MonstroSynth::renderOutput( fpp_t _frames, SampleFrame* _buf )
{
float modtmp; // temp variable for freq modulation
// macros for modulating with env/lfos
@@ -1062,7 +1062,7 @@ MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) :
void MonstroInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

View File

@@ -177,7 +177,7 @@ public:
MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph );
virtual ~MonstroSynth() = default;
void renderOutput( fpp_t _frames, sampleFrame * _buf );
void renderOutput( fpp_t _frames, SampleFrame* _buf );
private:
@@ -357,7 +357,7 @@ public:
~MonstroInstrument() override = default;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
void saveSettings( QDomDocument & _doc,

View File

@@ -58,7 +58,7 @@ MultitapEchoEffect::MultitapEchoEffect( Model* parent, const Descriptor::SubPlug
m_sampleRate( Engine::audioEngine()->outputSampleRate() ),
m_sampleRatio( 1.0f / m_sampleRate )
{
m_work = new sampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_work = new SampleFrame[Engine::audioEngine()->framesPerPeriod()];
m_buffer.reset();
m_stages = static_cast<int>( m_controls.m_stages.value() );
updateFilters( 0, 19 );
@@ -83,7 +83,7 @@ void MultitapEchoEffect::updateFilters( int begin, int end )
}
void MultitapEchoEffect::runFilter( sampleFrame * dst, sampleFrame * src, StereoOnePole & filter, const fpp_t frames )
void MultitapEchoEffect::runFilter( SampleFrame* dst, SampleFrame* src, StereoOnePole & filter, const fpp_t frames )
{
for( int f = 0; f < frames; ++f )
{
@@ -93,7 +93,7 @@ void MultitapEchoEffect::runFilter( sampleFrame * dst, sampleFrame * src, Stereo
}
bool MultitapEchoEffect::processAudioBuffer( sampleFrame * buf, const fpp_t frames )
bool MultitapEchoEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{

View File

@@ -40,7 +40,7 @@ class MultitapEchoEffect : public Effect
public:
MultitapEchoEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
~MultitapEchoEffect() override;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{
@@ -49,7 +49,7 @@ public:
private:
void updateFilters( int begin, int end );
void runFilter( sampleFrame * dst, sampleFrame * src, StereoOnePole & filter, const fpp_t frames );
void runFilter( SampleFrame* dst, SampleFrame* src, StereoOnePole & filter, const fpp_t frames );
inline void setFilterFreq( float fc, StereoOnePole & f )
{
@@ -70,7 +70,7 @@ private:
float m_sampleRate;
float m_sampleRatio;
sampleFrame * m_work;
SampleFrame* m_work;
friend class MultitapEchoControls;

View File

@@ -103,7 +103,7 @@ NesObject::NesObject( NesInstrument * nes, const sample_rate_t samplerate, NoteP
}
void NesObject::renderOutput( sampleFrame * buf, fpp_t frames )
void NesObject::renderOutput( SampleFrame* buf, fpp_t frames )
{
////////////////////////////////
// //
@@ -545,7 +545,7 @@ NesInstrument::NesInstrument( InstrumentTrack * instrumentTrack ) :
void NesInstrument::playNote( NotePlayHandle * n, sampleFrame * workingBuffer )
void NesInstrument::playNote( NotePlayHandle * n, SampleFrame* workingBuffer )
{
const fpp_t frames = n->framesLeftForCurrentPeriod();
const f_cnt_t offset = n->noteOffset();

View File

@@ -95,7 +95,7 @@ public:
NesObject( NesInstrument * nes, const sample_rate_t samplerate, NotePlayHandle * nph );
virtual ~NesObject() = default;
void renderOutput( sampleFrame * buf, fpp_t frames );
void renderOutput( SampleFrame* buf, fpp_t frames );
void updateVibrato( float * freq );
void updatePitch();
@@ -212,7 +212,7 @@ public:
~NesInstrument() override = default;
void playNote( NotePlayHandle * n,
sampleFrame * workingBuffer ) override;
SampleFrame* workingBuffer ) override;
void deleteNotePluginData( NotePlayHandle * n ) override;

View File

@@ -390,7 +390,7 @@ gui::PluginView* OpulenzInstrument::instantiateView( QWidget * _parent )
}
void OpulenzInstrument::play( sampleFrame * _working_buffer )
void OpulenzInstrument::play( SampleFrame* _working_buffer )
{
emulatorMutex.lock();
theEmulator->update(renderbuffer, frameCount);

View File

@@ -65,7 +65,7 @@ public:
gui::PluginView* instantiateView( QWidget * _parent ) override;
bool handleMidiEvent( const MidiEvent& event, const TimePos& time, f_cnt_t offset = 0 ) override;
void play( sampleFrame * _working_buffer ) override;
void play( SampleFrame* _working_buffer ) override;
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;

View File

@@ -221,7 +221,7 @@ QString OrganicInstrument::nodeName() const
void OrganicInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

View File

@@ -125,7 +125,7 @@ public:
~OrganicInstrument() override;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

View File

@@ -134,7 +134,7 @@ QString PatmanInstrument::nodeName() const
void PatmanInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
if( m_patchFile == "" )
{
@@ -160,7 +160,7 @@ void PatmanInstrument::playNote( NotePlayHandle * _n,
}
else
{
memset( _working_buffer, 0, ( frames + offset ) * sizeof( sampleFrame ) );
zeroSampleFrames(_working_buffer, frames + offset);
}
}
@@ -342,7 +342,7 @@ PatmanInstrument::LoadError PatmanInstrument::loadPatch(
}
}
auto data = new sampleFrame[frames];
auto data = new SampleFrame[frames];
for( f_cnt_t frame = 0; frame < frames; ++frame )
{

View File

@@ -60,7 +60,7 @@ public:
~PatmanInstrument() override;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

View File

@@ -93,7 +93,7 @@ PeakControllerEffect::~PeakControllerEffect()
}
bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf,
bool PeakControllerEffect::processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames )
{
PeakControllerEffectControls & c = m_peakControls;

View File

@@ -41,7 +41,7 @@ public:
PeakControllerEffect( Model * parent,
const Descriptor::SubPluginFeatures::Key * _key );
~PeakControllerEffect() override;
bool processAudioBuffer( sampleFrame * _buf,
bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) override;
EffectControls * controls() override

View File

@@ -75,7 +75,7 @@ ReverbSCEffect::~ReverbSCEffect()
sp_destroy(&sp);
}
bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
bool ReverbSCEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{

View File

@@ -45,7 +45,7 @@ class ReverbSCEffect : public Effect
public:
ReverbSCEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
~ReverbSCEffect() override;
bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ) override;
bool processAudioBuffer( SampleFrame* buf, const fpp_t frames ) override;
EffectControls* controls() override
{

View File

@@ -647,7 +647,7 @@ void Sf2Instrument::reloadSynth()
void Sf2Instrument::playNote( NotePlayHandle * _n, sampleFrame * )
void Sf2Instrument::playNote( NotePlayHandle * _n, SampleFrame* )
{
if( _n->isMasterNote() || ( _n->hasParent() && _n->isReleased() ) )
{
@@ -782,7 +782,7 @@ void Sf2Instrument::noteOff( Sf2PluginData * n )
}
void Sf2Instrument::play( sampleFrame * _working_buffer )
void Sf2Instrument::play( SampleFrame* _working_buffer )
{
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
@@ -868,7 +868,7 @@ void Sf2Instrument::play( sampleFrame * _working_buffer )
}
void Sf2Instrument::renderFrames( f_cnt_t frames, sampleFrame * buf )
void Sf2Instrument::renderFrames( f_cnt_t frames, SampleFrame* buf )
{
m_synthMutex.lock();
fluid_synth_get_gain(m_synth); // This flushes voice updates as a side effect
@@ -877,9 +877,9 @@ void Sf2Instrument::renderFrames( f_cnt_t frames, sampleFrame * buf )
{
const fpp_t f = frames * m_internalSampleRate / Engine::audioEngine()->outputSampleRate();
#ifdef __GNUC__
sampleFrame tmp[f];
SampleFrame tmp[f];
#else
sampleFrame * tmp = new sampleFrame[f];
SampleFrame* tmp = new SampleFrame[f];
#endif
fluid_synth_write_float( m_synth, f, tmp, 0, 2, tmp, 1, 2 );

View File

@@ -64,10 +64,10 @@ public:
Sf2Instrument( InstrumentTrack * _instrument_track );
~Sf2Instrument() override;
void play( sampleFrame * _working_buffer ) override;
void play( SampleFrame* _working_buffer ) override;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
@@ -150,7 +150,7 @@ private:
void freeFont();
void noteOn( Sf2PluginData * n );
void noteOff( Sf2PluginData * n );
void renderFrames( f_cnt_t frames, sampleFrame * buf );
void renderFrames( f_cnt_t frames, SampleFrame* buf );
friend class gui::Sf2InstrumentView;

View File

@@ -157,7 +157,7 @@ void SfxrSynth::resetSample( bool restart )
void SfxrSynth::update( sampleFrame * buffer, const int32_t frameNum )
void SfxrSynth::update( SampleFrame* buffer, const int32_t frameNum )
{
for(int i=0;i<frameNum;i++)
{
@@ -442,7 +442,7 @@ QString SfxrInstrument::nodeName() const
void SfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer )
void SfxrInstrument::playNote( NotePlayHandle * _n, SampleFrame* _working_buffer )
{
float currentSampleRate = Engine::audioEngine()->outputSampleRate();
@@ -454,7 +454,7 @@ void SfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffe
}
else if( static_cast<SfxrSynth*>(_n->m_pluginData)->isPlaying() == false )
{
memset(_working_buffer + offset, 0, sizeof(sampleFrame) * frameNum);
zeroSampleFrames(_working_buffer + offset, frameNum);
_n->noteOff();
return;
}
@@ -467,7 +467,7 @@ void SfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffe
// debug code
// qDebug( "pFN %d", pitchedFrameNum );
auto pitchedBuffer = new sampleFrame[pitchedFrameNum];
auto pitchedBuffer = new SampleFrame[pitchedFrameNum];
static_cast<SfxrSynth*>(_n->m_pluginData)->update( pitchedBuffer, pitchedFrameNum );
for( fpp_t i=0; i<frameNum; i++ )
{

View File

@@ -82,7 +82,7 @@ public:
virtual ~SfxrSynth() = default;
void resetSample( bool restart );
void update( sampleFrame * buffer, const int32_t frameNum );
void update( SampleFrame* buffer, const int32_t frameNum );
bool isPlaying() const;
@@ -177,7 +177,7 @@ public:
SfxrInstrument(InstrumentTrack * _instrument_track );
~SfxrInstrument() override = default;
void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) override;
void playNote( NotePlayHandle * _n, SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;
void saveSettings( QDomDocument & _doc,

View File

@@ -286,7 +286,7 @@ static int sid_fillbuffer(unsigned char* sidreg, reSID::SID *sid, int tdelta, sh
void SidInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
const int clockrate = C64_PAL_CYCLES_PER_SEC;
const int samplerate = Engine::audioEngine()->outputSampleRate();

View File

@@ -102,7 +102,7 @@ public:
~SidInstrument() override = default;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

View File

@@ -75,7 +75,7 @@ SlicerT::SlicerT(InstrumentTrack* instrumentTrack)
m_sliceSnap.setValue(0);
}
void SlicerT::playNote(NotePlayHandle* handle, sampleFrame* workingBuffer)
void SlicerT::playNote(NotePlayHandle* handle, SampleFrame* workingBuffer)
{
if (m_originalSample.sampleSize() <= 1) { return; }

View File

@@ -75,7 +75,7 @@ signals:
public:
SlicerT(InstrumentTrack* instrumentTrack);
void playNote(NotePlayHandle* handle, sampleFrame* workingBuffer) override;
void playNote(NotePlayHandle* handle, SampleFrame* workingBuffer) override;
void deleteNotePluginData(NotePlayHandle* handle) override;
void saveSettings(QDomDocument& document, QDomElement& element) override;

View File

@@ -77,7 +77,7 @@ Analyzer::~Analyzer()
}
// Take audio data and pass them to the spectrum processor.
bool Analyzer::processAudioBuffer(sampleFrame *buffer, const fpp_t frame_count)
bool Analyzer::processAudioBuffer(SampleFrame* buffer, const fpp_t frame_count)
{
// Measure time spent in audio thread; both average and peak should be well under 1 ms.
#ifdef SA_DEBUG

View File

@@ -45,7 +45,7 @@ public:
Analyzer(Model *parent, const Descriptor::SubPluginFeatures::Key *key);
~Analyzer() override;
bool processAudioBuffer(sampleFrame *buffer, const fpp_t frame_count) override;
bool processAudioBuffer(SampleFrame* buffer, const fpp_t frame_count) override;
EffectControls *controls() override {return &m_controls;}
SaProcessor *getProcessor() {return &m_processor;}
@@ -63,7 +63,7 @@ private:
//m_processorThread = QThread::create([=]{m_processor.analyze(m_inputBuffer);});
DataprocLauncher m_processorThread;
LocklessRingBuffer<sampleFrame> m_inputBuffer;
LocklessRingBuffer<SampleFrame> m_inputBuffer;
#ifdef SA_DEBUG
int m_last_dump_time;

View File

@@ -37,7 +37,7 @@ namespace lmms
class DataprocLauncher : public QThread
{
public:
explicit DataprocLauncher(SaProcessor &proc, LocklessRingBuffer<sampleFrame> &buffer)
explicit DataprocLauncher(SaProcessor &proc, LocklessRingBuffer<SampleFrame> &buffer)
: m_processor(&proc),
m_inputBuffer(&buffer)
{
@@ -50,7 +50,7 @@ private:
}
SaProcessor *m_processor;
LocklessRingBuffer<sampleFrame> *m_inputBuffer;
LocklessRingBuffer<SampleFrame> *m_inputBuffer;
};

View File

@@ -98,9 +98,9 @@ SaProcessor::~SaProcessor()
// Load data from audio thread ringbuffer and run FFT analysis if buffer is full enough.
void SaProcessor::analyze(LocklessRingBuffer<sampleFrame> &ring_buffer)
void SaProcessor::analyze(LocklessRingBuffer<SampleFrame> &ring_buffer)
{
LocklessRingBufferReader<sampleFrame> reader(ring_buffer);
LocklessRingBufferReader<SampleFrame> reader(ring_buffer);
// Processing thread loop
while (!m_terminate)

View File

@@ -43,7 +43,7 @@ template<class T>
class LocklessRingBuffer;
class SaControls;
class SampleFrame;
//! Receives audio data, runs FFT analysis and stores the result.
@@ -54,7 +54,7 @@ public:
virtual ~SaProcessor();
// analysis thread and a method to terminate it
void analyze(LocklessRingBuffer<sampleFrame> &ring_buffer);
void analyze(LocklessRingBuffer<SampleFrame> &ring_buffer);
void terminate() {m_terminate = true;}
// inform processor if any processing is actually required

View File

@@ -58,7 +58,7 @@ StereoEnhancerEffect::StereoEnhancerEffect(
const Descriptor::SubPluginFeatures::Key * _key ) :
Effect( &stereoenhancer_plugin_descriptor, _parent, _key ),
m_seFX( DspEffectLibrary::StereoEnhancer( 0.0f ) ),
m_delayBuffer( new sampleFrame[DEFAULT_BUFFER_SIZE] ),
m_delayBuffer( new SampleFrame[DEFAULT_BUFFER_SIZE] ),
m_currFrame( 0 ),
m_bbControls( this )
{
@@ -82,7 +82,7 @@ StereoEnhancerEffect::~StereoEnhancerEffect()
bool StereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf,
bool StereoEnhancerEffect::processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames )
{

View File

@@ -40,7 +40,7 @@ public:
StereoEnhancerEffect( Model * parent,
const Descriptor::SubPluginFeatures::Key * _key );
~StereoEnhancerEffect() override;
bool processAudioBuffer( sampleFrame * _buf,
bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) override;
EffectControls * controls() override
@@ -54,7 +54,7 @@ public:
private:
DspEffectLibrary::StereoEnhancer m_seFX;
sampleFrame * m_delayBuffer;
SampleFrame* m_delayBuffer;
int m_currFrame;
StereoEnhancerControls m_bbControls;

View File

@@ -64,7 +64,7 @@ StereoMatrixEffect::StereoMatrixEffect(
bool StereoMatrixEffect::processAudioBuffer( sampleFrame * _buf,
bool StereoMatrixEffect::processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames )
{

View File

@@ -39,7 +39,7 @@ public:
StereoMatrixEffect( Model * parent,
const Descriptor::SubPluginFeatures::Key * _key );
~StereoMatrixEffect() override = default;
bool processAudioBuffer( sampleFrame * _buf,
bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) override;
EffectControls* controls() override

View File

@@ -278,7 +278,7 @@ QString MalletsInstrument::nodeName() const
void MalletsInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
if( m_filesMissing )
{

View File

@@ -189,7 +189,7 @@ public:
~MalletsInstrument() override = default;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

View File

@@ -307,7 +307,7 @@ QString TripleOscillator::nodeName() const
void TripleOscillator::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
SampleFrame* _working_buffer )
{
if (!_n->m_pluginData)
{

View File

@@ -112,7 +112,7 @@ public:
~TripleOscillator() override = default;
void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer ) override;
SampleFrame* _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

View File

@@ -37,7 +37,7 @@ namespace lmms::gui
{
VectorView::VectorView(VecControls *controls, LocklessRingBuffer<sampleFrame> *inputBuffer, unsigned short displaySize, QWidget *parent) :
VectorView::VectorView(VecControls *controls, LocklessRingBuffer<SampleFrame> *inputBuffer, unsigned short displaySize, QWidget *parent) :
QWidget(parent),
m_controls(controls),
m_inputBuffer(inputBuffer),

View File

@@ -30,6 +30,7 @@
namespace lmms
{
class VecControls;
class SampleFrame;
}
//#define VEC_DEBUG
@@ -43,7 +44,7 @@ class VectorView : public QWidget
{
Q_OBJECT
public:
explicit VectorView(VecControls *controls, LocklessRingBuffer<sampleFrame> *inputBuffer, unsigned short displaySize, QWidget *parent = 0);
explicit VectorView(VecControls *controls, LocklessRingBuffer<SampleFrame> *inputBuffer, unsigned short displaySize, QWidget *parent = 0);
~VectorView() override = default;
QSize sizeHint() const override {return QSize(300, 300);}
@@ -59,8 +60,8 @@ private slots:
private:
VecControls *m_controls;
LocklessRingBuffer<sampleFrame> *m_inputBuffer;
LocklessRingBufferReader<sampleFrame> m_bufferReader;
LocklessRingBuffer<SampleFrame> *m_inputBuffer;
LocklessRingBufferReader<SampleFrame> m_bufferReader;
std::vector<uchar> m_displayBuffer;
const unsigned short m_displaySize;

View File

@@ -58,7 +58,7 @@ Vectorscope::Vectorscope(Model *parent, const Plugin::Descriptor::SubPluginFeatu
// Take audio data and store them for processing and display in the GUI thread.
bool Vectorscope::processAudioBuffer(sampleFrame *buffer, const fpp_t frame_count)
bool Vectorscope::processAudioBuffer(SampleFrame* buffer, const fpp_t frame_count)
{
if (!isEnabled() || !isRunning ()) {return false;}

View File

@@ -39,16 +39,16 @@ public:
Vectorscope(Model *parent, const Descriptor::SubPluginFeatures::Key *key);
~Vectorscope() override = default;
bool processAudioBuffer(sampleFrame *buffer, const fpp_t frame_count) override;
bool processAudioBuffer(SampleFrame* buffer, const fpp_t frame_count) override;
EffectControls *controls() override {return &m_controls;}
LocklessRingBuffer<sampleFrame> *getBuffer() {return &m_inputBuffer;}
LocklessRingBuffer<SampleFrame> *getBuffer() {return &m_inputBuffer;}
private:
VecControls m_controls;
// Maximum LMMS buffer size (hard coded, the actual constant is hard to get)
const unsigned int m_maxBufferSize = 4096;
LocklessRingBuffer<sampleFrame> m_inputBuffer;
LocklessRingBuffer<SampleFrame> m_inputBuffer;
};

View File

@@ -395,7 +395,7 @@ void VestigeInstrument::loadFile( const QString & _file )
void VestigeInstrument::play( sampleFrame * _buf )
void VestigeInstrument::play( SampleFrame* _buf )
{
if (!m_pluginMutex.tryLock(Engine::getSong()->isExporting() ? -1 : 0)) {return;}

View File

@@ -61,7 +61,7 @@ public:
VestigeInstrument( InstrumentTrack * _instrument_track );
virtual ~VestigeInstrument();
virtual void play( sampleFrame * _working_buffer );
virtual void play( SampleFrame* _working_buffer );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );

View File

@@ -201,7 +201,7 @@ QString Vibed::nodeName() const
return vibedstrings_plugin_descriptor.name;
}
void Vibed::playNote(NotePlayHandle* n, sampleFrame* workingBuffer)
void Vibed::playNote(NotePlayHandle* n, SampleFrame* workingBuffer)
{
if (!n->m_pluginData)
{

View File

@@ -57,7 +57,7 @@ public:
Vibed(InstrumentTrack* instrumentTrack);
~Vibed() override = default;
void playNote(NotePlayHandle* n, sampleFrame* workingBuffer) override;
void playNote(NotePlayHandle* n, SampleFrame* workingBuffer) override;
void deleteNotePluginData(NotePlayHandle* n) override;
void saveSettings(QDomDocument& doc, QDomElement& elem) override;

View File

@@ -191,7 +191,7 @@ public:
void hideEditor();
void destroyEditor();
virtual void process( const sampleFrame * _in, sampleFrame * _out );
virtual void process( const SampleFrame* _in, SampleFrame* _out );
virtual void processMidiEvent( const MidiEvent& event, const f_cnt_t offset );
@@ -1027,7 +1027,7 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file )
void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
void RemoteVstPlugin::process( const SampleFrame* _in, SampleFrame* _out )
{
// first we gonna post all MIDI-events we enqueued so far
if( m_midiEvents.size() )

View File

@@ -76,7 +76,7 @@ VstEffect::VstEffect( Model * _parent,
bool VstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
bool VstEffect::processAudioBuffer( SampleFrame* _buf, const fpp_t _frames )
{
if( !isEnabled() || !isRunning () )
{
@@ -87,11 +87,11 @@ bool VstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
{
const float d = dryLevel();
#ifdef __GNUC__
sampleFrame buf[_frames];
SampleFrame buf[_frames];
#else
sampleFrame * buf = new sampleFrame[_frames];
SampleFrame* buf = new SampleFrame[_frames];
#endif
memcpy( buf, _buf, sizeof( sampleFrame ) * _frames );
memcpy( buf, _buf, sizeof( SampleFrame ) * _frames );
if (m_pluginMutex.tryLock(Engine::getSong()->isExporting() ? -1 : 0))
{
m_plugin->process( buf, buf );

View File

@@ -45,7 +45,7 @@ public:
const Descriptor::SubPluginFeatures::Key * _key );
~VstEffect() override = default;
bool processAudioBuffer( sampleFrame * _buf,
bool processAudioBuffer( SampleFrame* _buf,
const fpp_t _frames ) override;
EffectControls * controls() override

Some files were not shown because too many files have changed in this diff Show More