summaryrefslogtreecommitdiff
path: root/libs/audiographer
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-03 22:26:29 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-03 22:26:29 +0000
commit73192bc1a7ea55fa1864dc3826845b15c00dd2ec (patch)
treec0039f3f5a848aed6e880abf11519dad855fa899 /libs/audiographer
parent74b4a3c77b08dc1e58274875604eb73e8492fa93 (diff)
Remove all use of nframes_t.
git-svn-id: svn://localhost/ardour2/branches/3.0@8166 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/audiographer')
-rw-r--r--libs/audiographer/audiographer/general/chunker.h12
-rw-r--r--libs/audiographer/audiographer/general/deinterleaver.h8
-rw-r--r--libs/audiographer/audiographer/general/interleaver.h16
-rw-r--r--libs/audiographer/audiographer/general/normalizer.h4
-rw-r--r--libs/audiographer/audiographer/general/sample_format_converter.h8
-rw-r--r--libs/audiographer/audiographer/general/silence_trimmer.h38
-rw-r--r--libs/audiographer/audiographer/general/sr_converter.h12
-rw-r--r--libs/audiographer/audiographer/process_context.h28
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile.h4
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_reader.h6
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_writer.h4
-rw-r--r--libs/audiographer/audiographer/sndfile/tmp_file.h4
-rw-r--r--libs/audiographer/audiographer/type_utils.h10
-rw-r--r--libs/audiographer/audiographer/types.h6
-rw-r--r--libs/audiographer/src/general/sample_format_converter.cc16
-rw-r--r--libs/audiographer/src/general/sr_converter.cc10
-rw-r--r--libs/audiographer/tests/general/chunker_test.cc22
-rw-r--r--libs/audiographer/tests/general/deinterleaver_test.cc10
-rw-r--r--libs/audiographer/tests/general/interleaver_deinterleaver_test.cc8
-rw-r--r--libs/audiographer/tests/general/interleaver_test.cc14
-rw-r--r--libs/audiographer/tests/general/normalizer_test.cc2
-rw-r--r--libs/audiographer/tests/general/peak_reader_test.cc2
-rw-r--r--libs/audiographer/tests/general/sample_format_converter_test.cc20
-rw-r--r--libs/audiographer/tests/general/silence_trimmer_test.cc28
-rw-r--r--libs/audiographer/tests/general/sr_converter_test.cc20
-rw-r--r--libs/audiographer/tests/general/threader_test.cc2
-rw-r--r--libs/audiographer/tests/sndfile/tmp_file_test.cc2
-rw-r--r--libs/audiographer/tests/utils.h16
-rw-r--r--libs/audiographer/tests/utils/identity_vertex_test.cc4
29 files changed, 169 insertions, 167 deletions
diff --git a/libs/audiographer/audiographer/general/chunker.h b/libs/audiographer/audiographer/general/chunker.h
index 38345acb1f..397d67ffc5 100644
--- a/libs/audiographer/audiographer/general/chunker.h
+++ b/libs/audiographer/audiographer/general/chunker.h
@@ -20,7 +20,7 @@ class Chunker
/** Constructs a new Chunker with a constant chunk size.
* \n NOT RT safe
*/
- Chunker (nframes_t chunk_size)
+ Chunker (framecnt_t chunk_size)
: chunk_size (chunk_size)
, position (0)
{
@@ -41,12 +41,12 @@ class Chunker
{
check_flags (*this, context);
- nframes_t frames_left = context.frames();
- nframes_t input_position = 0;
+ framecnt_t frames_left = context.frames();
+ framecnt_t input_position = 0;
while (position + frames_left >= chunk_size) {
// Copy from context to buffer
- nframes_t const frames_to_copy = chunk_size - position;
+ framecnt_t const frames_to_copy = chunk_size - position;
TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], frames_to_copy);
// Output whole buffer
@@ -73,8 +73,8 @@ class Chunker
using Sink<T>::process;
private:
- nframes_t chunk_size;
- nframes_t position;
+ framecnt_t chunk_size;
+ framecnt_t position;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/deinterleaver.h b/libs/audiographer/audiographer/general/deinterleaver.h
index 2a6ad64ef2..96d77b1f7b 100644
--- a/libs/audiographer/audiographer/general/deinterleaver.h
+++ b/libs/audiographer/audiographer/general/deinterleaver.h
@@ -34,7 +34,7 @@ class DeInterleaver
typedef boost::shared_ptr<Source<T> > SourcePtr;
/// Inits the deinterleaver. Must be called before using. \n Not RT safe
- void init (unsigned int num_channels, nframes_t max_frames_per_channel)
+ void init (unsigned int num_channels, framecnt_t max_frames_per_channel)
{
reset();
channels = num_channels;
@@ -59,10 +59,10 @@ class DeInterleaver
/// Deinterleaves data and outputs it to the outputs. \n RT safe
void process (ProcessContext<T> const & c)
{
- nframes_t frames = c.frames();
+ framecnt_t frames = c.frames();
T const * data = c.data();
- nframes_t const frames_per_channel = frames / channels;
+ framecnt_t const frames_per_channel = frames / channels;
if (throw_level (ThrowProcess) && c.channels() != channels) {
throw Exception (*this, "wrong amount of channels given to process()");
@@ -100,7 +100,7 @@ class DeInterleaver
std::vector<OutputPtr> outputs;
unsigned int channels;
- nframes_t max_frames;
+ framecnt_t max_frames;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/interleaver.h b/libs/audiographer/audiographer/general/interleaver.h
index 98a71f3afd..924c1d04a5 100644
--- a/libs/audiographer/audiographer/general/interleaver.h
+++ b/libs/audiographer/audiographer/general/interleaver.h
@@ -31,7 +31,7 @@ class Interleaver
~Interleaver() { reset(); }
/// Inits the interleaver. Must be called before using. \n Not RT safe
- void init (unsigned int num_channels, nframes_t max_frames_per_channel)
+ void init (unsigned int num_channels, framecnt_t max_frames_per_channel)
{
reset();
channels = num_channels;
@@ -78,11 +78,11 @@ class Interleaver
using Sink<T>::process;
- nframes_t frames() { return frames_written; }
+ framecnt_t frames() { return frames_written; }
void reset() { frames_written = 0; }
private:
- nframes_t frames_written;
+ framecnt_t frames_written;
Interleaver & parent;
unsigned int channel;
};
@@ -115,7 +115,7 @@ class Interleaver
buffer[channel + (channels * i)] = c.data()[i];
}
- nframes_t const ready_frames = ready_to_output();
+ framecnt_t const ready_frames = ready_to_output();
if (ready_frames) {
ProcessContext<T> c_out (c, buffer, ready_frames, channels);
ListedSource<T>::output (c_out);
@@ -123,13 +123,13 @@ class Interleaver
}
}
- nframes_t ready_to_output()
+ framecnt_t ready_to_output()
{
- nframes_t ready_frames = inputs[0]->frames();
+ framecnt_t ready_frames = inputs[0]->frames();
if (!ready_frames) { return 0; }
for (unsigned int i = 1; i < channels; ++i) {
- nframes_t const frames = inputs[i]->frames();
+ framecnt_t const frames = inputs[i]->frames();
if (!frames) { return 0; }
if (throw_level (ThrowProcess) && frames != ready_frames) {
init (channels, max_frames);
@@ -143,7 +143,7 @@ class Interleaver
std::vector<InputPtr> inputs;
unsigned int channels;
- nframes_t max_frames;
+ framecnt_t max_frames;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/normalizer.h b/libs/audiographer/audiographer/general/normalizer.h
index 205f6e70e5..48d0fe8b0b 100644
--- a/libs/audiographer/audiographer/general/normalizer.h
+++ b/libs/audiographer/audiographer/general/normalizer.h
@@ -48,7 +48,7 @@ class Normalizer
* non-const ProcessContexts are given to \a process() .
* \n Not RT safe
*/
- void alloc_buffer(nframes_t frames)
+ void alloc_buffer(framecnt_t frames)
{
delete [] buffer;
buffer = new float[frames];
@@ -86,7 +86,7 @@ class Normalizer
float gain;
float * buffer;
- nframes_t buffer_size;
+ framecnt_t buffer_size;
};
diff --git a/libs/audiographer/audiographer/general/sample_format_converter.h b/libs/audiographer/audiographer/general/sample_format_converter.h
index 8dda57c4cc..a200f37825 100644
--- a/libs/audiographer/audiographer/general/sample_format_converter.h
+++ b/libs/audiographer/audiographer/general/sample_format_converter.h
@@ -40,7 +40,7 @@ class SampleFormatConverter
* \note If the non-const version of process() is used with floats,
* there is no need to call this function.
*/
- void init (nframes_t max_frames, int type, int data_width);
+ void init (framecnt_t max_frames, int type, int data_width);
/// Set whether or not clipping to [-1.0, 1.0] should occur when TOut = float. Clipping is off by default
void set_clip_floats (bool yn) { clip_floats = yn; }
@@ -53,12 +53,12 @@ class SampleFormatConverter
private:
void reset();
- void init_common(nframes_t max_frames); // not-template-specialized part of init
- void check_frame_and_channel_count(nframes_t frames, ChannelCount channels_);
+ void init_common (framecnt_t max_frames); // not-template-specialized part of init
+ void check_frame_and_channel_count (framecnt_t frames, ChannelCount channels_);
ChannelCount channels;
GDither dither;
- nframes_t data_out_size;
+ framecnt_t data_out_size;
TOut * data_out;
bool clip_floats;
diff --git a/libs/audiographer/audiographer/general/silence_trimmer.h b/libs/audiographer/audiographer/general/silence_trimmer.h
index 5256d4a8cc..8782a25d4b 100644
--- a/libs/audiographer/audiographer/general/silence_trimmer.h
+++ b/libs/audiographer/audiographer/general/silence_trimmer.h
@@ -22,7 +22,7 @@ class SilenceTrimmer
public:
/// Constructor, \see reset() \n Not RT safe
- SilenceTrimmer(nframes_t silence_buffer_size_ = 1024)
+ SilenceTrimmer(framecnt_t silence_buffer_size_ = 1024)
: silence_buffer_size (0)
, silence_buffer (0)
{
@@ -40,7 +40,7 @@ class SilenceTrimmer
* This also defines the maximum length of output process context
* which can be output during long intermediate silence.
*/
- void reset (nframes_t silence_buffer_size_ = 1024)
+ void reset (framecnt_t silence_buffer_size_ = 1024)
{
if (throw_level (ThrowObject) && silence_buffer_size_ == 0) {
throw Exception (*this,
@@ -68,7 +68,7 @@ class SilenceTrimmer
* Needs to be called before starting processing.
* \n RT safe
*/
- void add_silence_to_beginning (nframes_t frames_per_channel)
+ void add_silence_to_beginning (framecnt_t frames_per_channel)
{
if (throw_level (ThrowObject) && !in_beginning) {
throw Exception(*this, "Tried to add silence to beginning after already outputting data");
@@ -80,7 +80,7 @@ class SilenceTrimmer
* Needs to be called before end is reached.
* \n RT safe
*/
- void add_silence_to_end (nframes_t frames_per_channel)
+ void add_silence_to_end (framecnt_t frames_per_channel)
{
if (throw_level (ThrowObject) && in_end) {
throw Exception(*this, "Tried to add silence to end after already reaching end");
@@ -131,7 +131,7 @@ class SilenceTrimmer
}
in_end = c.has_flag (ProcessContext<T>::EndOfInput);
- nframes_t frame_index = 0;
+ framecnt_t frame_index = 0;
if (in_beginning) {
@@ -223,9 +223,9 @@ class SilenceTrimmer
private:
- bool find_first_non_zero_sample (ProcessContext<T> const & c, nframes_t & result_frame)
+ bool find_first_non_zero_sample (ProcessContext<T> const & c, framecnt_t & result_frame)
{
- for (nframes_t i = 0; i < c.frames(); ++i) {
+ for (framecnt_t i = 0; i < c.frames(); ++i) {
if (c.data()[i] != static_cast<T>(0.0)) {
result_frame = i;
// Round down to nearest interleaved "frame" beginning
@@ -236,13 +236,13 @@ class SilenceTrimmer
return false;
}
- void output_silence_frames (ProcessContext<T> const & c, nframes_t & total_frames, bool adding_to_end = false)
+ void output_silence_frames (ProcessContext<T> const & c, framecnt_t & total_frames, bool adding_to_end = false)
{
bool end_of_input = c.has_flag (ProcessContext<T>::EndOfInput);
c.remove_flag (ProcessContext<T>::EndOfInput);
while (total_frames > 0) {
- nframes_t frames = std::min (silence_buffer_size, total_frames);
+ framecnt_t frames = std::min (silence_buffer_size, total_frames);
if (max_output_frames) {
frames = std::min (frames, max_output_frames);
}
@@ -262,20 +262,20 @@ class SilenceTrimmer
}
- bool in_beginning;
- bool in_end;
+ bool in_beginning;
+ bool in_end;
- bool trim_beginning;
- bool trim_end;
+ bool trim_beginning;
+ bool trim_end;
- nframes_t silence_frames;
- nframes_t max_output_frames;
+ framecnt_t silence_frames;
+ framecnt_t max_output_frames;
- nframes_t add_to_beginning;
- nframes_t add_to_end;
+ framecnt_t add_to_beginning;
+ framecnt_t add_to_end;
- nframes_t silence_buffer_size;
- T * silence_buffer;
+ framecnt_t silence_buffer_size;
+ T * silence_buffer;
};
} // namespace
diff --git a/libs/audiographer/audiographer/general/sr_converter.h b/libs/audiographer/audiographer/general/sr_converter.h
index f28c8f6953..a3298bbf97 100644
--- a/libs/audiographer/audiographer/general/sr_converter.h
+++ b/libs/audiographer/audiographer/general/sr_converter.h
@@ -25,10 +25,10 @@ class SampleRateConverter
~SampleRateConverter ();
/// Init converter \n Not RT safe
- void init (nframes_t in_rate, nframes_t out_rate, int quality = 0);
+ void init (framecnt_t in_rate, framecnt_t out_rate, int quality = 0);
/// Returns max amount of frames that will be output \n RT safe
- nframes_t allocate_buffers (nframes_t max_frames);
+ framecnt_t allocate_buffers (framecnt_t max_frames);
/** Does sample rate conversion.
* Note that outpt size may vary a lot.
@@ -46,14 +46,14 @@ class SampleRateConverter
bool active;
uint32_t channels;
- nframes_t max_frames_in;
+ framecnt_t max_frames_in;
float * leftover_data;
- nframes_t leftover_frames;
- nframes_t max_leftover_frames;
+ framecnt_t leftover_frames;
+ framecnt_t max_leftover_frames;
float * data_out;
- nframes_t data_out_size;
+ framecnt_t data_out_size;
SRC_DATA src_data;
SRC_STATE* src_state;
diff --git a/libs/audiographer/audiographer/process_context.h b/libs/audiographer/audiographer/process_context.h
index 3ad84d7708..843c09b618 100644
--- a/libs/audiographer/audiographer/process_context.h
+++ b/libs/audiographer/audiographer/process_context.h
@@ -37,7 +37,7 @@ public:
public:
/// Basic constructor with data, frame and channel count
- ProcessContext (T * data, nframes_t frames, ChannelCount channels)
+ ProcessContext (T * data, framecnt_t frames, ChannelCount channels)
: _data (data), _frames (frames), _channels (channels)
{ validate_data(); }
@@ -48,13 +48,13 @@ public:
/// "Copy constructor" with unique data, frame and channel count, but copies flags
template<typename Y>
- ProcessContext (ProcessContext<Y> const & other, T * data, nframes_t frames, ChannelCount channels)
+ ProcessContext (ProcessContext<Y> const & other, T * data, framecnt_t frames, ChannelCount channels)
: _data (data), _frames (frames), _channels (channels), _flags (other.flags())
{ validate_data(); }
/// "Copy constructor" with unique data and frame count, but copies channel count and flags
template<typename Y>
- ProcessContext (ProcessContext<Y> const & other, T * data, nframes_t frames)
+ ProcessContext (ProcessContext<Y> const & other, T * data, framecnt_t frames)
: _data (data), _frames (frames), _channels (other.channels()), _flags (other.flags())
{ validate_data(); }
@@ -65,7 +65,7 @@ public:
{ /* No need to validate data */ }
/// Make new Context out of the beginning of this context
- ProcessContext beginning (nframes_t frames)
+ ProcessContext beginning (framecnt_t frames)
{
if (throw_level (ThrowProcess) && frames > _frames) {
throw Exception (*this, boost::str (boost::format
@@ -84,7 +84,7 @@ public:
inline T * data() { return _data; }
/// \a frames tells how many frames the array pointed by data contains
- inline nframes_t const & frames() const { return _frames; }
+ inline framecnt_t const & frames() const { return _frames; }
/** \a channels tells how many interleaved channels \a data contains
* If \a channels is greater than 1, each channel contains \a frames / \a channels frames of data
@@ -92,7 +92,7 @@ public:
inline ChannelCount const & channels() const { return _channels; }
/// Returns the amount of frames per channel
- inline nframes_t frames_per_channel() const { return _frames / _channels; }
+ inline framecnt_t frames_per_channel() const { return _frames / _channels; }
/* Flags */
@@ -103,7 +103,7 @@ public:
protected:
T * const _data;
- nframes_t _frames;
+ framecnt_t _frames;
ChannelCount _channels;
mutable FlagField _flags;
@@ -124,11 +124,11 @@ template <typename T = DefaultSampleType>
struct AllocatingProcessContext : public ProcessContext<T>
{
/// Allocates uninitialized memory
- AllocatingProcessContext (nframes_t frames, ChannelCount channels)
+ AllocatingProcessContext (framecnt_t frames, ChannelCount channels)
: ProcessContext<T> (new T[frames], frames, channels) {}
/// Allocates and copies data from raw buffer
- AllocatingProcessContext (T const * data, nframes_t frames, ChannelCount channels)
+ AllocatingProcessContext (T const * data, framecnt_t frames, ChannelCount channels)
: ProcessContext<T> (new T[frames], frames, channels)
{ TypeUtils<float>::copy (data, ProcessContext<T>::_data, frames); }
@@ -139,12 +139,12 @@ struct AllocatingProcessContext : public ProcessContext<T>
/// "Copy constructor" with uninitialized data, unique frame and channel count, but copies flags
template<typename Y>
- AllocatingProcessContext (ProcessContext<Y> const & other, nframes_t frames, ChannelCount channels)
+ AllocatingProcessContext (ProcessContext<Y> const & other, framecnt_t frames, ChannelCount channels)
: ProcessContext<T> (other, new T[frames], frames, channels) {}
/// "Copy constructor" with uninitialized data, unique frame count, but copies channel count and flags
template<typename Y>
- AllocatingProcessContext (ProcessContext<Y> const & other, nframes_t frames)
+ AllocatingProcessContext (ProcessContext<Y> const & other, framecnt_t frames)
: ProcessContext<T> (other, new T[frames], frames, other.channels()) {}
/// "Copy constructor" uninitialized data, that copies frame and channel count + flags
@@ -161,7 +161,7 @@ class ConstProcessContext
{
public:
/// Basic constructor with data, frame and channel count
- ConstProcessContext (T const * data, nframes_t frames, ChannelCount channels)
+ ConstProcessContext (T const * data, framecnt_t frames, ChannelCount channels)
: context (const_cast<T *>(data), frames, channels) {}
/// Copy constructor from const ProcessContext
@@ -170,12 +170,12 @@ class ConstProcessContext
/// "Copy constructor", with unique data, frame and channel count, but copies flags
template<typename ProcessContext>
- ConstProcessContext (ProcessContext const & other, T const * data, nframes_t frames, ChannelCount channels)
+ ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames, ChannelCount channels)
: context (other, const_cast<T *>(data), frames, channels) {}
/// "Copy constructor", with unique data and frame count, but copies channel count and flags
template<typename ProcessContext>
- ConstProcessContext (ProcessContext const & other, T const * data, nframes_t frames)
+ ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames)
: context (other, const_cast<T *>(data), frames) {}
/// "Copy constructor", with unique data, but copies frame and channel count + flags
diff --git a/libs/audiographer/audiographer/sndfile/sndfile.h b/libs/audiographer/audiographer/sndfile/sndfile.h
index 4db2298a90..939e5f8a2c 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile.h
@@ -16,7 +16,7 @@ class Sndfile : public SndfileWriter<T>, public SndfileReader<T>
public:
Sndfile (std::string const & filename, SndfileBase::Mode mode = SndfileBase::ReadWrite, int format = 0,
- ChannelCount channels = 0, nframes_t samplerate = 0)
+ ChannelCount channels = 0, framecnt_t samplerate = 0)
: SndfileHandle (filename, mode, format, channels, samplerate)
{}
@@ -27,4 +27,4 @@ class Sndfile : public SndfileWriter<T>, public SndfileReader<T>
} // namespace
-#endif // AUDIOGRAPHER_SNDFILE_H \ No newline at end of file
+#endif // AUDIOGRAPHER_SNDFILE_H
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_reader.h b/libs/audiographer/audiographer/sndfile/sndfile_reader.h
index f5f7adcb3a..f7a04f22d6 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile_reader.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile_reader.h
@@ -29,7 +29,7 @@ class SndfileReader
* Note that the data read is output to the outputs, as well as read into the context
* \return number of frames read
*/
- nframes_t read (ProcessContext<T> & context)
+ framecnt_t read (ProcessContext<T> & context)
{
if (throw_level (ThrowStrict) && context.channels() != channels() ) {
throw Exception (*this, boost::str (boost::format
@@ -37,7 +37,7 @@ class SndfileReader
% context.channels() % channels()));
}
- nframes_t frames_read = SndfileHandle::read (context.data(), context.frames());
+ framecnt_t const frames_read = SndfileHandle::read (context.data(), context.frames());
ProcessContext<T> c_out = context.beginning (frames_read);
if (frames_read < context.frames()) {
@@ -54,4 +54,4 @@ class SndfileReader
} // namespace
-#endif // AUDIOGRAPHER_SNDFILE_READER_H \ No newline at end of file
+#endif // AUDIOGRAPHER_SNDFILE_READER_H
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_writer.h b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
index a6f338487a..7b3c2968ff 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile_writer.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
@@ -27,7 +27,7 @@ class SndfileWriter
, public FlagDebuggable<>
{
public:
- SndfileWriter (std::string const & path, int format, ChannelCount channels, nframes_t samplerate, boost::shared_ptr<BroadcastInfo> broadcast_info)
+ SndfileWriter (std::string const & path, int format, ChannelCount channels, framecnt_t samplerate, boost::shared_ptr<BroadcastInfo> broadcast_info)
: SndfileHandle (path, Write, format, channels, samplerate)
, path (path)
{
@@ -54,7 +54,7 @@ class SndfileWriter
% c.channels() % channels()));
}
- nframes_t written = write (c.data(), c.frames());
+ framecnt_t const written = write (c.data(), c.frames());
if (throw_level (ThrowProcess) && written != c.frames()) {
throw Exception (*this, boost::str (boost::format
("Could not write data to output file (%1%)")
diff --git a/libs/audiographer/audiographer/sndfile/tmp_file.h b/libs/audiographer/audiographer/sndfile/tmp_file.h
index e312007247..a4e7b2679a 100644
--- a/libs/audiographer/audiographer/sndfile/tmp_file.h
+++ b/libs/audiographer/audiographer/sndfile/tmp_file.h
@@ -13,7 +13,7 @@ class TmpFile : public SndfileWriter<T>, public SndfileReader<T>
{
public:
- TmpFile (int format, ChannelCount channels, nframes_t samplerate)
+ TmpFile (int format, ChannelCount channels, framecnt_t samplerate)
: SndfileHandle (fileno (tmpfile()), true, SndfileBase::ReadWrite, format, channels, samplerate)
{}
@@ -24,4 +24,4 @@ class TmpFile : public SndfileWriter<T>, public SndfileReader<T>
} // namespace
-#endif // AUDIOGRAPHER_TMP_FILE_H \ No newline at end of file
+#endif // AUDIOGRAPHER_TMP_FILE_H
diff --git a/libs/audiographer/audiographer/type_utils.h b/libs/audiographer/audiographer/type_utils.h
index d17f3634ed..360168d55d 100644
--- a/libs/audiographer/audiographer/type_utils.h
+++ b/libs/audiographer/audiographer/type_utils.h
@@ -16,11 +16,11 @@ class TypeUtilsBase
protected:
template<typename T, bool b>
- static void do_zero_fill(T * buffer, nframes_t frames, const boost::integral_constant<bool, b>&)
+ static void do_zero_fill(T * buffer, framecnt_t frames, const boost::integral_constant<bool, b>&)
{ std::uninitialized_fill_n (buffer, frames, T()); }
template<typename T>
- static void do_zero_fill(T * buffer, nframes_t frames, const boost::true_type&)
+ static void do_zero_fill(T * buffer, framecnt_t frames, const boost::true_type&)
{ memset (buffer, 0, frames * sizeof(T)); }
};
@@ -39,21 +39,21 @@ class TypeUtils : private TypeUtilsBase
* if T is not a floating point or signed integer type
* \n RT safe
*/
- inline static void zero_fill (T * buffer, nframes_t frames)
+ inline static void zero_fill (T * buffer, framecnt_t frames)
{ do_zero_fill(buffer, frames, zero_fillable()); }
/** Copies \a frames frames of data from \a source to \a destination
* The source and destination may NOT overlap.
* \n RT safe
*/
- inline static void copy (T const * source, T * destination, nframes_t frames)
+ inline static void copy (T const * source, T * destination, framecnt_t frames)
{ std::uninitialized_copy (source, &source[frames], destination); }
/** Moves \a frames frames of data from \a source to \a destination
* The source and destination may overlap in any way.
* \n RT safe
*/
- inline static void move (T const * source, T * destination, nframes_t frames)
+ inline static void move (T const * source, T * destination, framecnt_t frames)
{
if (destination < source) {
std::copy (source, &source[frames], destination);
diff --git a/libs/audiographer/audiographer/types.h b/libs/audiographer/audiographer/types.h
index 558bab302f..ae98cde7bd 100644
--- a/libs/audiographer/audiographer/types.h
+++ b/libs/audiographer/audiographer/types.h
@@ -5,11 +5,13 @@
namespace AudioGrapher {
-typedef int64_t nframes_t;
+/* XXX: copied from libardour */
+typedef int64_t framecnt_t;
+
typedef uint8_t ChannelCount;
typedef float DefaultSampleType;
} // namespace
-#endif // AUDIOGRAPHER_TYPES_H \ No newline at end of file
+#endif // AUDIOGRAPHER_TYPES_H
diff --git a/libs/audiographer/src/general/sample_format_converter.cc b/libs/audiographer/src/general/sample_format_converter.cc
index a827f67078..a1aa4d88a9 100644
--- a/libs/audiographer/src/general/sample_format_converter.cc
+++ b/libs/audiographer/src/general/sample_format_converter.cc
@@ -21,7 +21,7 @@ SampleFormatConverter<TOut>::SampleFormatConverter (ChannelCount channels) :
template <>
void
-SampleFormatConverter<float>::init (nframes_t max_frames, int /* type */, int data_width)
+SampleFormatConverter<float>::init (framecnt_t max_frames, int /* type */, int data_width)
{
if (throw_level (ThrowObject) && data_width != 32) {
throw Exception (*this, "Unsupported data width");
@@ -32,7 +32,7 @@ SampleFormatConverter<float>::init (nframes_t max_frames, int /* type */, int da
template <>
void
-SampleFormatConverter<int32_t>::init (nframes_t max_frames, int type, int data_width)
+SampleFormatConverter<int32_t>::init (framecnt_t max_frames, int type, int data_width)
{
if(throw_level (ThrowObject) && data_width < 24) {
throw Exception (*this, "Trying to use SampleFormatConverter<int32_t> for data widths < 24");
@@ -51,7 +51,7 @@ SampleFormatConverter<int32_t>::init (nframes_t max_frames, int type, int data_w
template <>
void
-SampleFormatConverter<int16_t>::init (nframes_t max_frames, int type, int data_width)
+SampleFormatConverter<int16_t>::init (framecnt_t max_frames, int type, int data_width)
{
if (throw_level (ThrowObject) && data_width != 16) {
throw Exception (*this, "Unsupported data width");
@@ -62,7 +62,7 @@ SampleFormatConverter<int16_t>::init (nframes_t max_frames, int type, int data_w
template <>
void
-SampleFormatConverter<uint8_t>::init (nframes_t max_frames, int type, int data_width)
+SampleFormatConverter<uint8_t>::init (framecnt_t max_frames, int type, int data_width)
{
if (throw_level (ThrowObject) && data_width != 8) {
throw Exception (*this, "Unsupported data width");
@@ -73,7 +73,7 @@ SampleFormatConverter<uint8_t>::init (nframes_t max_frames, int type, int data_w
template <typename TOut>
void
-SampleFormatConverter<TOut>::init_common (nframes_t max_frames )
+SampleFormatConverter<TOut>::init_common (framecnt_t max_frames)
{
reset();
if (max_frames > data_out_size) {
@@ -141,11 +141,11 @@ template<>
void
SampleFormatConverter<float>::process (ProcessContext<float> & c_in)
{
- nframes_t frames = c_in.frames();
+ framecnt_t frames = c_in.frames();
float * data = c_in.data();
if (clip_floats) {
- for (nframes_t x = 0; x < frames; ++x) {
+ for (framecnt_t x = 0; x < frames; ++x) {
if (data[x] > 1.0f) {
data[x] = 1.0f;
} else if (data[x] < -1.0f) {
@@ -172,7 +172,7 @@ SampleFormatConverter<float>::process (ProcessContext<float> const & c_in)
template<typename TOut>
void
-SampleFormatConverter<TOut>::check_frame_and_channel_count(nframes_t frames, ChannelCount channels_)
+SampleFormatConverter<TOut>::check_frame_and_channel_count (framecnt_t frames, ChannelCount channels_)
{
if (throw_level (ThrowStrict) && channels_ != channels) {
throw Exception (*this, boost::str (boost::format
diff --git a/libs/audiographer/src/general/sr_converter.cc b/libs/audiographer/src/general/sr_converter.cc
index 1fbed12128..5661f60394 100644
--- a/libs/audiographer/src/general/sr_converter.cc
+++ b/libs/audiographer/src/general/sr_converter.cc
@@ -26,7 +26,7 @@ SampleRateConverter::SampleRateConverter (uint32_t channels)
}
void
-SampleRateConverter::init (nframes_t in_rate, nframes_t out_rate, int quality)
+SampleRateConverter::init (framecnt_t in_rate, framecnt_t out_rate, int quality)
{
reset();
@@ -52,12 +52,12 @@ SampleRateConverter::~SampleRateConverter ()
reset();
}
-nframes_t
-SampleRateConverter::allocate_buffers (nframes_t max_frames)
+framecnt_t
+SampleRateConverter::allocate_buffers (framecnt_t max_frames)
{
if (!active) { return max_frames; }
- nframes_t max_frames_out = (nframes_t) ceil (max_frames * src_data.src_ratio);
+ framecnt_t max_frames_out = (framecnt_t) ceil (max_frames * src_data.src_ratio);
if (data_out_size < max_frames_out) {
delete[] data_out;
@@ -87,7 +87,7 @@ SampleRateConverter::process (ProcessContext<float> const & c)
return;
}
- nframes_t frames = c.frames();
+ framecnt_t frames = c.frames();
float * in = const_cast<float *> (c.data()); // TODO check if this is safe!
if (throw_level (ThrowProcess) && frames > max_frames_in) {
diff --git a/libs/audiographer/tests/general/chunker_test.cc b/libs/audiographer/tests/general/chunker_test.cc
index c667360601..ea5c29a410 100644
--- a/libs/audiographer/tests/general/chunker_test.cc
+++ b/libs/audiographer/tests/general/chunker_test.cc
@@ -33,13 +33,13 @@ class ChunkerTest : public CppUnit::TestFixture
void testSynchronousProcess()
{
chunker->add_output (sink);
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
ProcessContext<float> const context (random_data, frames, 1);
chunker->process (context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) 0, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
chunker->process (context);
frames_output = sink->get_data().size();
@@ -51,7 +51,7 @@ class ChunkerTest : public CppUnit::TestFixture
chunker->process (context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) 0, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
chunker->process (context);
frames_output = sink->get_data().size();
@@ -65,7 +65,7 @@ class ChunkerTest : public CppUnit::TestFixture
assert (frames % 2 == 0);
chunker->add_output (sink);
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
ProcessContext<float> const half_context (random_data, frames / 2, 1);
ProcessContext<float> const context (random_data, frames, 1);
@@ -73,12 +73,12 @@ class ChunkerTest : public CppUnit::TestFixture
// 0.5
chunker->process (half_context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) 0, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
// 1.5
chunker->process (context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) 0, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
// 2.5
chunker->process (context);
@@ -93,7 +93,7 @@ class ChunkerTest : public CppUnit::TestFixture
// 3.5
chunker->process (context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) 0, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_output);
// 4.0
chunker->process (half_context);
@@ -112,7 +112,7 @@ class ChunkerTest : public CppUnit::TestFixture
chunker.reset (new Chunker<float>(frames / 4));
chunker->add_output (sink);
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
ProcessContext<float> const half_context (random_data, frames / 2, 1);
ProcessContext<float> const context (random_data, frames, 1);
@@ -120,12 +120,12 @@ class ChunkerTest : public CppUnit::TestFixture
// 0.5
chunker->process (half_context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) frames / 2, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) frames / 2, frames_output);
// 1.5
chunker->process (context);
frames_output = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) frames / 2 * 3, frames_output);
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) frames / 2 * 3, frames_output);
// 2.5
chunker->process (context);
@@ -141,7 +141,7 @@ class ChunkerTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink;
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (ChunkerTest);
diff --git a/libs/audiographer/tests/general/deinterleaver_test.cc b/libs/audiographer/tests/general/deinterleaver_test.cc
index 3d644a3cf1..3260045b11 100644
--- a/libs/audiographer/tests/general/deinterleaver_test.cc
+++ b/libs/audiographer/tests/general/deinterleaver_test.cc
@@ -61,9 +61,9 @@ class DeInterleaverTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_THROW (deinterleaver->process (c.beginning (total_frames - 1)), Exception);
}
- void assert_outputs (nframes_t expected_frames)
+ void assert_outputs (framecnt_t expected_frames)
{
- nframes_t generated_frames = 0;
+ framecnt_t generated_frames = 0;
generated_frames = sink_a->get_data().size();
CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
@@ -89,7 +89,7 @@ class DeInterleaverTest : public CppUnit::TestFixture
assert_outputs (frames_per_channel);
// Now with less frames
- nframes_t const less_frames = frames_per_channel / 4;
+ framecnt_t const less_frames = frames_per_channel / 4;
deinterleaver->process (c.beginning (less_frames * channels));
assert_outputs (less_frames);
}
@@ -120,8 +120,8 @@ class DeInterleaverTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink_c;
float * random_data;
- nframes_t frames_per_channel;
- nframes_t total_frames;
+ framecnt_t frames_per_channel;
+ framecnt_t total_frames;
unsigned int channels;
};
diff --git a/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc b/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc
index 908abafdf2..da042b9494 100644
--- a/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc
+++ b/libs/audiographer/tests/general/interleaver_deinterleaver_test.cc
@@ -55,7 +55,7 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), total_frames));
// And a second round...
- nframes_t less_frames = (frames_per_channel / 10) * channels;
+ framecnt_t less_frames = (frames_per_channel / 10) * channels;
deinterleaver->process (c.beginning (less_frames));
CPPUNIT_ASSERT (TestUtils::array_equals (random_data_a, sink_a->get_array(), less_frames));
}
@@ -85,7 +85,7 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
CPPUNIT_ASSERT (TestUtils::array_equals (random_data_c, sink_c->get_array(), frames_per_channel));
// And a second round...
- nframes_t less_frames = frames_per_channel / 5;
+ framecnt_t less_frames = frames_per_channel / 5;
interleaver->input (0)->process (c_a.beginning (less_frames));
interleaver->input (1)->process (c_b.beginning (less_frames));
interleaver->input (2)->process (c_c.beginning (less_frames));
@@ -108,8 +108,8 @@ class InterleaverDeInterleaverTest : public CppUnit::TestFixture
float * random_data_b;
float * random_data_c;
- nframes_t frames_per_channel;
- nframes_t total_frames;
+ framecnt_t frames_per_channel;
+ framecnt_t total_frames;
unsigned int channels;
};
diff --git a/libs/audiographer/tests/general/interleaver_test.cc b/libs/audiographer/tests/general/interleaver_test.cc
index 1512d054fc..b82aac74bb 100644
--- a/libs/audiographer/tests/general/interleaver_test.cc
+++ b/libs/audiographer/tests/general/interleaver_test.cc
@@ -69,11 +69,11 @@ class InterleaverTest : public CppUnit::TestFixture
interleaver->input (1)->process (c);
interleaver->input (2)->process (c);
- nframes_t expected_frames = frames * channels;
- nframes_t generated_frames = sink->get_data().size();
+ framecnt_t expected_frames = frames * channels;
+ framecnt_t generated_frames = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
- nframes_t less_frames = frames / 2;
+ framecnt_t less_frames = frames / 2;
interleaver->input (0)->process (c.beginning (less_frames));
interleaver->input (1)->process (c.beginning (less_frames));
interleaver->input (2)->process (c.beginning (less_frames));
@@ -100,8 +100,8 @@ class InterleaverTest : public CppUnit::TestFixture
interleaver->input (1)->process (c);
interleaver->input (2)->process (c);
- nframes_t expected_frames = frames * channels;
- nframes_t generated_frames = sink->get_data().size();
+ framecnt_t expected_frames = frames * channels;
+ framecnt_t generated_frames = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (expected_frames, generated_frames);
}
@@ -119,9 +119,9 @@ class InterleaverTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink;
- nframes_t channels;
+ framecnt_t channels;
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (InterleaverTest);
diff --git a/libs/audiographer/tests/general/normalizer_test.cc b/libs/audiographer/tests/general/normalizer_test.cc
index b08fd73a0e..be23680202 100644
--- a/libs/audiographer/tests/general/normalizer_test.cc
+++ b/libs/audiographer/tests/general/normalizer_test.cc
@@ -54,7 +54,7 @@ class NormalizerTest : public CppUnit::TestFixture
boost::shared_ptr<VectorSink<float> > sink;
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (NormalizerTest);
diff --git a/libs/audiographer/tests/general/peak_reader_test.cc b/libs/audiographer/tests/general/peak_reader_test.cc
index 53b7a15174..6b60598a2e 100644
--- a/libs/audiographer/tests/general/peak_reader_test.cc
+++ b/libs/audiographer/tests/general/peak_reader_test.cc
@@ -48,7 +48,7 @@ class PeakReaderTest : public CppUnit::TestFixture
boost::shared_ptr<PeakReader> reader;
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (PeakReaderTest);
diff --git a/libs/audiographer/tests/general/sample_format_converter_test.cc b/libs/audiographer/tests/general/sample_format_converter_test.cc
index 1456528ebf..9239564d5b 100644
--- a/libs/audiographer/tests/general/sample_format_converter_test.cc
+++ b/libs/audiographer/tests/general/sample_format_converter_test.cc
@@ -62,7 +62,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
converter->init (frames, D_Tri, 32);
converter->add_output (sink);
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
{
ProcessContext<float> pc(random_data, frames / 2, 1);
@@ -88,7 +88,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<float> > converter (new SampleFormatConverter<float>(1));
boost::shared_ptr<VectorSink<float> > sink (new VectorSink<float>());
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
converter->init(frames, D_Tri, 32);
converter->add_output (sink);
@@ -110,7 +110,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL (frames, frames_output);
CPPUNIT_ASSERT (TestUtils::array_filled(sink->get_array(), frames));
- for (nframes_t i = 0; i < frames; ++i) {
+ for (framecnt_t i = 0; i < frames; ++i) {
// fp comparison needs a bit of tolerance, 1.01 << 1.5
CPPUNIT_ASSERT(sink->get_data()[i] < 1.01);
CPPUNIT_ASSERT(sink->get_data()[i] > -1.01);
@@ -121,7 +121,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(1));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
converter->init(frames, D_Tri, 32);
converter->add_output (sink);
@@ -137,7 +137,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(1));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
converter->init(frames, D_Tri, 24);
converter->add_output (sink);
@@ -153,7 +153,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<int16_t> > converter (new SampleFormatConverter<int16_t>(1));
boost::shared_ptr<VectorSink<int16_t> > sink (new VectorSink<int16_t>());
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
converter->init(frames, D_Tri, 16);
converter->add_output (sink);
@@ -169,7 +169,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<uint8_t> > converter (new SampleFormatConverter<uint8_t>(1));
boost::shared_ptr<VectorSink<uint8_t> > sink (new VectorSink<uint8_t>());
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
converter->init(frames, D_Tri, 8);
converter->add_output (sink);
@@ -185,7 +185,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
{
boost::shared_ptr<SampleFormatConverter<int32_t> > converter (new SampleFormatConverter<int32_t>(3));
boost::shared_ptr<VectorSink<int32_t> > sink (new VectorSink<int32_t>());
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
converter->init(frames, D_Tri, 32);
converter->add_output (sink);
@@ -193,7 +193,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
ProcessContext<float> pc(random_data, 4, 1);
CPPUNIT_ASSERT_THROW (converter->process (pc), Exception);
- nframes_t new_frame_count = frames - (frames % 3);
+ framecnt_t new_frame_count = frames - (frames % 3);
converter->process (ProcessContext<float> (pc.data(), new_frame_count, 3));
frames_output = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (new_frame_count, frames_output);
@@ -203,7 +203,7 @@ class SampleFormatConverterTest : public CppUnit::TestFixture
private:
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (SampleFormatConverterTest);
diff --git a/libs/audiographer/tests/general/silence_trimmer_test.cc b/libs/audiographer/tests/general/silence_trimmer_test.cc
index add24d026a..dfcf3c7ca2 100644
--- a/libs/audiographer/tests/general/silence_trimmer_test.cc
+++ b/libs/audiographer/tests/general/silence_trimmer_test.cc
@@ -50,14 +50,14 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
ProcessContext<float> c (zero_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
- CPPUNIT_ASSERT_EQUAL ((nframes_t) 0, frames_processed);
+ framecnt_t frames_processed = sink->get_data().size();
+ CPPUNIT_ASSERT_EQUAL ((framecnt_t) 0, frames_processed);
}
{
ProcessContext<float> c (random_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (frames, frames_processed);
CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, frames));
}
@@ -65,14 +65,14 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
ProcessContext<float> c (zero_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (frames, frames_processed);
}
{
ProcessContext<float> c (random_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (3 * frames, frames_processed);
CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, frames));
CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames], zero_data, frames));
@@ -82,7 +82,7 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
ProcessContext<float> c (zero_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (3 * frames, frames_processed);
}
}
@@ -97,7 +97,7 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
ProcessContext<float> c (half_random_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (frames / 2, frames_processed);
CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), &half_random_data[frames / 2], frames / 2));
}
@@ -105,14 +105,14 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
ProcessContext<float> c (zero_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (frames / 2, frames_processed);
}
{
ProcessContext<float> c (half_random_data, frames, 1);
trimmer->process (c);
- nframes_t frames_processed = sink->get_data().size();
+ framecnt_t frames_processed = sink->get_data().size();
CPPUNIT_ASSERT_EQUAL (2 * frames + frames / 2, frames_processed);
CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames + frames / 2], half_random_data, frames));
}
@@ -129,7 +129,7 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
trimmer->add_output (sink);
- nframes_t silence = frames / 2;
+ framecnt_t silence = frames / 2;
trimmer->add_silence_to_beginning (silence);
{
@@ -145,7 +145,7 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
{
trimmer->add_output (sink);
- nframes_t silence = frames / 3;
+ framecnt_t silence = frames / 3;
trimmer->add_silence_to_end (silence);
{
@@ -159,8 +159,8 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
trimmer->process (c);
}
- nframes_t frames_processed = sink->get_data().size();
- nframes_t total_frames = 2 * frames + silence;
+ framecnt_t frames_processed = sink->get_data().size();
+ framecnt_t total_frames = 2 * frames + silence;
CPPUNIT_ASSERT_EQUAL (total_frames, frames_processed);
CPPUNIT_ASSERT (TestUtils::array_equals (sink->get_array(), random_data, frames));
CPPUNIT_ASSERT (TestUtils::array_equals (&sink->get_array()[frames], random_data, frames));
@@ -174,7 +174,7 @@ class SilenceTrimmerTest : public CppUnit::TestFixture
float * random_data;
float * zero_data;
float * half_random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (SilenceTrimmerTest);
diff --git a/libs/audiographer/tests/general/sr_converter_test.cc b/libs/audiographer/tests/general/sr_converter_test.cc
index 68e21d3558..75834127f5 100644
--- a/libs/audiographer/tests/general/sr_converter_test.cc
+++ b/libs/audiographer/tests/general/sr_converter_test.cc
@@ -31,8 +31,8 @@ class SampleRateConverterTest : public CppUnit::TestFixture
void testNoConversion()
{
assert (frames % 2 == 0);
- nframes_t const half_frames = frames / 2;
- nframes_t frames_output = 0;
+ framecnt_t const half_frames = frames / 2;
+ framecnt_t frames_output = 0;
converter->init (44100, 44100);
converter->add_output (sink);
@@ -52,8 +52,8 @@ class SampleRateConverterTest : public CppUnit::TestFixture
void testUpsampleLength()
{
assert (frames % 2 == 0);
- nframes_t const half_frames = frames / 2;
- nframes_t frames_output = 0;
+ framecnt_t const half_frames = frames / 2;
+ framecnt_t frames_output = 0;
converter->init (44100, 88200);
converter->allocate_buffers (half_frames);
@@ -66,15 +66,15 @@ class SampleRateConverterTest : public CppUnit::TestFixture
converter->process (c2);
frames_output = sink->get_data().size();
- nframes_t tolerance = 3;
+ framecnt_t tolerance = 3;
CPPUNIT_ASSERT (2 * frames - tolerance < frames_output && frames_output < 2 * frames + tolerance);
}
void testDownsampleLength()
{
assert (frames % 2 == 0);
- nframes_t const half_frames = frames / 2;
- nframes_t frames_output = 0;
+ framecnt_t const half_frames = frames / 2;
+ framecnt_t frames_output = 0;
converter->init (88200, 44100);
converter->allocate_buffers (half_frames);
@@ -87,14 +87,14 @@ class SampleRateConverterTest : public CppUnit::TestFixture
converter->process (c2);
frames_output = sink->get_data().size();
- nframes_t tolerance = 3;
+ framecnt_t tolerance = 3;
CPPUNIT_ASSERT (half_frames - tolerance < frames_output && frames_output < half_frames + tolerance);
}
void testRespectsEndOfInput()
{
assert (frames % 2 == 0);
- nframes_t const half_frames = frames / 2;
+ framecnt_t const half_frames = frames / 2;
converter->init (44100, 48000);
converter->allocate_buffers (half_frames);
@@ -123,7 +123,7 @@ class SampleRateConverterTest : public CppUnit::TestFixture
boost::shared_ptr<ProcessContextGrabber<float> > grabber;
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (SampleRateConverterTest);
diff --git a/libs/audiographer/tests/general/threader_test.cc b/libs/audiographer/tests/general/threader_test.cc
index c599d87953..1e87c8d34d 100644
--- a/libs/audiographer/tests/general/threader_test.cc
+++ b/libs/audiographer/tests/general/threader_test.cc
@@ -149,7 +149,7 @@ class ThreaderTest : public CppUnit::TestFixture
float * random_data;
float * zero_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (ThreaderTest);
diff --git a/libs/audiographer/tests/sndfile/tmp_file_test.cc b/libs/audiographer/tests/sndfile/tmp_file_test.cc
index d2d1b3581e..94647cc1a6 100644
--- a/libs/audiographer/tests/sndfile/tmp_file_test.cc
+++ b/libs/audiographer/tests/sndfile/tmp_file_test.cc
@@ -40,7 +40,7 @@ class TmpFileTest : public CppUnit::TestFixture
boost::shared_ptr<TmpFile<float> > file;
float * random_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (TmpFileTest);
diff --git a/libs/audiographer/tests/utils.h b/libs/audiographer/tests/utils.h
index b13a7b7f07..bc882b679c 100644
--- a/libs/audiographer/tests/utils.h
+++ b/libs/audiographer/tests/utils.h
@@ -17,14 +17,14 @@
#include <cstdlib>
#include <ctime>
-using AudioGrapher::nframes_t;
+using AudioGrapher::framecnt_t;
struct TestUtils
{
template<typename T>
- static bool array_equals (T const * a, T const * b, nframes_t frames)
+ static bool array_equals (T const * a, T const * b, framecnt_t frames)
{
- for (nframes_t i = 0; i < frames; ++i) {
+ for (framecnt_t i = 0; i < frames; ++i) {
if (a[i] != b[i]) {
return false;
}
@@ -33,9 +33,9 @@ struct TestUtils
}
template<typename T>
- static bool array_filled (T const * array, nframes_t frames)
+ static bool array_filled (T const * array, framecnt_t frames)
{
- for (nframes_t i = 0; i < frames; ++i) {
+ for (framecnt_t i = 0; i < frames; ++i) {
if (array[i] == static_cast<T> (0.0)) {
return false;
}
@@ -44,13 +44,13 @@ struct TestUtils
}
/// Generate random data, all samples guaranteed not to be 0.0, 1.0 or -1.0
- static float * init_random_data (nframes_t frames, float range = 1.0)
+ static float * init_random_data (framecnt_t frames, float range = 1.0)
{
unsigned int const granularity = 4096;
float * data = new float[frames];
srand (std::time (NULL));
- for (nframes_t i = 0; i < frames; ++i) {
+ for (framecnt_t i = 0; i < frames; ++i) {
do {
int biased_int = (rand() % granularity) - (granularity / 2);
data[i] = (range * biased_int) / granularity;
@@ -102,7 +102,7 @@ class AppendingVectorSink : public VectorSink<T>
}
private:
- nframes_t total_frames;
+ framecnt_t total_frames;
};
diff --git a/libs/audiographer/tests/utils/identity_vertex_test.cc b/libs/audiographer/tests/utils/identity_vertex_test.cc
index 165af66a9d..799dcca386 100644
--- a/libs/audiographer/tests/utils/identity_vertex_test.cc
+++ b/libs/audiographer/tests/utils/identity_vertex_test.cc
@@ -37,7 +37,7 @@ class IdentityVertexTest : public CppUnit::TestFixture
vertex->add_output (sink_a);
vertex->add_output (sink_b);
- nframes_t frames_output = 0;
+ framecnt_t frames_output = 0;
ProcessContext<float> c (random_data, frames, 1);
vertex->process (c);
@@ -93,7 +93,7 @@ class IdentityVertexTest : public CppUnit::TestFixture
float * random_data;
float * zero_data;
- nframes_t frames;
+ framecnt_t frames;
};
CPPUNIT_TEST_SUITE_REGISTRATION (IdentityVertexTest);