summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-09-18 12:39:17 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2017-09-18 12:39:17 -0400
commit30b087ab3d28f1585987fa3f6ae006562ae192e3 (patch)
tree620ae0250b5d77f90a18f8c2b83be61e4fe7b0b5 /libs/audiographer/audiographer
parentcb956e3e480716a3efd280a5287bdd7bee1cedc5 (diff)
globally change all use of "frame" to refer to audio into "sample".
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode and video in order to keep the legible
Diffstat (limited to 'libs/audiographer/audiographer')
-rw-r--r--libs/audiographer/audiographer/general/analyser.h10
-rw-r--r--libs/audiographer/audiographer/general/chunker.h30
-rw-r--r--libs/audiographer/audiographer/general/deinterleaver.h24
-rw-r--r--libs/audiographer/audiographer/general/interleaver.h54
-rw-r--r--libs/audiographer/audiographer/general/loudness_reader.h6
-rw-r--r--libs/audiographer/audiographer/general/normalizer.h4
-rw-r--r--libs/audiographer/audiographer/general/peak_reader.h2
-rw-r--r--libs/audiographer/audiographer/general/sample_format_converter.h10
-rw-r--r--libs/audiographer/audiographer/general/silence_trimmer.h108
-rw-r--r--libs/audiographer/audiographer/general/sr_converter.h14
-rw-r--r--libs/audiographer/audiographer/process_context.h102
-rw-r--r--libs/audiographer/audiographer/routines.h22
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile.h2
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_reader.h14
-rw-r--r--libs/audiographer/audiographer/sndfile/sndfile_writer.h16
-rw-r--r--libs/audiographer/audiographer/sndfile/tmp_file_rt.h24
-rw-r--r--libs/audiographer/audiographer/sndfile/tmp_file_sync.h4
-rw-r--r--libs/audiographer/audiographer/type_utils.h26
-rw-r--r--libs/audiographer/audiographer/types.h2
19 files changed, 237 insertions, 237 deletions
diff --git a/libs/audiographer/audiographer/general/analyser.h b/libs/audiographer/audiographer/general/analyser.h
index 9bd49b33c8..c912664cf0 100644
--- a/libs/audiographer/audiographer/general/analyser.h
+++ b/libs/audiographer/audiographer/general/analyser.h
@@ -29,7 +29,7 @@ namespace AudioGrapher
class LIBAUDIOGRAPHER_API Analyser : public LoudnessReader
{
public:
- Analyser (float sample_rate, unsigned int channels, framecnt_t bufsize, framecnt_t n_samples);
+ Analyser (float sample_rate, unsigned int channels, samplecnt_t bufsize, samplecnt_t n_samples);
~Analyser ();
void process (ProcessContext<float> const & c);
ARDOUR::ExportAnalysisPtr result ();
@@ -48,10 +48,10 @@ class LIBAUDIOGRAPHER_API Analyser : public LoudnessReader
ARDOUR::ExportAnalysis _result;
- framecnt_t _n_samples;
- framecnt_t _pos;
- framecnt_t _spp;
- framecnt_t _fpp;
+ samplecnt_t _n_samples;
+ samplecnt_t _pos;
+ samplecnt_t _spp;
+ samplecnt_t _fpp;
float* _hann_window;
uint32_t _fft_data_size;
diff --git a/libs/audiographer/audiographer/general/chunker.h b/libs/audiographer/audiographer/general/chunker.h
index 466a333655..28ac79b603 100644
--- a/libs/audiographer/audiographer/general/chunker.h
+++ b/libs/audiographer/audiographer/general/chunker.h
@@ -10,7 +10,7 @@
namespace AudioGrapher
{
-/// A class that chunks process cycles into equal sized frames
+/// A class that chunks process cycles into equal sized samples
template<typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ Chunker
: public ListedSource<T>
@@ -21,7 +21,7 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker
/** Constructs a new Chunker with a constant chunk size.
* \n NOT RT safe
*/
- Chunker (framecnt_t chunk_size)
+ Chunker (samplecnt_t chunk_size)
: chunk_size (chunk_size)
, position (0)
{
@@ -42,29 +42,29 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker
{
check_flags (*this, context);
- framecnt_t frames_left = context.frames();
- framecnt_t input_position = 0;
+ samplecnt_t samples_left = context.samples();
+ samplecnt_t input_position = 0;
- while (position + frames_left >= chunk_size) {
+ while (position + samples_left >= chunk_size) {
// Copy from context to buffer
- framecnt_t const frames_to_copy = chunk_size - position;
- TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], frames_to_copy);
+ samplecnt_t const samples_to_copy = chunk_size - position;
+ TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], samples_to_copy);
// Update counters
position = 0;
- input_position += frames_to_copy;
- frames_left -= frames_to_copy;
+ input_position += samples_to_copy;
+ samples_left -= samples_to_copy;
// Output whole buffer
ProcessContext<T> c_out (context, buffer, chunk_size);
- if (frames_left) { c_out.remove_flag(ProcessContext<T>::EndOfInput); }
+ if (samples_left) { c_out.remove_flag(ProcessContext<T>::EndOfInput); }
ListedSource<T>::output (c_out);
}
- if (frames_left) {
+ if (samples_left) {
// Copy the rest of the data
- TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], frames_left);
- position += frames_left;
+ TypeUtils<T>::copy (&context.data()[input_position], &buffer[position], samples_left);
+ position += samples_left;
}
if (context.has_flag (ProcessContext<T>::EndOfInput) && position > 0) {
@@ -75,8 +75,8 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker
using Sink<T>::process;
private:
- framecnt_t chunk_size;
- framecnt_t position;
+ samplecnt_t chunk_size;
+ samplecnt_t position;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/deinterleaver.h b/libs/audiographer/audiographer/general/deinterleaver.h
index 63b6c95589..491c07fcb6 100644
--- a/libs/audiographer/audiographer/general/deinterleaver.h
+++ b/libs/audiographer/audiographer/general/deinterleaver.h
@@ -26,7 +26,7 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
/// Constructor. \n RT safe
DeInterleaver()
: channels (0)
- , max_frames (0)
+ , max_samples (0)
, buffer (0)
{}
@@ -35,12 +35,12 @@ class /*LIBAUDIOGRAPHER_API*/ 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, framecnt_t max_frames_per_channel)
+ void init (unsigned int num_channels, samplecnt_t max_samples_per_channel)
{
reset();
channels = num_channels;
- max_frames = max_frames_per_channel;
- buffer = new T[max_frames];
+ max_samples = max_samples_per_channel;
+ buffer = new T[max_samples];
for (unsigned int i = 0; i < channels; ++i) {
outputs.push_back (OutputPtr (new IdentityVertex<T>));
@@ -60,28 +60,28 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
/// Deinterleaves data and outputs it to the outputs. \n RT safe
void process (ProcessContext<T> const & c)
{
- framecnt_t frames = c.frames();
+ samplecnt_t samples = c.samples();
T const * data = c.data();
- framecnt_t const frames_per_channel = frames / channels;
+ samplecnt_t const samples_per_channel = samples / channels;
if (throw_level (ThrowProcess) && c.channels() != channels) {
throw Exception (*this, "wrong amount of channels given to process()");
}
- if (throw_level (ThrowProcess) && frames_per_channel > max_frames) {
- throw Exception (*this, "too many frames given to process()");
+ if (throw_level (ThrowProcess) && samples_per_channel > max_samples) {
+ throw Exception (*this, "too many samples given to process()");
}
unsigned int channel = 0;
for (typename std::vector<OutputPtr>::iterator it = outputs.begin(); it != outputs.end(); ++it, ++channel) {
if (!*it) { continue; }
- for (unsigned int i = 0; i < frames_per_channel; ++i) {
+ for (unsigned int i = 0; i < samples_per_channel; ++i) {
buffer[i] = data[channel + (channels * i)];
}
- ProcessContext<T> c_out (c, buffer, frames_per_channel, 1);
+ ProcessContext<T> c_out (c, buffer, samples_per_channel, 1);
(*it)->process (c_out);
}
}
@@ -96,12 +96,12 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
delete [] buffer;
buffer = 0;
channels = 0;
- max_frames = 0;
+ max_samples = 0;
}
std::vector<OutputPtr> outputs;
unsigned int channels;
- framecnt_t max_frames;
+ samplecnt_t max_samples;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/interleaver.h b/libs/audiographer/audiographer/general/interleaver.h
index c1b5e92cfe..7ea1be1ab8 100644
--- a/libs/audiographer/audiographer/general/interleaver.h
+++ b/libs/audiographer/audiographer/general/interleaver.h
@@ -25,20 +25,20 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
/// Constructs an interleaver \n RT safe
Interleaver()
: channels (0)
- , max_frames (0)
+ , max_samples (0)
, buffer (0)
{}
~Interleaver() { reset(); }
/// Inits the interleaver. Must be called before using. \n Not RT safe
- void init (unsigned int num_channels, framecnt_t max_frames_per_channel)
+ void init (unsigned int num_channels, samplecnt_t max_samples_per_channel)
{
reset();
channels = num_channels;
- max_frames = max_frames_per_channel;
+ max_samples = max_samples_per_channel;
- buffer = new T[channels * max_frames];
+ buffer = new T[channels * max_samples];
for (unsigned int i = 0; i < channels; ++i) {
inputs.push_back (InputPtr (new Input (*this, i)));
@@ -63,27 +63,27 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
{
public:
Input (Interleaver & parent, unsigned int channel)
- : frames_written (0), parent (parent), channel (channel) {}
+ : samples_written (0), parent (parent), channel (channel) {}
void process (ProcessContext<T> const & c)
{
if (parent.throw_level (ThrowProcess) && c.channels() > 1) {
throw Exception (*this, "Data input has more than on channel");
}
- if (parent.throw_level (ThrowStrict) && frames_written) {
+ if (parent.throw_level (ThrowStrict) && samples_written) {
throw Exception (*this, "Input channels out of sync");
}
- frames_written = c.frames();
+ samples_written = c.samples();
parent.write_channel (c, channel);
}
using Sink<T>::process;
- framecnt_t frames() { return frames_written; }
- void reset() { frames_written = 0; }
+ samplecnt_t samples() { return samples_written; }
+ void reset() { samples_written = 0; }
private:
- framecnt_t frames_written;
+ samplecnt_t samples_written;
Interleaver & parent;
unsigned int channel;
};
@@ -94,7 +94,7 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
delete [] buffer;
buffer = 0;
channels = 0;
- max_frames = 0;
+ max_samples = 0;
}
void reset_channels ()
@@ -107,44 +107,44 @@ class /*LIBAUDIOGRAPHER_API*/ Interleaver
void write_channel (ProcessContext<T> const & c, unsigned int channel)
{
- if (throw_level (ThrowProcess) && c.frames() > max_frames) {
+ if (throw_level (ThrowProcess) && c.samples() > max_samples) {
reset_channels();
- throw Exception (*this, "Too many frames given to an input");
+ throw Exception (*this, "Too many samples given to an input");
}
- for (unsigned int i = 0; i < c.frames(); ++i) {
+ for (unsigned int i = 0; i < c.samples(); ++i) {
buffer[channel + (channels * i)] = c.data()[i];
}
- framecnt_t const ready_frames = ready_to_output();
- if (ready_frames) {
- ProcessContext<T> c_out (c, buffer, ready_frames, channels);
+ samplecnt_t const ready_samples = ready_to_output();
+ if (ready_samples) {
+ ProcessContext<T> c_out (c, buffer, ready_samples, channels);
ListedSource<T>::output (c_out);
reset_channels ();
}
}
- framecnt_t ready_to_output()
+ samplecnt_t ready_to_output()
{
- framecnt_t ready_frames = inputs[0]->frames();
- if (!ready_frames) { return 0; }
+ samplecnt_t ready_samples = inputs[0]->samples();
+ if (!ready_samples) { return 0; }
for (unsigned int i = 1; i < channels; ++i) {
- framecnt_t const frames = inputs[i]->frames();
- if (!frames) { return 0; }
- if (throw_level (ThrowProcess) && frames != ready_frames) {
- init (channels, max_frames);
- throw Exception (*this, "Frames count out of sync");
+ samplecnt_t const samples = inputs[i]->samples();
+ if (!samples) { return 0; }
+ if (throw_level (ThrowProcess) && samples != ready_samples) {
+ init (channels, max_samples);
+ throw Exception (*this, "Samples count out of sync");
}
}
- return ready_frames * channels;
+ return ready_samples * channels;
}
typedef boost::shared_ptr<Input> InputPtr;
std::vector<InputPtr> inputs;
unsigned int channels;
- framecnt_t max_frames;
+ samplecnt_t max_samples;
T * buffer;
};
diff --git a/libs/audiographer/audiographer/general/loudness_reader.h b/libs/audiographer/audiographer/general/loudness_reader.h
index c86fd521da..8c9ccb4149 100644
--- a/libs/audiographer/audiographer/general/loudness_reader.h
+++ b/libs/audiographer/audiographer/general/loudness_reader.h
@@ -32,7 +32,7 @@ namespace AudioGrapher
class LIBAUDIOGRAPHER_API LoudnessReader : public ListedSource<float>, public Sink<float>
{
public:
- LoudnessReader (float sample_rate, unsigned int channels, framecnt_t bufsize);
+ LoudnessReader (float sample_rate, unsigned int channels, samplecnt_t bufsize);
~LoudnessReader ();
void reset ();
@@ -52,8 +52,8 @@ class LIBAUDIOGRAPHER_API LoudnessReader : public ListedSource<float>, public Si
float _sample_rate;
unsigned int _channels;
- framecnt_t _bufsize;
- framecnt_t _pos;
+ samplecnt_t _bufsize;
+ samplecnt_t _pos;
float* _bufs[2];
};
diff --git a/libs/audiographer/audiographer/general/normalizer.h b/libs/audiographer/audiographer/general/normalizer.h
index e5f73a0f08..cd4e375db2 100644
--- a/libs/audiographer/audiographer/general/normalizer.h
+++ b/libs/audiographer/audiographer/general/normalizer.h
@@ -28,7 +28,7 @@ public:
* non-const ProcessContexts are given to \a process() .
* \n Not RT safe
*/
- void alloc_buffer(framecnt_t frames);
+ void alloc_buffer(samplecnt_t samples);
/// Process a const ProcessContext \see alloc_buffer() \n RT safe
void process (ProcessContext<float> const & c);
@@ -42,7 +42,7 @@ private:
float gain;
float * buffer;
- framecnt_t buffer_size;
+ samplecnt_t buffer_size;
};
diff --git a/libs/audiographer/audiographer/general/peak_reader.h b/libs/audiographer/audiographer/general/peak_reader.h
index 8bf0faa792..bb04239544 100644
--- a/libs/audiographer/audiographer/general/peak_reader.h
+++ b/libs/audiographer/audiographer/general/peak_reader.h
@@ -25,7 +25,7 @@ class /*LIBAUDIOGRAPHER_API*/ PeakReader : public ListedSource<float>, public Si
/// Finds peaks from the data \n RT safe
void process (ProcessContext<float> const & c)
{
- peak = Routines::compute_peak (c.data(), c.frames(), peak);
+ peak = Routines::compute_peak (c.data(), c.samples(), peak);
ListedSource<float>::output(c);
}
diff --git a/libs/audiographer/audiographer/general/sample_format_converter.h b/libs/audiographer/audiographer/general/sample_format_converter.h
index 96dd6aa72a..9a79fc927c 100644
--- a/libs/audiographer/audiographer/general/sample_format_converter.h
+++ b/libs/audiographer/audiographer/general/sample_format_converter.h
@@ -35,13 +35,13 @@ class LIBAUDIOGRAPHER_API SampleFormatConverter
~SampleFormatConverter ();
/** Initialize and allocate buffers for processing.
- * \param max_frames maximum number of frames that is allowed to be used in calls to \a process()
+ * \param max_samples maximum number of samples that is allowed to be used in calls to \a process()
* \param type dither type from \a DitherType
* \param data_width data with in bits
* \note If the non-const version of process() is used with floats,
* there is no need to call this function.
*/
- void init (framecnt_t max_frames, int type, int data_width);
+ void init (samplecnt_t max_samples, 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; }
@@ -54,12 +54,12 @@ class LIBAUDIOGRAPHER_API SampleFormatConverter
private:
void reset();
- void init_common (framecnt_t max_frames); // not-template-specialized part of init
- void check_frame_and_channel_count (framecnt_t frames, ChannelCount channels_);
+ void init_common (samplecnt_t max_samples); // not-template-specialized part of init
+ void check_sample_and_channel_count (samplecnt_t samples, ChannelCount channels_);
ChannelCount channels;
GDither dither;
- framecnt_t data_out_size;
+ samplecnt_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 7cfa0658f1..e09c348c52 100644
--- a/libs/audiographer/audiographer/general/silence_trimmer.h
+++ b/libs/audiographer/audiographer/general/silence_trimmer.h
@@ -30,7 +30,7 @@ struct SilenceTester<float> {
};
-/// Removes and adds silent frames to beginning and/or end of stream
+/// Removes and adds silent samples to beginning and/or end of stream
template<typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
: public ListedSource<T>
@@ -41,7 +41,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
public:
/// Constructor, \see reset() \n Not RT safe
- SilenceTrimmer(framecnt_t silence_buffer_size_ = 1024, float thresh_dB = -INFINITY)
+ SilenceTrimmer(samplecnt_t silence_buffer_size_ = 1024, float thresh_dB = -INFINITY)
: silence_buffer_size (0)
, silence_buffer (0)
, tester (thresh_dB)
@@ -60,7 +60,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
* This also defines the maximum length of output process context
* which can be output during long intermediate silence.
*/
- void reset (framecnt_t silence_buffer_size_ = 1024)
+ void reset (samplecnt_t silence_buffer_size_ = 1024)
{
if (throw_level (ThrowObject) && silence_buffer_size_ == 0) {
throw Exception (*this,
@@ -78,34 +78,34 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
processing_finished = false;
trim_beginning = false;
trim_end = false;
- silence_frames = 0;
+ silence_samples = 0;
max_output_frames = 0;
add_to_beginning = 0;
add_to_end = 0;
}
- /** Tells that \a frames_per_channel frames of silence per channel should be added to beginning
+ /** Tells that \a samples_per_channel samples of silence per channel should be added to beginning
* Needs to be called before starting processing.
* \n RT safe
*/
- void add_silence_to_beginning (framecnt_t frames_per_channel)
+ void add_silence_to_beginning (samplecnt_t samples_per_channel)
{
if (throw_level (ThrowObject) && processed_data) {
throw Exception(*this, "Tried to add silence to beginning after processing started");
}
- add_to_beginning = frames_per_channel;
+ add_to_beginning = samples_per_channel;
}
- /** Tells that \a frames_per_channel frames of silence per channel should be added to end
+ /** Tells that \a samples_per_channel samples of silence per channel should be added to end
* Needs to be called before end is reached.
* \n RT safe
*/
- void add_silence_to_end (framecnt_t frames_per_channel)
+ void add_silence_to_end (samplecnt_t samples_per_channel)
{
if (throw_level (ThrowObject) && processed_data) {
throw Exception(*this, "Tried to add silence to end after processing started");
}
- add_to_end = frames_per_channel;
+ add_to_end = samples_per_channel;
}
/** Tells whether ot nor silence should be trimmed from the beginning
@@ -166,17 +166,17 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
* may lend itself for some inspiration.
*/
- framecnt_t output_start_index = 0;
- framecnt_t output_sample_count = c.frames();
+ samplecnt_t output_start_index = 0;
+ samplecnt_t output_sample_count = c.samples();
if (!processed_data) {
if (trim_beginning) {
- framecnt_t first_non_silent_frame_index = 0;
- if (find_first_non_silent_frame (c, first_non_silent_frame_index)) {
+ samplecnt_t first_non_silent_sample_index = 0;
+ if (find_first_non_silent_sample (c, first_non_silent_sample_index)) {
// output from start of non-silent data until end of buffer
// output_sample_count may also be altered in trim end
- output_start_index = first_non_silent_frame_index;
- output_sample_count = c.frames() - first_non_silent_frame_index;
+ output_start_index = first_non_silent_sample_index;
+ output_sample_count = c.samples() - first_non_silent_sample_index;
processed_data = true;
} else {
// keep entering this block until non-silence is found to trim
@@ -189,35 +189,35 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
// This block won't be called again so add silence to beginning
if (processed_data && add_to_beginning) {
add_to_beginning *= c.channels ();
- output_silence_frames (c, add_to_beginning);
+ output_silence_samples (c, add_to_beginning);
}
}
if (processed_data) {
if (trim_end) {
- framecnt_t first_non_silent_frame_index = 0;
- if (find_first_non_silent_frame (c, first_non_silent_frame_index)) {
+ samplecnt_t first_non_silent_sample_index = 0;
+ if (find_first_non_silent_sample (c, first_non_silent_sample_index)) {
// context buffer contains non-silent data, flush any intermediate silence
- output_silence_frames (c, silence_frames);
+ output_silence_samples (c, silence_samples);
- framecnt_t silent_frame_index = 0;
- find_last_silent_frame_reverse (c, silent_frame_index);
+ samplecnt_t silent_sample_index = 0;
+ find_last_silent_sample_reverse (c, silent_sample_index);
// Count of samples at end of block that are "silent", may be zero.
- framecnt_t silent_end_samples = c.frames () - silent_frame_index;
- framecnt_t samples_before_silence = c.frames() - silent_end_samples;
+ samplecnt_t silent_end_samples = c.samples () - silent_sample_index;
+ samplecnt_t samples_before_silence = c.samples() - silent_end_samples;
- assert (samples_before_silence + silent_end_samples == c.frames ());
+ assert (samples_before_silence + silent_end_samples == c.samples ());
// output_start_index may be non-zero if start trim occurred above
output_sample_count = samples_before_silence - output_start_index;
// keep track of any silent samples not output
- silence_frames = silent_end_samples;
+ silence_samples = silent_end_samples;
} else {
// whole context buffer is silent output nothing
- silence_frames += c.frames ();
+ silence_samples += c.samples ();
output_sample_count = 0;
}
}
@@ -230,7 +230,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
// Finally, if in last process call, add silence to end
if (processing_finished && processed_data && add_to_end) {
add_to_end *= c.channels();
- output_silence_frames (c, add_to_end);
+ output_silence_samples (c, add_to_end);
}
if (processing_finished) {
@@ -250,13 +250,13 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer
private:
- bool find_first_non_silent_frame (ProcessContext<T> const & c, framecnt_t & result_frame)
+ bool find_first_non_silent_sample (ProcessContext<T> const & c, samplecnt_t & result_sample)
{
- for (framecnt_t i = 0; i < c.frames(); ++i) {
+ for (samplecnt_t i = 0; i < c.samples(); ++i) {
if (!tester.is_silent (c.data()[i])) {
- result_frame = i;
+ result_sample = i;
// Round down to nearest interleaved "frame" beginning
- result_frame -= result_frame % c.channels();
+ result_sample -= result_sample % c.channels();
return true;
}
}
@@ -264,43 +264,43 @@ private:
}
/**
- * Reverse find the last silent frame index. If the last sample in the
+ * Reverse find the last silent sample index. If the last sample in the
* buffer is non-silent the index will be one past the end of the buffer and
- * equal to c.frames(). e.g silent_end_samples = c.frames() - result_frame
+ * equal to c.samples(). e.g silent_end_samples = c.samples() - result_sample
*
- * @return true if result_frame index is valid, false if there were only
+ * @return true if result_sample index is valid, false if there were only
* silent samples in the context buffer
*/
- bool find_last_silent_frame_reverse (ProcessContext<T> const & c, framecnt_t & result_frame)
+ bool find_last_silent_sample_reverse (ProcessContext<T> const & c, samplecnt_t & result_sample)
{
- framecnt_t last_sample_index = c.frames() - 1;
+ samplecnt_t last_sample_index = c.samples() - 1;
- for (framecnt_t i = last_sample_index; i >= 0; --i) {
+ for (samplecnt_t i = last_sample_index; i >= 0; --i) {
if (!tester.is_silent (c.data()[i])) {
- result_frame = i;
+ result_sample = i;
// Round down to nearest interleaved "frame" beginning
- result_frame -= result_frame % c.channels();
- // Round up to return the "last" silent interleaved frame
- result_frame += c.channels();
+ result_sample -= result_sample % c.channels();
+ // Round up to return the "last" silent interleaved sample
+ result_sample += c.channels();
return true;
}
}
return false;
}
- void output_silence_frames (ProcessContext<T> const & c, framecnt_t & total_frames)
+ void output_silence_samples (ProcessContext<T> const & c, samplecnt_t & total_samples)
{
assert (!c.has_flag (ProcessContext<T>::EndOfInput));
- while (total_frames > 0) {
- framecnt_t frames = std::min (silence_buffer_size, total_frames);
+ while (total_samples > 0) {
+ samplecnt_t samples = std::min (silence_buffer_size, total_samples);
if (max_output_frames) {
- frames = std::min (frames, max_output_frames);
+ samples = std::min (samples, max_output_frames);
}
- frames -= frames % c.channels();
+ samples -= samples % c.channels();
- total_frames -= frames;
- ConstProcessContext<T> c_out (c, silence_buffer, frames);
+ total_samples -= samples;
+ ConstProcessContext<T> c_out (c, silence_buffer, samples);
ListedSource<T>::output (c_out);
}
}
@@ -311,13 +311,13 @@ private:
bool trim_beginning;
bool trim_end;
- framecnt_t silence_frames;
- framecnt_t max_output_frames;
+ samplecnt_t silence_samples;
+ samplecnt_t max_output_frames;
- framecnt_t add_to_beginning;
- framecnt_t add_to_end;
+ samplecnt_t add_to_beginning;
+ samplecnt_t add_to_end;
- framecnt_t silence_buffer_size;
+ samplecnt_t silence_buffer_size;
T * silence_buffer;
SilenceTester<T> tester;
diff --git a/libs/audiographer/audiographer/general/sr_converter.h b/libs/audiographer/audiographer/general/sr_converter.h
index a2e94d9bc0..8edc4b8c99 100644
--- a/libs/audiographer/audiographer/general/sr_converter.h
+++ b/libs/audiographer/audiographer/general/sr_converter.h
@@ -26,10 +26,10 @@ class LIBAUDIOGRAPHER_API SampleRateConverter
~SampleRateConverter ();
/// Init converter \n Not RT safe
- void init (framecnt_t in_rate, framecnt_t out_rate, int quality = 0);
+ void init (samplecnt_t in_rate, samplecnt_t out_rate, int quality = 0);
- /// Returns max amount of frames that will be output \n RT safe
- framecnt_t allocate_buffers (framecnt_t max_frames);
+ /// Returns max amount of samples that will be output \n RT safe
+ samplecnt_t allocate_buffers (samplecnt_t max_samples);
/** Does sample rate conversion.
* Note that outpt size may vary a lot.
@@ -47,14 +47,14 @@ class LIBAUDIOGRAPHER_API SampleRateConverter
bool active;
uint32_t channels;
- framecnt_t max_frames_in;
+ samplecnt_t max_samples_in;
float * leftover_data;
- framecnt_t leftover_frames;
- framecnt_t max_leftover_frames;
+ samplecnt_t leftover_samples;
+ samplecnt_t max_leftover_samples;
float * data_out;
- framecnt_t data_out_size;
+ samplecnt_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 16e637b85c..3b54accc06 100644
--- a/libs/audiographer/audiographer/process_context.h
+++ b/libs/audiographer/audiographer/process_context.h
@@ -41,45 +41,45 @@ public:
public:
- /// Basic constructor with data, frame and channel count
- ProcessContext (T * data, framecnt_t frames, ChannelCount channels)
- : _data (data), _frames (frames), _channels (channels)
+ /// Basic constructor with data, sample and channel count
+ ProcessContext (T * data, samplecnt_t samples, ChannelCount channels)
+ : _data (data), _samples (samples), _channels (channels)
{ validate_data(); }
/// Normal copy constructor
ProcessContext (ProcessContext<T> const & other)
- : Throwing<throwLevel>(), _data (other._data), _frames (other._frames), _channels (other._channels), _flags (other._flags)
+ : Throwing<throwLevel>(), _data (other._data), _samples (other._samples), _channels (other._channels), _flags (other._flags)
{ /* No need to validate data */ }
- /// "Copy constructor" with unique data, frame and channel count, but copies flags
+ /// "Copy constructor" with unique data, sample and channel count, but copies flags
template<typename Y>
- ProcessContext (ProcessContext<Y> const & other, T * data, framecnt_t frames, ChannelCount channels)
- : Throwing<throwLevel>(), _data (data), _frames (frames), _channels (channels), _flags (other.flags())
+ ProcessContext (ProcessContext<Y> const & other, T * data, samplecnt_t samples, ChannelCount channels)
+ : Throwing<throwLevel>(), _data (data), _samples (samples), _channels (channels), _flags (other.flags())
{ validate_data(); }
- /// "Copy constructor" with unique data and frame count, but copies channel count and flags
+ /// "Copy constructor" with unique data and sample count, but copies channel count and flags
template<typename Y>
- ProcessContext (ProcessContext<Y> const & other, T * data, framecnt_t frames)
- : Throwing<throwLevel>(), _data (data), _frames (frames), _channels (other.channels()), _flags (other.flags())
+ ProcessContext (ProcessContext<Y> const & other, T * data, samplecnt_t samples)
+ : Throwing<throwLevel>(), _data (data), _samples (samples), _channels (other.channels()), _flags (other.flags())
{ validate_data(); }
- /// "Copy constructor" with unique data, but copies frame and channel count + flags
+ /// "Copy constructor" with unique data, but copies sample and channel count + flags
template<typename Y>
ProcessContext (ProcessContext<Y> const & other, T * data)
- : Throwing<throwLevel>(), _data (data), _frames (other.frames()), _channels (other.channels()), _flags (other.flags())
+ : Throwing<throwLevel>(), _data (data), _samples (other.samples()), _channels (other.channels()), _flags (other.flags())
{ /* No need to validate data */ }
/// Make new Context out of the beginning of this context
- ProcessContext beginning (framecnt_t frames)
+ ProcessContext beginning (samplecnt_t samples)
{
- if (throw_level (ThrowProcess) && frames > _frames) {
+ if (throw_level (ThrowProcess) && samples > _samples) {
throw Exception (*this, boost::str (boost::format
- ("Trying to use too many frames of %1% for a new Context: %2% instead of %3%")
- % DebugUtils::demangled_name (*this) % frames % _frames));
+ ("Trying to use too many samples of %1% for a new Context: %2% instead of %3%")
+ % DebugUtils::demangled_name (*this) % samples % _samples));
}
validate_data ();
- return ProcessContext (*this, _data, frames);
+ return ProcessContext (*this, _data, samples);
}
virtual ~ProcessContext () {}
@@ -88,16 +88,16 @@ public:
inline T const * data() const { return _data; }
inline T * data() { return _data; }
- /// \a frames tells how many frames the array pointed by data contains
- inline framecnt_t const & frames() const { return _frames; }
+ /// \a samples tells how many samples the array pointed by data contains
+ inline samplecnt_t const & samples() const { return _samples; }
/** \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
+ * If \a channels is greater than 1, each channel contains \a samples / \a channels samples of data
*/
inline ChannelCount const & channels() const { return _channels; }
- /// Returns the amount of frames per channel
- inline framecnt_t frames_per_channel() const { return _frames / _channels; }
+ /// Returns the amount of samples per channel
+ inline samplecnt_t samples_per_channel() const { return _samples / _channels; }
/* Flags */
@@ -108,7 +108,7 @@ public:
protected:
T * const _data;
- framecnt_t _frames;
+ samplecnt_t _samples;
ChannelCount _channels;
mutable FlagField _flags;
@@ -116,10 +116,10 @@ protected:
private:
inline void validate_data()
{
- if (throw_level (ThrowProcess) && (_frames % _channels != 0)) {
+ if (throw_level (ThrowProcess) && (_samples % _channels != 0)) {
throw Exception (*this, boost::str (boost::format
- ("Number of frames given to %1% was not a multiple of channels: %2% frames with %3% channels")
- % DebugUtils::demangled_name (*this) % _frames % _channels));
+ ("Number of samples given to %1% was not a multiple of channels: %2% samples with %3% channels")
+ % DebugUtils::demangled_name (*this) % _samples % _channels));
}
}
};
@@ -130,33 +130,33 @@ class /*LIBAUDIOGRAPHER_API*/ AllocatingProcessContext : public ProcessContext<T
{
public:
/// Allocates uninitialized memory
- AllocatingProcessContext (framecnt_t frames, ChannelCount channels)
- : ProcessContext<T> (new T[frames], frames, channels) {}
+ AllocatingProcessContext (samplecnt_t samples, ChannelCount channels)
+ : ProcessContext<T> (new T[samples], samples, channels) {}
/// Allocates and copies data from raw buffer
- AllocatingProcessContext (T const * data, framecnt_t frames, ChannelCount channels)
- : ProcessContext<T> (new T[frames], frames, channels)
- { TypeUtils<float>::copy (data, ProcessContext<T>::_data, frames); }
+ AllocatingProcessContext (T const * data, samplecnt_t samples, ChannelCount channels)
+ : ProcessContext<T> (new T[samples], samples, channels)
+ { TypeUtils<float>::copy (data, ProcessContext<T>::_data, samples); }
/// Copy constructor, copies data from other ProcessContext
AllocatingProcessContext (ProcessContext<T> const & other)
- : ProcessContext<T> (other, new T[other._frames])
- { TypeUtils<float>::copy (ProcessContext<T>::_data, other._data, other._frames); }
+ : ProcessContext<T> (other, new T[other._samples])
+ { TypeUtils<float>::copy (ProcessContext<T>::_data, other._data, other._samples); }
- /// "Copy constructor" with uninitialized data, unique frame and channel count, but copies flags
+ /// "Copy constructor" with uninitialized data, unique sample and channel count, but copies flags
template<typename Y>
- AllocatingProcessContext (ProcessContext<Y> const & other, framecnt_t frames, ChannelCount channels)
- : ProcessContext<T> (other, new T[frames], frames, channels) {}
+ AllocatingProcessContext (ProcessContext<Y> const & other, samplecnt_t samples, ChannelCount channels)
+ : ProcessContext<T> (other, new T[samples], samples, channels) {}
- /// "Copy constructor" with uninitialized data, unique frame count, but copies channel count and flags
+ /// "Copy constructor" with uninitialized data, unique sample count, but copies channel count and flags
template<typename Y>
- AllocatingProcessContext (ProcessContext<Y> const & other, framecnt_t frames)
- : ProcessContext<T> (other, new T[frames], frames, other.channels()) {}
+ AllocatingProcessContext (ProcessContext<Y> const & other, samplecnt_t samples)
+ : ProcessContext<T> (other, new T[samples], samples, other.channels()) {}
- /// "Copy constructor" uninitialized data, that copies frame and channel count + flags
+ /// "Copy constructor" uninitialized data, that copies sample and channel count + flags
template<typename Y>
AllocatingProcessContext (ProcessContext<Y> const & other)
- : ProcessContext<T> (other, new T[other._frames]) {}
+ : ProcessContext<T> (other, new T[other._samples]) {}
~AllocatingProcessContext () { delete [] ProcessContext<T>::_data; }
};
@@ -166,25 +166,25 @@ template <typename T = DefaultSampleType>
class /*LIBAUDIOGRAPHER_API*/ ConstProcessContext
{
public:
- /// Basic constructor with data, frame and channel count
- ConstProcessContext (T const * data, framecnt_t frames, ChannelCount channels)
- : context (const_cast<T *>(data), frames, channels) {}
+ /// Basic constructor with data, sample and channel count
+ ConstProcessContext (T const * data, samplecnt_t samples, ChannelCount channels)
+ : context (const_cast<T *>(data), samples, channels) {}
/// Copy constructor from const ProcessContext
ConstProcessContext (ProcessContext<T> const & other)
: context (const_cast<ProcessContext<T> &> (other)) {}
- /// "Copy constructor", with unique data, frame and channel count, but copies flags
+ /// "Copy constructor", with unique data, sample and channel count, but copies flags
template<typename ProcessContext>
- ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames, ChannelCount channels)
- : context (other, const_cast<T *>(data), frames, channels) {}
+ ConstProcessContext (ProcessContext const & other, T const * data, samplecnt_t samples, ChannelCount channels)
+ : context (other, const_cast<T *>(data), samples, channels) {}
- /// "Copy constructor", with unique data and frame count, but copies channel count and flags
+ /// "Copy constructor", with unique data and sample count, but copies channel count and flags
template<typename ProcessContext>
- ConstProcessContext (ProcessContext const & other, T const * data, framecnt_t frames)
- : context (other, const_cast<T *>(data), frames) {}
+ ConstProcessContext (ProcessContext const & other, T const * data, samplecnt_t samples)
+ : context (other, const_cast<T *>(data), samples) {}
- /// "Copy constructor", with unique data, but copies frame and channel count + flags
+ /// "Copy constructor", with unique data, but copies sample and channel count + flags
template<typename ProcessContext>
ConstProcessContext (ProcessContext const & other, T const * data)
: context (other, const_cast<T *>(data)) {}
diff --git a/libs/audiographer/audiographer/routines.h b/libs/audiographer/audiographer/routines.h
index d78fa602b6..468580807d 100644
--- a/libs/audiographer/audiographer/routines.h
+++ b/libs/audiographer/audiographer/routines.h
@@ -25,39 +25,39 @@ class LIBAUDIOGRAPHER_API Routines
/** Computes peak in float buffer
* \n RT safe
* \param data buffer from which the peak is computed
- * \param frames length of the portion of \a buffer that is checked
+ * \param samples length of the portion of \a buffer that is checked
* \param current_peak current peak of buffer, if calculated in several passes
- * \return maximum of values in [\a data, \a data + \a frames) and \a current_peak
+ * \return maximum of values in [\a data, \a data + \a samples) and \a current_peak
*/
- static inline float compute_peak (float const * data, uint_type frames, float current_peak)
+ static inline float compute_peak (float const * data, uint_type samples, float current_peak)
{
- return (*_compute_peak) (data, frames, current_peak);
+ return (*_compute_peak) (data, samples, current_peak);
}
/** Applies constant gain to buffer
* \n RT safe
* \param data data to which the gain is applied
- * \param frames length of data
+ * \param samples length of data
* \param gain gain that is applied
*/
- static inline void apply_gain_to_buffer (float * data, uint_type frames, float gain)
+ static inline void apply_gain_to_buffer (float * data, uint_type samples, float gain)
{
- (*_apply_gain_to_buffer) (data, frames, gain);
+ (*_apply_gain_to_buffer) (data, samples, gain);
}
private:
- static inline float default_compute_peak (float const * data, uint_type frames, float current_peak)
+ static inline float default_compute_peak (float const * data, uint_type samples, float current_peak)
{
- for (uint_type i = 0; i < frames; ++i) {
+ for (uint_type i = 0; i < samples; ++i) {
float abs = std::fabs(data[i]);
if (abs > current_peak) { current_peak = abs; }
}
return current_peak;
}
- static inline void default_apply_gain_to_buffer (float * data, uint_type frames, float gain)
+ static inline void default_apply_gain_to_buffer (float * data, uint_type samples, float gain)
{
- for (uint_type i = 0; i < frames; ++i) {
+ for (uint_type i = 0; i < samples; ++i) {
data[i] *= gain;
}
}
diff --git a/libs/audiographer/audiographer/sndfile/sndfile.h b/libs/audiographer/audiographer/sndfile/sndfile.h
index c48a0331ab..2fccfc458e 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, framecnt_t samplerate = 0)
+ ChannelCount channels = 0, samplecnt_t samplerate = 0)
: SndfileHandle (filename, mode, format, channels, samplerate)
{}
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_reader.h b/libs/audiographer/audiographer/sndfile/sndfile_reader.h
index ea27470d77..b3e84ac40a 100644
--- a/libs/audiographer/audiographer/sndfile/sndfile_reader.h
+++ b/libs/audiographer/audiographer/sndfile/sndfile_reader.h
@@ -25,11 +25,11 @@ class SndfileReader
SndfileReader (SndfileReader const & other) : SndfileHandle (other) {}
using SndfileHandle::operator=;
- /** Read data into buffer in \a context, only the data is modified (not frame count)
+ /** Read data into buffer in \a context, only the data is modified (not sample count)
* Note that the data read is output to the outputs, as well as read into the context
- * \return number of frames read
+ * \return number of samples read
*/
- framecnt_t read (ProcessContext<T> & context)
+ samplecnt_t read (ProcessContext<T> & context)
{
if (throw_level (ThrowStrict) && context.channels() != channels() ) {
throw Exception (*this, boost::str (boost::format
@@ -37,14 +37,14 @@ class SndfileReader
% context.channels() % channels()));
}
- framecnt_t const frames_read = SndfileHandle::read (context.data(), context.frames());
- ProcessContext<T> c_out = context.beginning (frames_read);
+ samplecnt_t const samples_read = SndfileHandle::read (context.data(), context.samples());
+ ProcessContext<T> c_out = context.beginning (samples_read);
- if (frames_read < context.frames()) {
+ if (samples_read < context.samples()) {
c_out.set_flag (ProcessContext<T>::EndOfInput);
}
this->output (c_out);
- return frames_read;
+ return samples_read;
}
protected:
diff --git a/libs/audiographer/audiographer/sndfile/sndfile_writer.h b/libs/audiographer/audiographer/sndfile/sndfile_writer.h
index 81f0ddb497..d0049360d2 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, framecnt_t samplerate, boost::shared_ptr<BroadcastInfo> broadcast_info)
+ SndfileWriter (std::string const & path, int format, ChannelCount channels, samplecnt_t samplerate, boost::shared_ptr<BroadcastInfo> broadcast_info)
: SndfileHandle (path, Write, format, channels, samplerate)
, path (path)
{
@@ -42,8 +42,8 @@ class SndfileWriter
using SndfileHandle::operator=;
- framecnt_t get_frames_written() const { return frames_written; }
- void reset_frames_written_count() { frames_written = 0; }
+ samplecnt_t get_samples_written() const { return samples_written; }
+ void reset_samples_written_count() { samples_written = 0; }
/// Writes data to file
virtual void process (ProcessContext<T> const & c)
@@ -56,10 +56,10 @@ class SndfileWriter
% c.channels() % channels()));
}
- framecnt_t const written = write (c.data(), c.frames());
- frames_written += written;
+ samplecnt_t const written = write (c.data(), c.samples());
+ samples_written += written;
- if (throw_level (ThrowProcess) && written != c.frames()) {
+ if (throw_level (ThrowProcess) && written != c.samples()) {
throw Exception (*this, boost::str (boost::format
("Could not write data to output file (%1%)")
% strError()));
@@ -84,13 +84,13 @@ class SndfileWriter
virtual void init()
{
- frames_written = 0;
+ samples_written = 0;
add_supported_flag (ProcessContext<T>::EndOfInput);
}
protected:
std::string path;
- framecnt_t frames_written;
+ samplecnt_t samples_written;
private:
SndfileWriter (SndfileWriter const & other) {}
diff --git a/libs/audiographer/audiographer/sndfile/tmp_file_rt.h b/libs/audiographer/audiographer/sndfile/tmp_file_rt.h
index 4207d3da75..1e2786252b 100644
--- a/libs/audiographer/audiographer/sndfile/tmp_file_rt.h
+++ b/libs/audiographer/audiographer/sndfile/tmp_file_rt.h
@@ -17,7 +17,7 @@
namespace AudioGrapher
{
- static const framecnt_t rb_chunksize = 8192; // samples
+ static const samplecnt_t rb_chunksize = 8192; // samples
/** A temporary file deleted after this class is destructed
* with realtime safe background thread writer.
@@ -29,7 +29,7 @@ class TmpFileRt
public:
/// \a filename_template must match the requirements for mkstemp, i.e. end in "XXXXXX"
- TmpFileRt (char * filename_template, int format, ChannelCount channels, framecnt_t samplerate)
+ TmpFileRt (char * filename_template, int format, ChannelCount channels, samplecnt_t samplerate)
: SndfileHandle (g_mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
, filename (filename_template)
, _chunksize (rb_chunksize * channels)
@@ -65,13 +65,13 @@ class TmpFileRt
% c.channels() % SndfileHandle::channels()));
}
- if (SndfileWriter<T>::throw_level (ThrowProcess) && _rb.write_space() < c.frames()) {
+ if (SndfileWriter<T>::throw_level (ThrowProcess) && _rb.write_space() < c.samples()) {
throw Exception (*this, boost::str (boost::format
("Could not write data to ringbuffer/output file (%1%)")
% SndfileHandle::strError()));
}
- _rb.write (c.data(), c.frames());
+ _rb.write (c.data(), c.samples());
if (c.has_flag(ProcessContext<T>::EndOfInput)) {
_capture = false;
@@ -93,11 +93,11 @@ class TmpFileRt
pthread_mutex_lock (&_disk_thread_lock);
while (_capture) {
- if ((framecnt_t)_rb.read_space () >= _chunksize) {
+ if ((samplecnt_t)_rb.read_space () >= _chunksize) {
_rb.read (framebuf, _chunksize);
- framecnt_t const written = SndfileBase::write (framebuf, _chunksize);
+ samplecnt_t const written = SndfileBase::write (framebuf, _chunksize);
assert (written == _chunksize);
- SndfileWriter<T>::frames_written += written;
+ SndfileWriter<T>::samples_written += written;
}
if (!_capture) {
break;
@@ -107,10 +107,10 @@ class TmpFileRt
// flush ringbuffer
while (_rb.read_space () > 0) {
- size_t remain = std::min ((framecnt_t)_rb.read_space (), _chunksize);
+ size_t remain = std::min ((samplecnt_t)_rb.read_space (), _chunksize);
_rb.read (framebuf, remain);
- framecnt_t const written = SndfileBase::write (framebuf, remain);
- SndfileWriter<T>::frames_written += written;
+ samplecnt_t const written = SndfileBase::write (framebuf, remain);
+ SndfileWriter<T>::samples_written += written;
}
SndfileWriter<T>::writeSync();
@@ -123,7 +123,7 @@ class TmpFileRt
std::string filename;
bool _capture;
- framecnt_t _chunksize;
+ samplecnt_t _chunksize;
PBD::RingBuffer<T> _rb;
pthread_mutex_t _disk_thread_lock;
@@ -148,7 +148,7 @@ class TmpFileRt
void init()
{
- SndfileWriter<T>::frames_written = 0;
+ SndfileWriter<T>::samples_written = 0;
_capture = true;
SndfileWriter<T>::add_supported_flag (ProcessContext<T>::EndOfInput);
pthread_mutex_init (&_disk_thread_lock, 0);
diff --git a/libs/audiographer/audiographer/sndfile/tmp_file_sync.h b/libs/audiographer/audiographer/sndfile/tmp_file_sync.h
index 7807346935..8eab56a3a6 100644
--- a/libs/audiographer/audiographer/sndfile/tmp_file_sync.h
+++ b/libs/audiographer/audiographer/sndfile/tmp_file_sync.h
@@ -22,12 +22,12 @@ class TmpFileSync
public:
/// \a filename_template must match the requirements for mkstemp, i.e. end in "XXXXXX"
- TmpFileSync (char * filename_template, int format, ChannelCount channels, framecnt_t samplerate)
+ TmpFileSync (char * filename_template, int format, ChannelCount channels, samplecnt_t samplerate)
: SndfileHandle (g_mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
, filename (filename_template)
{}
- TmpFileSync (int format, ChannelCount channels, framecnt_t samplerate)
+ TmpFileSync (int format, ChannelCount channels, samplecnt_t samplerate)
: SndfileHandle (fileno (tmpfile()), true, SndfileBase::ReadWrite, format, channels, samplerate)
{}
diff --git a/libs/audiographer/audiographer/type_utils.h b/libs/audiographer/audiographer/type_utils.h
index 4e12937165..c16b0f942a 100644
--- a/libs/audiographer/audiographer/type_utils.h
+++ b/libs/audiographer/audiographer/type_utils.h
@@ -19,12 +19,12 @@ class LIBAUDIOGRAPHER_API TypeUtilsBase
protected:
template<typename T, 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()); }
+ static void do_zero_fill(T * buffer, samplecnt_t samples, const boost::integral_constant<bool, b>&)
+ { std::uninitialized_fill_n (buffer, samples, T()); }
template<typename T>
- static void do_zero_fill(T * buffer, framecnt_t frames, const boost::true_type&)
- { memset (buffer, 0, frames * sizeof(T)); }
+ static void do_zero_fill(T * buffer, samplecnt_t samples, const boost::true_type&)
+ { memset (buffer, 0, samples * sizeof(T)); }
};
/// Utilities for initializing, copying, moving, etc. data
@@ -42,26 +42,26 @@ class /*LIBAUDIOGRAPHER_API*/ TypeUtils : private TypeUtilsBase
* if T is not a floating point or signed integer type
* \n RT safe
*/
- inline static void zero_fill (T * buffer, framecnt_t frames)
- { do_zero_fill(buffer, frames, zero_fillable()); }
+ inline static void zero_fill (T * buffer, samplecnt_t samples)
+ { do_zero_fill(buffer, samples, zero_fillable()); }
- /** Copies \a frames frames of data from \a source to \a destination
+ /** Copies \a samples 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, framecnt_t frames)
- { std::uninitialized_copy (source, &source[frames], destination); }
+ inline static void copy (T const * source, T * destination, samplecnt_t samples)
+ { std::uninitialized_copy (source, &source[samples], destination); }
- /** Moves \a frames frames of data from \a source to \a destination
+ /** Moves \a samples 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, framecnt_t frames)
+ inline static void move (T const * source, T * destination, samplecnt_t samples)
{
if (destination < source) {
- std::copy (source, &source[frames], destination);
+ std::copy (source, &source[samples], destination);
} else if (destination > source) {
- std::copy_backward (source, &source[frames], destination + frames);
+ std::copy_backward (source, &source[samples], destination + samples);
}
}
};
diff --git a/libs/audiographer/audiographer/types.h b/libs/audiographer/audiographer/types.h
index 1ecf6360a0..faa3ad4f31 100644
--- a/libs/audiographer/audiographer/types.h
+++ b/libs/audiographer/audiographer/types.h
@@ -8,7 +8,7 @@
namespace AudioGrapher {
/* XXX: copied from libardour */
-typedef int64_t framecnt_t;
+typedef int64_t samplecnt_t;
typedef uint8_t ChannelCount;