Define fpp_t and f_cnt_t to be of size_t (#7363)

Defines `fpp_t` and `f_cnt_t` to be of `size_t` within `lmms_basics.h`.  Most of the codebase used `fpp_t` to represent the size of an array of sample frames, which is incorrect, given that `fpp_t` was only 16 bits when sizes greater than 32767 are very possible. `f_cnt_t` was defined as `size_t` as well for consistency.

---------

Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
This commit is contained in:
saker
2024-07-09 06:27:33 -04:00
committed by GitHub
parent f2c815b214
commit 1420a1f7e8
21 changed files with 84 additions and 74 deletions

View File

@@ -283,7 +283,7 @@ void AudioEngine::pushInputFrames( SampleFrame* _ab, const f_cnt_t _frames )
requestChangeInModel();
f_cnt_t frames = m_inputBufferFrames[ m_inputBufferWrite ];
int size = m_inputBufferSize[ m_inputBufferWrite ];
auto size = m_inputBufferSize[m_inputBufferWrite];
SampleFrame* buf = m_inputBuffer[ m_inputBufferWrite ];
if( frames + _frames > size )

View File

@@ -28,6 +28,7 @@
#include "DummyInstrument.h"
#include "InstrumentTrack.h"
#include "lmms_basics.h"
#include "lmms_constants.h"
@@ -185,7 +186,7 @@ void Instrument::applyRelease( SampleFrame* buf, const NotePlayHandle * _n )
const auto releaseFrames = desiredReleaseFrames();
const auto endFrame = _n->framesLeft();
const auto startFrame = std::max(0, endFrame - releaseFrames);
const auto startFrame = endFrame - std::min(endFrame, releaseFrames);
for (auto f = startFrame; f < endFrame && f < fpp; f++)
{

View File

@@ -23,6 +23,7 @@
*/
#include "AudioSdl.h"
#include "lmms_basics.h"
#ifdef LMMS_HAVE_SDL
@@ -69,7 +70,7 @@ AudioSdl::AudioSdl( bool & _success_ful, AudioEngine* _audioEngine ) :
// to convert the buffers
#endif
m_audioHandle.channels = channels();
m_audioHandle.samples = std::max(1024, audioEngine()->framesPerPeriod() * 2);
m_audioHandle.samples = std::max(f_cnt_t{1024}, audioEngine()->framesPerPeriod() * 2);
m_audioHandle.callback = sdlAudioCallback;
m_audioHandle.userdata = this;

View File

@@ -24,8 +24,10 @@
*/
#include "MidiClient.h"
#include "MidiPort.h"
#include <array>
#include "MidiPort.h"
namespace lmms
{
@@ -309,4 +311,4 @@ int MidiClientRaw::eventLength( const unsigned char event )
return 1;
}
} // namespace lmms
} // namespace lmms

View File

@@ -22,11 +22,12 @@
*
*/
#include "LedCheckBox.h"
#include <QFontMetrics>
#include <QPainter>
#include <array>
#include "LedCheckBox.h"
#include "DeprecationHelper.h"
#include "embed.h"
#include "gui_templates.h"