foobar2000 SDK  2015-01-14
dsp.h
Go to the documentation of this file.
1 class NOVTABLE dsp_chunk_list {
3 public:
4  virtual t_size get_count() const = 0;
5  virtual audio_chunk * get_item(t_size n) const = 0;
6  virtual void remove_by_idx(t_size idx) = 0;
7  virtual void remove_mask(const bit_array & mask) = 0;
8  virtual audio_chunk * insert_item(t_size idx,t_size hint_size=0) = 0;
9 
10  audio_chunk * add_item(t_size hint_size=0) {return insert_item(get_count(),hint_size);}
11 
12  void remove_all() {remove_mask(bit_array_true());}
13 
14  double get_duration() {
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  }
20 
21  void add_chunk(const audio_chunk * chunk) {
22  audio_chunk * dst = insert_item(get_count(),chunk->get_used_size());
23  if (dst) dst->copy(*chunk);
24  }
25 
26  void remove_bad_chunks();
27 protected:
30 };
31 
32 class dsp_chunk_list_impl : public dsp_chunk_list//implementation
33 {
35 public:
36  t_size get_count() const;
37  audio_chunk * get_item(t_size n) const;
38  void remove_by_idx(t_size idx);
39  void remove_mask(const bit_array & mask);
40  audio_chunk * insert_item(t_size idx,t_size hint_size=0);
41 };
42 
46 class NOVTABLE dsp : public service_base {
47 public:
48  enum {
50  END_OF_TRACK = 1,
52  FLUSH = 2
53  };
54 
58  virtual void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags)=0;
59 
61  virtual void flush() = 0;
62 
65  virtual double get_latency() = 0;
69  virtual bool need_track_change_mark() = 0;
70 
71  void run_abortable(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort);
72 
73  FB2K_MAKE_SERVICE_INTERFACE(dsp,service_base);
74 };
75 
77 class NOVTABLE dsp_v2 : public dsp {
78 public:
80  virtual void run_v2(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) = 0;
81 private:
82  void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags) {
83  run_v2(p_chunk_list,p_cur_file,p_flags,abort_callback_dummy());
84  }
85 
87 };
88 
99 template<class t_baseclass>
100 class dsp_impl_base_t : public t_baseclass {
101 private:
106  void run_v2(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort);
107 protected:
110  bool get_cur_file(metadb_handle_ptr & p_out) {p_out = m_cur_file; return p_out.is_valid();}
111 
112  dsp_impl_base_t() : m_list(NULL), m_cur_file(NULL), m_chunk_ptr(0) {}
113 
118  audio_chunk * insert_chunk(t_size p_hint_size = 0) {
119  PFC_ASSERT(m_list != NULL);
120  return m_list->insert_item(m_chunk_ptr++,p_hint_size);
121  }
122  audio_chunk * insert_chunk( const audio_chunk & sourceCopy ) {
123  audio_chunk * c = insert_chunk( sourceCopy.get_used_size() );
124  c->copy( sourceCopy );
125  return c;
126  }
127 
128 
132  virtual void on_endoftrack(abort_callback & p_abort) = 0;
138  virtual void on_endofplayback(abort_callback & p_abort) = 0;
144  virtual bool on_chunk(audio_chunk * p_chunk,abort_callback & p_abort) = 0;
145 
146 public:
150  virtual void flush() = 0;
154  virtual double get_latency() = 0;
159  virtual bool need_track_change_mark() = 0;
160 private:
161  dsp_impl_base_t(const t_self&);
162  const t_self & operator=(const t_self &);
163 };
164 
165 template<class t_baseclass>
166 void dsp_impl_base_t<t_baseclass>::run_v2(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) {
167  pfc::vartoggle_t<dsp_chunk_list*> l_list_toggle(m_list,p_list);
168  pfc::vartoggle_t<metadb_handle*> l_cur_file_toggle(m_cur_file,p_cur_file.get_ptr());
169 
170  for(m_chunk_ptr = 0;m_chunk_ptr<m_list->get_count();m_chunk_ptr++) {
171  audio_chunk * c = m_list->get_item(m_chunk_ptr);
172  if (c->is_empty() || !on_chunk(c,p_abort))
173  m_list->remove_by_idx(m_chunk_ptr--);
174  }
175 
176  if (p_flags & dsp::FLUSH) {
177  on_endofplayback(p_abort);
178  } else if (p_flags & dsp::END_OF_TRACK) {
179  if (need_track_change_mark()) on_endoftrack(p_abort);
180  }
181 }
182 
183 
185 
186 class NOVTABLE dsp_preset {
187 public:
188  virtual GUID get_owner() const = 0;
189  virtual void set_owner(const GUID & p_owner) = 0;
190  virtual const void * get_data() const = 0;
191  virtual t_size get_data_size() const = 0;
192  virtual void set_data(const void * p_data,t_size p_data_size) = 0;
193  virtual void set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) = 0;
194 
195  const dsp_preset & operator=(const dsp_preset & p_source) {copy(p_source); return *this;}
196 
197  void copy(const dsp_preset & p_source) {set_owner(p_source.get_owner());set_data(p_source.get_data(),p_source.get_data_size());}
198 
199  void contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const;
200  void contents_from_stream(stream_reader * p_stream,abort_callback & p_abort);
201  static void g_contents_from_stream_skip(stream_reader * p_stream,abort_callback & p_abort);
202 
203  bool operator==(const dsp_preset & p_other) const {
204  if (get_owner() != p_other.get_owner()) return false;
205  if (get_data_size() != p_other.get_data_size()) return false;
206  if (memcmp(get_data(),p_other.get_data(),get_data_size()) != 0) return false;
207  return true;
208  }
209  bool operator!=(const dsp_preset & p_other) const {
210  return !(*this == p_other);
211  }
212 protected:
215 };
216 
218 public:
219  void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
220  p_abort.check();
221  m_data.append_fromptr((const t_uint8 *) p_buffer,p_bytes);
222  }
223  void flush(dsp_preset & p_preset) {
224  p_preset.set_data(m_data.get_ptr(),m_data.get_size());
225  m_data.set_size(0);
226  }
227 private:
229 };
230 
232 public:
234  dsp_preset_reader(const dsp_preset_reader & p_source) : m_walk(0) {*this = p_source;}
235  void init(const dsp_preset & p_preset) {
236  m_data.set_data_fromptr( (const t_uint8*) p_preset.get_data(), p_preset.get_data_size() );
237  m_walk = 0;
238  }
239  t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
240  p_abort.check();
241  t_size todo = pfc::min_t<t_size>(p_bytes,m_data.get_size()-m_walk);
242  memcpy(p_buffer,m_data.get_ptr()+m_walk,todo);
243  m_walk += todo;
244  return todo;
245  }
246  bool is_finished() {return m_walk == m_data.get_size();}
247 private:
250 };
251 
253 {
254 public:
256  dsp_preset_impl(const dsp_preset_impl & p_source) {copy(p_source);}
257  dsp_preset_impl(const dsp_preset & p_source) {copy(p_source);}
258 
259  const dsp_preset_impl& operator=(const dsp_preset_impl & p_source) {copy(p_source); return *this;}
260  const dsp_preset_impl& operator=(const dsp_preset & p_source) {copy(p_source); return *this;}
261 
262  GUID get_owner() const {return m_owner;}
263  void set_owner(const GUID & p_owner) {m_owner = p_owner;}
264  const void * get_data() const {return m_data.get_ptr();}
265  t_size get_data_size() const {return m_data.get_size();}
266  void set_data(const void * p_data,t_size p_data_size) {m_data.set_data_fromptr((const t_uint8*)p_data,p_data_size);}
267  void set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort);
268 private:
271 };
272 
273 class NOVTABLE dsp_preset_edit_callback {
274 public:
275  virtual void on_preset_changed(const dsp_preset &) = 0;
276 private:
277  dsp_preset_edit_callback(const dsp_preset_edit_callback&) {throw pfc::exception_not_implemented();}
278  const dsp_preset_edit_callback & operator=(const dsp_preset_edit_callback &) {throw pfc::exception_not_implemented();}
279 protected:
282 };
283 
284 class NOVTABLE dsp_entry : public service_base {
285 public:
286  virtual void get_name(pfc::string_base & p_out) = 0;
287  virtual bool get_default_preset(dsp_preset & p_out) = 0;
288  virtual bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) = 0;
289  virtual GUID get_guid() = 0;
290  virtual bool have_config_popup() = 0;
291  virtual bool show_config_popup(dsp_preset & p_data,HWND p_parent) = 0;
292 
293 
294  static bool g_get_interface(service_ptr_t<dsp_entry> & p_out,const GUID & p_guid);
295  static bool g_instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset);
296  static bool g_instantiate_default(service_ptr_t<dsp> & p_out,const GUID & p_guid);
297  static bool g_name_from_guid(pfc::string_base & p_out,const GUID & p_guid);
298  static bool g_dsp_exists(const GUID & p_guid);
299  static bool g_get_default_preset(dsp_preset & p_out,const GUID & p_guid);
300  static bool g_have_config_popup(const GUID & p_guid);
301  static bool g_have_config_popup(const dsp_preset & p_preset);
302  static bool g_show_config_popup(dsp_preset & p_preset,HWND p_parent);
303 
304  static void g_show_config_popup_v2(const dsp_preset & p_preset,HWND p_parent,dsp_preset_edit_callback & p_callback);
305 
306  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(dsp_entry);
307 };
308 
309 class NOVTABLE dsp_entry_v2 : public dsp_entry {
310 public:
311  virtual void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) = 0;
312 
313 private:
314  bool show_config_popup(dsp_preset & p_data,HWND p_parent);
315 
316  FB2K_MAKE_SERVICE_INTERFACE(dsp_entry_v2,dsp_entry);
317 };
318 
319 template<class T,class t_entry = dsp_entry>
320 class dsp_entry_impl_nopreset_t : public t_entry {
321 public:
322  void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
324  {
325  p_out.set_owner(T::g_get_guid());
326  p_out.set_data(0,0);
327  return true;
328  }
329  bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset)
330  {
331  if (p_preset.get_owner() == T::g_get_guid() && p_preset.get_data_size() == 0)
332  {
333  p_out = new service_impl_t<T>();
334  return p_out.is_valid();
335  }
336  else return false;
337  }
338  GUID get_guid() {return T::g_get_guid();}
339 
340  bool have_config_popup() {return false;}
341  bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return false;}
342 };
343 
344 template<class T, class t_entry = dsp_entry_v2>
345 class dsp_entry_impl_t : public t_entry {
346 public:
347  void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
348  bool get_default_preset(dsp_preset & p_out) {return T::g_get_default_preset(p_out);}
349  bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) {
350  if (p_preset.get_owner() == T::g_get_guid()) {
351  p_out = new service_impl_t<T>(p_preset);
352  return true;
353  }
354  else return false;
355  }
356  GUID get_guid() {return T::g_get_guid();}
357 
358  bool have_config_popup() {return T::g_have_config_popup();}
359  bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return T::g_show_config_popup(p_data,p_parent);}
360  //void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) {T::g_show_config_popup(p_data,p_parent,p_callback);}
361 };
362 
363 template<class T, class t_entry = dsp_entry_v2>
364 class dsp_entry_v2_impl_t : public t_entry {
365 public:
366  void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
367  bool get_default_preset(dsp_preset & p_out) {return T::g_get_default_preset(p_out);}
368  bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) {
369  if (p_preset.get_owner() == T::g_get_guid()) {
370  p_out = new service_impl_t<T>(p_preset);
371  return true;
372  }
373  else return false;
374  }
375  GUID get_guid() {return T::g_get_guid();}
376 
377  bool have_config_popup() {return T::g_have_config_popup();}
378  //bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return T::g_show_config_popup(p_data,p_parent);}
379  void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) {T::g_show_config_popup(p_data,p_parent,p_callback);}
380 };
381 
382 
383 template<class T>
384 class dsp_factory_nopreset_t : public service_factory_single_t<dsp_entry_impl_nopreset_t<T> > {};
385 
386 template<class T>
387 class dsp_factory_t : public service_factory_single_t<dsp_entry_v2_impl_t<T> > {};
388 
389 class NOVTABLE dsp_chain_config
390 {
391 public:
392  virtual t_size get_count() const = 0;
393  virtual const dsp_preset & get_item(t_size p_index) const = 0;
394  virtual void replace_item(const dsp_preset & p_data,t_size p_index) = 0;
395  virtual void insert_item(const dsp_preset & p_data,t_size p_index) = 0;
396  virtual void remove_mask(const bit_array & p_mask) = 0;
397 
398  void remove_item(t_size p_index);
399  void remove_all();
400  void add_item(const dsp_preset & p_data);
401  void copy(const dsp_chain_config & p_source);
402 
403  const dsp_chain_config & operator=(const dsp_chain_config & p_source) {copy(p_source); return *this;}
404 
405  void contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const;
406  void contents_from_stream(stream_reader * p_stream,abort_callback & p_abort);
407 
408  void instantiate(service_list_t<dsp> & p_out);
409 
410  void get_name_list(pfc::string_base & p_out) const;
411 
412  static bool equals(dsp_chain_config const & v1, dsp_chain_config const & v2);
413 
414  bool operator==(const dsp_chain_config & other) const {return equals(*this, other);}
415  bool operator!=(const dsp_chain_config & other) const {return !equals(*this, other);}
416 };
417 
419  value.contents_from_stream(&stream.m_stream, stream.m_abort); return stream;
420 }
421 
423  value.contents_to_stream(&stream.m_stream, stream.m_abort); return stream;
424 }
425 
427 {
428 public:
430  dsp_chain_config_impl(const dsp_chain_config & p_source) {copy(p_source);}
431  dsp_chain_config_impl(const dsp_chain_config_impl & p_source) {copy(p_source);}
432  t_size get_count() const;
433  const dsp_preset & get_item(t_size p_index) const;
434  void replace_item(const dsp_preset & p_data,t_size p_index);
435  void insert_item(const dsp_preset & p_data,t_size p_index);
436  void remove_mask(const bit_array & p_mask);
437 
438  const dsp_chain_config_impl & operator=(const dsp_chain_config & p_source) {copy(p_source); return *this;}
439  const dsp_chain_config_impl & operator=(const dsp_chain_config_impl & p_source) {copy(p_source); return *this;}
440 
442 private:
444 };
445 
447 protected:
448  void get_data_raw(stream_writer * p_stream,abort_callback & p_abort);
449  void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort);
450 public:
451  void reset();
452  inline cfg_dsp_chain_config(const GUID & p_guid) : cfg_var(p_guid) {}
453  t_size get_count() const {return m_data.get_count();}
454  const dsp_preset & get_item(t_size p_index) const {return m_data.get_item(p_index);}
455  bool get_data(dsp_chain_config & p_data) const;
456  void set_data(const dsp_chain_config & p_data);
457 private:
459 
460 };
461 
462 
463 
464 
467 public:
468  dsp_preset_parser(const dsp_preset & in) : m_data(in), _m_stream(in.get_data(),in.get_data_size()), stream_reader_formatter(_m_stream,_m_abort) {}
469 
470  void reset() {_m_stream.reset();}
472 
473  void assume_empty() const {
474  if (get_remaining() != 0) throw exception_io_data();
475  }
476 
477  GUID get_owner() const {return m_data.get_owner();}
478 private:
482 };
483 
486 public:
488  void finish(const GUID & id, dsp_preset & out) {
489  out.set_owner(id);
491  }
492  void reset() {
494  }
495 private:
498 };
void copy(const dsp_preset &p_source)
Definition: dsp.h:197
metadb_handle * m_cur_file
Definition: dsp.h:105
t_size read(void *p_buffer, t_size p_bytes, abort_callback &p_abort)
Definition: dsp.h:239
virtual bool need_track_change_mark()=0
To be overridden by a DSP implementation. Returns true if DSP needs to know exact track change point ...
dsp_impl_base_t()
Definition: dsp.h:112
Definition: dsp.h:320
void init(const dsp_preset &p_preset)
Definition: dsp.h:235
void remove_all()
Definition: dsp.h:12
const t_item * get_ptr() const
Definition: array.h:213
uint8_t t_uint8
Definition: int_types.h:9
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
Definition: service_impl.h:4
t_size get_count() const
Definition: dsp.h:453
Interface to a DSP chunk list. A DSP chunk list object is passed to the DSP chain each time...
Definition: dsp.h:2
virtual void set_owner(const GUID &p_owner)=0
virtual bool on_chunk(audio_chunk *p_chunk, abort_callback &p_abort)=0
To be overridden by a DSP implementation. Processes a chunk of audio data. You can call insert_chunk(...
Definition: dsp.h:364
virtual void on_endofplayback(abort_callback &p_abort)=0
To be overridden by a DSP implementation. Called at the end of played stream, typically at the end of...
bool have_config_popup()
Definition: dsp.h:358
void reset()
Definition: dsp.h:492
Definition: pfc.h:53
stream_reader_memblock_ref _m_stream
Definition: dsp.h:481
bool have_config_popup()
Definition: dsp.h:377
GUID get_owner() const
Definition: dsp.h:262
T * get_ptr() const
Definition: service.h:117
void show_config_popup_v2(const dsp_preset &p_data, HWND p_parent, dsp_preset_edit_callback &p_callback)
Definition: dsp.h:379
Flush everything.
Definition: dsp.h:52
bool operator!=(const dsp_preset &p_other) const
Definition: dsp.h:209
unsigned insert_item(HWND p_listview, unsigned p_index, const char *p_name, LPARAM p_param)
Definition: dsp.h:284
abort_callback_impl abort_callback_dummy
void add_chunk(const audio_chunk *chunk)
Definition: dsp.h:21
dsp_chunk_list * m_list
Definition: dsp.h:103
dsp_chunk_list()
Definition: dsp.h:28
void get_name(pfc::string_base &p_out)
Definition: dsp.h:322
dsp_chain_config_impl(const dsp_chain_config &p_source)
Definition: dsp.h:430
void run_v2(dsp_chunk_list *p_list, const metadb_handle_ptr &p_cur_file, int p_flags, abort_callback &p_abort)
Definition: dsp.h:166
abort_callback_dummy _m_abort
Definition: dsp.h:496
t_size get_data_size() const
Definition: dsp.h:265
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
Definition: bit_array.h:6
void set_data(const dsp_chain_config &p_data)
Definition: dsp.cpp:145
pfc::list_t< pfc::rcptr_t< audio_chunk > > m_data
Definition: dsp.h:34
double get_duration()
Definition: dsp.h:14
void insert_item(const dsp_preset &p_data, t_size p_index)
Definition: dsp.cpp:203
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
Definition: audio_chunk.h:5
FB2K_STREAM_READER_OVERLOAD(dsp_chain_config)
Definition: dsp.h:418
virtual const void * get_data() const =0
Definition: dsp.h:345
void get_name(pfc::string_base &p_out)
Definition: dsp.h:366
dsp_impl_base_t< dsp_v2 > dsp_impl_base
Definition: dsp.h:184
pfc::array_t< t_uint8 > m_data
Definition: dsp.h:249
pfc::list_t< pfc::rcptr_t< audio_chunk > > m_recycled
Definition: dsp.h:34
virtual audio_chunk * insert_item(t_size idx, t_size hint_size=0)=0
void reset()
Definition: dsp.h:470
bool instantiate(service_ptr_t< dsp > &p_out, const dsp_preset &p_preset)
Definition: dsp.h:349
void replace_item(const dsp_preset &p_data, t_size p_index)
Definition: dsp.cpp:198
A metadb_handle object represents interface to reference-counted file_info cache entry for the specif...
Definition: metadb_handle.h:19
void write(const void *p_buffer, t_size p_bytes, abort_callback &p_abort)
Definition: dsp.h:219
virtual void on_endoftrack(abort_callback &p_abort)=0
To be overridden by a DSP implementation. Called on track change. You can use insert_chunk() to dump ...
bool show_config_popup(dsp_preset &p_data, HWND p_parent)
Definition: dsp.h:359
virtual void flush()=0
To be overridden by a DSP implementation. Flushes the DSP (drops any buffered data). The implementation should reset the DSP to the same state it was in before receiving any audio data. Called after seeking, etc.
void remove_mask(const bit_array &mask)
Definition: dsp.cpp:14
dsp_chain_config_impl(const dsp_chain_config_impl &p_source)
Definition: dsp.h:431
const dsp_preset & operator=(const dsp_preset &p_source)
Definition: dsp.h:195
~dsp_preset()
Definition: dsp.h:214
GUID get_guid()
Definition: dsp.h:375
const dsp_preset & m_data
Definition: dsp.h:479
FB2K_STREAM_WRITER_OVERLOAD(dsp_chain_config)
Definition: dsp.h:422
const dsp_preset & get_item(t_size p_index) const
Definition: dsp.h:454
bool is_valid() const
Definition: service.h:119
bool get_default_preset(dsp_preset &p_out)
Definition: dsp.h:348
abort_callback_dummy _m_abort
Definition: dsp.h:480
GUID get_owner() const
Definition: dsp.h:477
bool get_default_preset(dsp_preset &p_out)
Definition: dsp.h:367
void copy(const audio_chunk &p_source)
Helper; copies content of another audio chunk to this chunk.
Definition: audio_chunk.h:212
const dsp_preset_impl & operator=(const dsp_preset_impl &p_source)
Definition: dsp.h:259
t_size get_count() const
Definition: dsp.cpp:4
FB2K_MAKE_SERVICE_INTERFACE(dsp, service_base)
void assume_empty() const
Definition: dsp.h:473
Flush whatever you need to when tracks change.
Definition: dsp.h:50
Backwards-compatible extension to dsp interface, allows abortable operation. Introduced in 0...
Definition: dsp.h:77
bool is_finished()
Definition: dsp.h:246
dsp_impl_base_t< t_baseclass > t_self
Definition: dsp.h:102
audio_chunk * get_item(t_size n) const
Definition: dsp.cpp:6
dsp_preset_reader()
Definition: dsp.h:233
dsp_preset_parser(const dsp_preset &in)
Definition: dsp.h:468
dsp_chain_config_impl m_data
Definition: dsp.h:458
dsp_preset()
Definition: dsp.h:213
bool get_default_preset(dsp_preset &p_out)
Definition: dsp.h:323
size_t t_size
Definition: int_types.h:48
const dsp_preset_impl & operator=(const dsp_preset &p_source)
Definition: dsp.h:260
void set_data(const void *p_data, t_size p_data_size)
Definition: dsp.h:266
void set_data_from_stream(stream_reader *p_stream, t_size p_bytes, abort_callback &p_abort)
Definition: dsp.cpp:246
void set_size(t_size p_size)
Definition: array.h:104
virtual bool show_config_popup(dsp_preset &p_data, HWND p_parent)=0
virtual t_size get_data_size() const =0
Helper.
Definition: dsp.h:466
Helper.
Definition: dsp.h:485
audio_chunk * insert_item(t_size idx, t_size hint_size=0)
Definition: dsp.cpp:23
void get_name(pfc::string_base &p_out)
Definition: dsp.h:347
audio_chunk * add_item(t_size hint_size=0)
Definition: dsp.h:10
void run(dsp_chunk_list *p_chunk_list, const metadb_handle_ptr &p_cur_file, int p_flags)
Definition: dsp.h:82
virtual void set_data(const void *p_data, t_size p_data_size)=0
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
Instance of a DSP. Implementation: Derive from dsp_impl_base instead of deriving from dsp directly...
Definition: dsp.h:46
void append_fromptr(const t_append *p_buffer, t_size p_count)
Warning: buffer pointer must not point to buffer allocated by this array (fixme). ...
Definition: array.h:167
~dsp_chunk_list()
Definition: dsp.h:29
Definition: dsp.h:309
bool instantiate(service_ptr_t< dsp > &p_out, const dsp_preset &p_preset)
Definition: dsp.h:368
pfc::array_t< t_uint8 > m_data
Definition: dsp.h:270
dsp_preset_impl(const dsp_preset_impl &p_source)
Definition: dsp.h:256
void set_owner(const GUID &p_owner)
Definition: dsp.h:263
t_size m_chunk_ptr
Definition: dsp.h:104
virtual GUID get_owner() const =0
void flush(dsp_preset &p_preset)
Definition: dsp.h:223
void set_data_fromptr(const t_source *p_buffer, t_size p_count)
Warning: buffer pointer must not point to buffer allocated by this array (fixme). ...
Definition: array.h:139
GUID get_guid()
Definition: dsp.h:338
void finish(const GUID &id, dsp_preset &out)
Definition: dsp.h:488
void remove_by_idx(t_size idx)
Definition: dsp.cpp:8
dsp_preset_edit_callback(const dsp_preset_edit_callback &)
Definition: dsp.h:277
dsp_preset_reader(const dsp_preset_reader &p_source)
Definition: dsp.h:234
cfg_dsp_chain_config(const GUID &p_guid)
Definition: dsp.h:452
void remove_mask(const bit_array &p_mask)
Definition: dsp.cpp:208
bool get_cur_file(metadb_handle_ptr &p_out)
Call only from on_chunk / on_endoftrack (on_endoftrack will give info on track being finished)...
Definition: dsp.h:110
bool instantiate(service_ptr_t< dsp > &p_out, const dsp_preset &p_preset)
Definition: dsp.h:329
t_size m_walk
Definition: dsp.h:248
audio_chunk * insert_chunk(t_size p_hint_size=0)
Inserts a new chunk of audio data. You can call this only from on_chunk(), on_endofplayback() and on...
Definition: dsp.h:118
dsp_preset_builder()
Definition: dsp.h:487
pfc::ptr_list_t< dsp_preset_impl > m_data
Definition: dsp.h:443
bool get_data(dsp_chain_config &p_data) const
Definition: dsp.cpp:140
stream_writer_buffer_simple _m_stream
Definition: dsp.h:497
const dsp_chain_config_impl & operator=(const dsp_chain_config &p_source)
Definition: dsp.h:438
void copy(const dsp_chain_config &p_source)
Definition: dsp.cpp:251
t_size get_count() const
Definition: dsp.cpp:188
const t_self & operator=(const t_self &)
bool is_empty() const
Returns whether the chunk is empty (contains no audio data).
Definition: audio_chunk.h:125
const dsp_preset & get_item(t_size p_index) const
Definition: dsp.cpp:193
dsp_preset_impl(const dsp_preset &p_source)
Definition: dsp.h:257
GUID get_guid()
Definition: dsp.h:356
bool operator!=(const dsp_chain_config &other) const
Definition: dsp.h:415
t_size get_remaining() const
Definition: dsp.h:471
bool operator==(const dsp_preset &p_other) const
Definition: dsp.h:203
Base class for configuration variable classes; provides self-registration mechaisms and methods to se...
Definition: cfg_var.h:54
t_size get_size() const
Definition: array.h:130
pfc::array_t< t_uint8, pfc::alloc_fast_aggressive > m_data
Definition: dsp.h:228
GUID m_owner
Definition: dsp.h:269
audio_chunk * insert_chunk(const audio_chunk &sourceCopy)
Definition: dsp.h:122
const dsp_chain_config & operator=(const dsp_chain_config &p_source)
Definition: dsp.h:403
const dsp_chain_config_impl & operator=(const dsp_chain_config_impl &p_source)
Definition: dsp.h:439
virtual double get_latency()=0
To be overridden by a DSP implementation. Retrieves amount of data buffered by the DSP...
bool have_config_popup()
Definition: dsp.h:340
const dsp_preset_edit_callback & operator=(const dsp_preset_edit_callback &)
Definition: dsp.h:278
void get_data_raw(stream_writer *p_stream, abort_callback &p_abort)
Retrieves state of the variable. Called only from main thread, when writing configuration file...
Definition: dsp.cpp:153
pfc::array_t< t_uint8, pfc::alloc_fast > m_buffer
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
void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
Sets state of the variable. Called only from main thread, when reading configuration file...
Definition: dsp.cpp:157
dsp_preset_impl()
Definition: dsp.h:255
const void * get_data() const
Definition: dsp.h:264
bool operator==(const dsp_chain_config &other) const
Definition: dsp.h:414
bool show_config_popup(dsp_preset &p_data, HWND p_parent)
Definition: dsp.h:341
bool equals(const t1 &v1, const t2 &v2)
Definition: pathUtils.h:27
Helper class for implementing dsps. You should derive from dsp_impl_base instead of from dsp directly...
Definition: dsp.h:100