Skip to content

Commit

Permalink
Replace use of f_cnt_t with size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
sakertooth committed Jul 2, 2024
1 parent 3ab5355 commit 83c6714
Show file tree
Hide file tree
Showing 104 changed files with 428 additions and 429 deletions.
8 changes: 4 additions & 4 deletions include/AudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ class LMMS_EXPORT AudioEngine : public QObject
return m_fifoWriter != nullptr;
}

void pushInputFrames( SampleFrame* _ab, const f_cnt_t _frames );
void pushInputFrames( SampleFrame* _ab, const size_t _frames );

inline const SampleFrame* inputBuffer()
{
return m_inputBuffer[ m_inputBufferRead ];
}

inline f_cnt_t inputBufferFrames() const
inline size_t inputBufferFrames() const
{
return m_inputBufferFrames[ m_inputBufferRead ];
}
Expand Down Expand Up @@ -363,8 +363,8 @@ class LMMS_EXPORT AudioEngine : public QObject
size_t m_framesPerPeriod;

SampleFrame* m_inputBuffer[2];
f_cnt_t m_inputBufferFrames[2];
f_cnt_t m_inputBufferSize[2];
size_t m_inputBufferFrames[2];
size_t m_inputBufferSize[2];
int m_inputBufferRead;
int m_inputBufferWrite;

Expand Down
4 changes: 2 additions & 2 deletions include/AudioJack.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ private slots:
jack_default_audio_sample_t** m_tempOutBufs;
SampleFrame* m_outBuf;

f_cnt_t m_framesDoneInCurBuf;
f_cnt_t m_framesToDoInCurBuf;
size_t m_framesDoneInCurBuf;
size_t m_framesToDoInCurBuf;

#ifdef AUDIO_PORT_SUPPORT
struct StereoPort
Expand Down
2 changes: 1 addition & 1 deletion include/AudioSampleRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AudioSampleRecorder : public AudioDevice
AudioSampleRecorder( const ch_cnt_t _channels, bool & _success_ful, AudioEngine* audioEngine );
~AudioSampleRecorder() override;

f_cnt_t framesRecorded() const;
size_t framesRecorded() const;
std::shared_ptr<const SampleBuffer> createSampleBuffer();

private:
Expand Down
2 changes: 1 addition & 1 deletion include/AutomationTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AutomationTrack : public Track
~AutomationTrack() override = default;

bool play( const TimePos & _start, const size_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
const size_t _frame_base, int _clip_num = -1 ) override;

QString nodeName() const override
{
Expand Down
4 changes: 2 additions & 2 deletions include/BufferManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class LMMS_EXPORT BufferManager
static void init( size_t fpp );
static SampleFrame* acquire();
// audio-buffer-mgm
static void clear( SampleFrame* ab, const f_cnt_t frames,
const f_cnt_t offset = 0 );
static void clear( SampleFrame* ab, const size_t frames,
const size_t offset = 0 );

static void release( SampleFrame* buf );

Expand Down
10 changes: 5 additions & 5 deletions include/DspEffectLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ namespace lmms::DspEffectLibrary
public:
using bypassType = class MonoBypass;

static void process( sample_t * * _buf, const f_cnt_t _frames )
static void process( sample_t * * _buf, const size_t _frames )
{
for( f_cnt_t f = 0; f < _frames; ++f )
for( size_t f = 0; f < _frames; ++f )
{
_buf[f][0] = T::nextSample( _buf[f][0] );
}
Expand All @@ -54,9 +54,9 @@ namespace lmms::DspEffectLibrary
public:
using bypassType = class StereoBypass;

static void process( sample_t * * _buf, const f_cnt_t _frames )
static void process( sample_t * * _buf, const size_t _frames )
{
for( f_cnt_t f = 0; f < _frames; ++f )
for( size_t f = 0; f < _frames; ++f )
{
T::nextSample( _buf[f][0], _buf[f][1] );
}
Expand Down Expand Up @@ -181,7 +181,7 @@ namespace lmms::DspEffectLibrary
{
}

void process( sample_t** buf, const f_cnt_t frames )
void process( sample_t** buf, const size_t frames )
{
m_FX0.process( buf, frames );
m_FX1.process( buf, frames );
Expand Down
8 changes: 4 additions & 4 deletions include/Effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class LMMS_EXPORT Effect : public Plugin
return m_enabledModel.value();
}

inline f_cnt_t timeout() const
inline size_t timeout() const
{
const float samples = Engine::audioEngine()->outputSampleRate() * m_autoQuitModel.value() / 1000.0f;
return 1 + ( static_cast<int>( samples ) / Engine::audioEngine()->framesPerPeriod() );
Expand All @@ -131,7 +131,7 @@ class LMMS_EXPORT Effect : public Plugin
return level*level * m_processors;
}

inline f_cnt_t bufferCount() const
inline size_t bufferCount() const
{
return m_bufferCount;
}
Expand Down Expand Up @@ -216,14 +216,14 @@ class LMMS_EXPORT Effect : public Plugin
void resample( int _i, const SampleFrame* _src_buf,
sample_rate_t _src_sr,
SampleFrame* _dst_buf, sample_rate_t _dst_sr,
const f_cnt_t _frames );
const size_t _frames );

ch_cnt_t m_processors;

bool m_okay;
bool m_noRun;
bool m_running;
f_cnt_t m_bufferCount;
size_t m_bufferCount;

BoolModel m_enabledModel;
FloatModel m_wetDryModel;
Expand Down
32 changes: 16 additions & 16 deletions include/EnvelopeAndLfoParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ class LMMS_EXPORT EnvelopeAndLfoParameters : public Model, public JournallingObj
return s_lfoInstances;
}

void fillLevel( float * _buf, f_cnt_t _frame,
const f_cnt_t _release_begin,
void fillLevel( float * _buf, size_t _frame,
const size_t _release_begin,
const size_t _frames );

inline bool isUsed() const
Expand All @@ -115,12 +115,12 @@ class LMMS_EXPORT EnvelopeAndLfoParameters : public Model, public JournallingObj
return "el";
}

inline f_cnt_t PAHD_Frames() const
inline size_t PAHD_Frames() const
{
return m_pahdFrames;
}

inline f_cnt_t releaseFrames() const
inline size_t releaseFrames() const
{
return m_rFrames;
}
Expand All @@ -137,9 +137,9 @@ class LMMS_EXPORT EnvelopeAndLfoParameters : public Model, public JournallingObj


// LFO
inline f_cnt_t getLfoPredelayFrames() const { return m_lfoPredelayFrames; }
inline f_cnt_t getLfoAttackFrames() const { return m_lfoAttackFrames; }
inline f_cnt_t getLfoOscillationFrames() const { return m_lfoOscillationFrames; }
inline size_t getLfoPredelayFrames() const { return m_lfoPredelayFrames; }
inline size_t getLfoAttackFrames() const { return m_lfoAttackFrames; }
inline size_t getLfoOscillationFrames() const { return m_lfoOscillationFrames; }

const FloatModel& getLfoAmountModel() const { return m_lfoAmountModel; }
FloatModel& getLfoAmountModel() { return m_lfoAmountModel; }
Expand All @@ -153,7 +153,7 @@ public slots:


protected:
void fillLfoLevel( float * _buf, f_cnt_t _frame, const size_t _frames );
void fillLfoLevel( float * _buf, size_t _frame, const size_t _frames );


private:
Expand All @@ -174,12 +174,12 @@ public slots:
float m_amount;
float m_valueForZeroAmount;
float m_amountAdd;
f_cnt_t m_pahdFrames;
f_cnt_t m_rFrames;
size_t m_pahdFrames;
size_t m_rFrames;
sample_t * m_pahdEnv;
sample_t * m_rEnv;
f_cnt_t m_pahdBufSize;
f_cnt_t m_rBufSize;
size_t m_pahdBufSize;
size_t m_rBufSize;


FloatModel m_lfoPredelayModel;
Expand All @@ -192,10 +192,10 @@ public slots:
BoolModel m_controlEnvAmountModel;


f_cnt_t m_lfoPredelayFrames;
f_cnt_t m_lfoAttackFrames;
f_cnt_t m_lfoOscillationFrames;
f_cnt_t m_lfoFrame;
size_t m_lfoPredelayFrames;
size_t m_lfoAttackFrames;
size_t m_lfoOscillationFrames;
size_t m_lfoFrame;
float m_lfoAmount;
bool m_lfoAmountIsZero;
sample_t * m_lfoShapeData;
Expand Down
10 changes: 5 additions & 5 deletions include/Instrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class LMMS_EXPORT Instrument : public Plugin
// (note with unspecified length)
// Per default this function returns 0. In this case, channel is using
// the length of the longest envelope (if one active).
virtual f_cnt_t beatLen( NotePlayHandle * _n ) const;
virtual size_t beatLen( NotePlayHandle * _n ) const;


// This method can be overridden by instruments that need a certain
Expand All @@ -107,11 +107,11 @@ class LMMS_EXPORT Instrument : public Plugin

// Converts the desired release time in milliseconds to the corresponding
// number of frames depending on the sample rate.
f_cnt_t desiredReleaseFrames() const
size_t desiredReleaseFrames() const
{
const sample_rate_t sampleRate = getSampleRate();

return static_cast<f_cnt_t>(std::ceil(desiredReleaseTimeMs() * sampleRate / 1000.f));
return static_cast<size_t>(std::ceil(desiredReleaseTimeMs() * sampleRate / 1000.f));
}

sample_rate_t getSampleRate() const;
Expand All @@ -133,7 +133,7 @@ class LMMS_EXPORT Instrument : public Plugin

// sub-classes can re-implement this for receiving all incoming
// MIDI-events
inline virtual bool handleMidiEvent( const MidiEvent&, const TimePos& = TimePos(), f_cnt_t offset = 0 )
inline virtual bool handleMidiEvent( const MidiEvent&, const TimePos& = TimePos(), size_t offset = 0 )
{
return true;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ class LMMS_EXPORT Instrument : public Plugin
// desiredReleaseFrames() frames are left
void applyRelease( SampleFrame* buf, const NotePlayHandle * _n );

float computeReleaseTimeMsByFrameCount(f_cnt_t frames) const;
float computeReleaseTimeMsByFrameCount(size_t frames) const;


private:
Expand Down
6 changes: 3 additions & 3 deletions include/InstrumentSoundShaping.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ class InstrumentSoundShaping : public Model, public JournallingObject
} ;
constexpr static auto NumTargets = static_cast<std::size_t>(Target::Count);

f_cnt_t envFrames( const bool _only_vol = false ) const;
f_cnt_t releaseFrames() const;
size_t envFrames( const bool _only_vol = false ) const;
size_t releaseFrames() const;

float volumeLevel( NotePlayHandle * _n, const f_cnt_t _frame );
float volumeLevel( NotePlayHandle * _n, const size_t _frame );


void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
Expand Down
8 changes: 4 additions & 4 deletions include/InstrumentTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor

MidiEvent applyMasterKey( const MidiEvent& event );

void processInEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 ) override;
void processOutEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 ) override;
void processInEvent( const MidiEvent& event, const TimePos& time = TimePos(), size_t offset = 0 ) override;
void processOutEvent( const MidiEvent& event, const TimePos& time = TimePos(), size_t offset = 0 ) override;
// silence all running notes played by this track
void silenceAllNotes( bool removeIPH = false );

