foobar2000 SDK  2015-08-03
Public Member Functions | Protected Member Functions
dsp_chunk_listabstract

#include <dsp.h>

+ Inheritance diagram for dsp_chunk_list:

Public Member Functions

void add_chunk (const audio_chunk *chunk)
 
audio_chunkadd_item (t_size hint_size=0)
 
virtual t_size get_count () const =0
 
double get_duration ()
 
virtual audio_chunkget_item (t_size n) const =0
 
virtual audio_chunkinsert_item (t_size idx, t_size hint_size=0)=0
 
void remove_all ()
 
void remove_bad_chunks ()
 
virtual void remove_by_idx (t_size idx)=0
 
virtual void remove_mask (const bit_array &mask)=0
 

Protected Member Functions

 dsp_chunk_list ()
 
 ~dsp_chunk_list ()
 

Detailed Description

Interface to a DSP chunk list. A DSP chunk list object is passed to the DSP chain each time, since DSPs are allowed to remove processed chunks or insert new ones.

Definition at line 2 of file dsp.h.

Constructor & Destructor Documentation

dsp_chunk_list::dsp_chunk_list ( )
inlineprotected

Definition at line 28 of file dsp.h.

28 {}
dsp_chunk_list::~dsp_chunk_list ( )
inlineprotected

Definition at line 29 of file dsp.h.

29 {}

Member Function Documentation

void dsp_chunk_list::add_chunk ( const audio_chunk chunk)
inline

Definition at line 21 of file dsp.h.

21  {
22  audio_chunk * dst = insert_item(get_count(),chunk->get_used_size());
23  if (dst) dst->copy(*chunk);
24  }
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
Definition: audio_chunk.h:5
virtual audio_chunk * insert_item(t_size idx, t_size hint_size=0)=0
virtual t_size get_count() const =0
void copy(const audio_chunk &p_source)
Helper; copies content of another audio chunk to this chunk.
Definition: audio_chunk.h:212
size_t get_used_size() const
Returns actual amount of audio data contained in the buffer (sample count * channel count)...
Definition: audio_chunk.h:134
audio_chunk* dsp_chunk_list::add_item ( t_size  hint_size = 0)
inline

Definition at line 10 of file dsp.h.

10 {return insert_item(get_count(),hint_size);}
virtual audio_chunk * insert_item(t_size idx, t_size hint_size=0)=0
virtual t_size get_count() const =0
virtual t_size dsp_chunk_list::get_count ( ) const
pure virtual

Implemented in dsp_chunk_list_impl.

double dsp_chunk_list::get_duration ( )
inline

Definition at line 14 of file dsp.h.

14  {
15  double rv = 0;
16  t_size n,m = get_count();
17  for(n=0;n<m;n++) rv += get_item(n)->get_duration();
18  return rv;
19  }
virtual audio_chunk * get_item(t_size n) const =0
virtual t_size get_count() const =0
size_t t_size
Definition: int_types.h:48
double get_duration() const
Retrieves duration of contained audio data, in seconds.
Definition: audio_chunk.h:116
virtual audio_chunk* dsp_chunk_list::get_item ( t_size  n) const
pure virtual

Implemented in dsp_chunk_list_impl.

virtual audio_chunk* dsp_chunk_list::insert_item ( t_size  idx,
t_size  hint_size = 0 
)
pure virtual

Implemented in dsp_chunk_list_impl.

void dsp_chunk_list::remove_all ( )
inline

Definition at line 12 of file dsp.h.

virtual void remove_mask(const bit_array &mask)=0
void dsp_chunk_list::remove_bad_chunks ( )

Definition at line 60 of file dsp.cpp.

61 {
62  bool blah = false;
63  t_size idx;
64  for(idx=0;idx<get_count();)
65  {
66  audio_chunk * chunk = get_item(idx);
67  if (!chunk->is_valid())
68  {
69  chunk->reset();
70  remove_by_idx(idx);
71  blah = true;
72  }
73  else idx++;
74  }
75  if (blah) console::info("one or more bad chunks removed from dsp chunk list");
76 }
virtual audio_chunk * get_item(t_size n) const =0
void reset()
Resets all audio_chunk data.
Definition: audio_chunk.h:140
void info(const char *p_message)
Definition: console.cpp:4
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
Definition: audio_chunk.h:5
virtual t_size get_count() const =0
size_t t_size
Definition: int_types.h:48
virtual void remove_by_idx(t_size idx)=0
bool is_valid() const
Returns whether the chunk contents are valid (for bug check purposes).
virtual void dsp_chunk_list::remove_by_idx ( t_size  idx)
pure virtual

Implemented in dsp_chunk_list_impl.

virtual void dsp_chunk_list::remove_mask ( const bit_array mask)
pure virtual

Implemented in dsp_chunk_list_impl.


The documentation for this class was generated from the following files: