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

@@ -30,6 +30,7 @@
#include "SampleLoader.h"
#include "Song.h"
#include "lmms_basics.h"
#include "plugin_export.h"
#include <QDomElement>
@@ -276,7 +277,7 @@ QString AudioFileProcessor::nodeName() const
auto AudioFileProcessor::beatLen(NotePlayHandle* note) const -> int
auto AudioFileProcessor::beatLen(NotePlayHandle* note) const -> f_cnt_t
{
// If we can play indefinitely, use the default beat note duration
if (static_cast<Sample::Loop>(m_loopModel.value()) != Sample::Loop::Off) { return 0; }
@@ -292,7 +293,7 @@ auto AudioFileProcessor::beatLen(NotePlayHandle* note) const -> int
: m_nextPlayStartPoint;
const auto duration = m_sample.endFrame() - startFrame;
return static_cast<int>(std::floor(duration * freqFactor));
return static_cast<f_cnt_t>(std::floor(duration * freqFactor));
}