Expand All @@ -81,7 +81,7 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor
return m_sustainPedalPressed;
}

f_cnt_t beatLen( NotePlayHandle * _n ) const;
size_t beatLen( NotePlayHandle * _n ) const;


// for capturing note-play-events -> need that for arpeggio,
Expand Down Expand Up @@ -122,7 +122,7 @@ class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor

// play everything in given frame-range - creates note-play-handles
bool play( const TimePos & _start, const size_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
const size_t _frame_base, int _clip_num = -1 ) override;
// create new view for me
gui::TrackView* createView( gui::TrackContainerView* tcv ) override;

Expand Down
2 changes: 1 addition & 1 deletion include/Lv2ControlBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class LMMS_EXPORT Lv2ControlBase : public LinkedModelGroups
QString nodeName() const { return "lv2controls"; }
bool hasNoteInput() const;
void handleMidiInputEvent(const class MidiEvent &event,
const class TimePos &time, f_cnt_t offset);
const class TimePos &time, size_t offset);

private:
//! Independent processors
Expand Down
2 changes: 1 addition & 1 deletion include/Lv2Proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class Lv2Proc : public LinkedModelGroup
void run(size_t frames);

void handleMidiInputEvent(const class MidiEvent &event,
const TimePos &time, f_cnt_t offset);
const TimePos &time, size_t offset);

/*
misc
Expand Down
4 changes: 2 additions & 2 deletions include/MidiController.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class MidiController : public Controller, public MidiEventProcessor
~MidiController() override = default;

void processInEvent( const MidiEvent & _me,
const TimePos & _time, f_cnt_t offset = 0 ) override;
const TimePos & _time, size_t offset = 0 ) override;

void processOutEvent( const MidiEvent& _me,
const TimePos & _time, f_cnt_t offset = 0 ) override
const TimePos & _time, size_t offset = 0 ) override
{
// No output yet
}
Expand Down
4 changes: 2 additions & 2 deletions include/MidiEventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class MidiEventProcessor
virtual ~MidiEventProcessor() = default;

// to be implemented by inheriting classes
virtual void processInEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 ) = 0;
virtual void processOutEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 ) = 0;
virtual void processInEvent( const MidiEvent& event, const TimePos& time = TimePos(), size_t offset = 0 ) = 0;
virtual void processOutEvent( const MidiEvent& event, const TimePos& time = TimePos(), size_t offset = 0 ) = 0;

} ;

Expand Down
Loading

0 comments on commit 83c6714

Please sign in to comment.