Audacity
3.2.0
libraries
lib-math
SampleCount.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
@file SampleCount.cpp
6
7
Paul Licameli split from audacity/Types.h
8
9
**********************************************************************/
10
#include "
SampleCount.h
"
11
12
#include <algorithm>
13
14
#include <wx/debug.h>
15
16
size_t
sampleCount::as_size_t
()
const
{
17
assert(
value
>= 0);
18
assert(
static_cast<
std::make_unsigned_t<type>
>
(
value
) <= std::numeric_limits<size_t>::max());
19
return
value
;
20
}
21
22
size_t
limitSampleBufferSize
(
size_t
bufferSize,
sampleCount
limit )
23
{
24
return
25
std::min
(
sampleCount
( bufferSize ), std::max(
sampleCount
(0), limit ) )
26
.as_size_t();
27
}
min
int min(int a, int b)
Definition:
CompareAudioCommand.cpp:114
limitSampleBufferSize
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition:
SampleCount.cpp:22
SampleCount.h
sampleCount
Positions or offsets within audio files need a wide type.
Definition:
SampleCount.h:19
sampleCount::value
type value
Definition:
SampleCount.h:72
sampleCount::as_size_t
size_t as_size_t() const
Definition:
SampleCount.cpp:16
Generated by
1.9.3