summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/general
diff options
context:
space:
mode:
Diffstat (limited to 'libs/audiographer/audiographer/general')
-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
7 files changed, 49 insertions, 49 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;