mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-19 17:40:15 +02:00
... note the swap of target_link_libraries lines in src/CMakeLists.txt, needed to build at least on macOS, becuase FFT.h must be looked up first in lib-math, not in lib-src/twolame Also making a dependency cycle of SampleFormat and Dither! But we will tolerate that within one small library.
27 lines
694 B
C++
27 lines
694 B
C++
/**********************************************************************
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
@file SampleCount.cpp
|
|
|
|
Paul Licameli split from audacity/Types.h
|
|
|
|
**********************************************************************/
|
|
#include "SampleCount.h"
|
|
|
|
#include <algorithm>
|
|
#include <wx/debug.h>
|
|
|
|
size_t sampleCount::as_size_t() const {
|
|
wxASSERT(value >= 0);
|
|
wxASSERT(static_cast<std::make_unsigned<type>::type>(value) <= std::numeric_limits<size_t>::max());
|
|
return value;
|
|
}
|
|
|
|
size_t limitSampleBufferSize( size_t bufferSize, sampleCount limit )
|
|
{
|
|
return
|
|
std::min( sampleCount( bufferSize ), std::max( sampleCount(0), limit ) )
|
|
.as_size_t();
|
|
}
|