foobar2000 SDK
2015-08-03
|
#include <dsp.h>
Public Member Functions | |
virtual void | flush ()=0 |
virtual double | get_latency ()=0 |
virtual bool | need_track_change_mark ()=0 |
Protected Member Functions | |
dsp_impl_base_t () | |
bool | get_cur_file (metadb_handle_ptr &p_out) |
audio_chunk * | insert_chunk (t_size p_hint_size=0) |
audio_chunk * | insert_chunk (const audio_chunk &sourceCopy) |
virtual bool | on_chunk (audio_chunk *p_chunk, abort_callback &p_abort)=0 |
virtual void | on_endofplayback (abort_callback &p_abort)=0 |
virtual void | on_endoftrack (abort_callback &p_abort)=0 |
Private Types | |
typedef dsp_impl_base_t< t_baseclass > | t_self |
Private Member Functions | |
dsp_impl_base_t (const t_self &) | |
const t_self & | operator= (const t_self &) |
void | run_v2 (dsp_chunk_list *p_list, const metadb_handle_ptr &p_cur_file, int p_flags, abort_callback &p_abort) |
Private Attributes | |
t_size | m_chunk_ptr |
metadb_handle * | m_cur_file |
dsp_chunk_list * | m_list |
Helper class for implementing dsps. You should derive from dsp_impl_base instead of from dsp directly.
The dsp_impl_base_t template allows you to use a custom interface class as a base class for your implementation, in case you provide extended functionality.
Use dsp_factory_t<> template to register your dsp implementation. The implementation - as required by dsp_factory_t<> template - must also provide following methods:
A constructor taking const dsp_preset&, initializing the DSP with specified preset data.
static void g_get_name(pfc::string_base &); - retrieving human-readable name of the DSP to display.
static bool g_get_default_preset(dsp_preset &); - retrieving default preset for this DSP. Return value is reserved for future use and should always be true.
static GUID g_get_guid(); - retrieving GUID of your DSP implementation, to be used to identify it when storing DSP chain configuration.
static bool g_have_config_popup(); - retrieving whether your DSP implementation supplies a popup dialog for configuring it.
static void g_show_config_popup(const dsp_preset & p_data,HWND p_parent, dsp_preset_edit_callback & p_callback); - displaying your DSP's settings dialog; called only when g_have_config_popup() returns true; call p_callback.on_preset_changed() whenever user has made adjustments to the preset data.
.
|
private |
|
inlineprotected |
|
private |
|
pure virtual |
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.
Implemented in dsp_sample.
|
inlineprotected |
Call only from on_chunk / on_endoftrack (on_endoftrack will give info on track being finished).
May return false when there's no known track and the metadb_handle ptr will be empty/null.
Definition at line 110 of file dsp.h.
|
pure virtual |
To be overridden by a DSP implementation.
Retrieves amount of data buffered by the DSP, for syncing visualisation.
Implemented in dsp_sample.
|
inlineprotected |
Inserts a new chunk of audio data.
You can call this only from on_chunk(), on_endofplayback() and on_endoftrack(). You're NOT allowed to call this from flush() which should just drop any queued data.
hint_size | Optional, amount of buffer space that you require (in audio_samples). This is just a hint for memory allocation logic and will not cause the framework to allocate the chunk for you. |
Definition at line 118 of file dsp.h.
|
inlineprotected |
Definition at line 122 of file dsp.h.
|
pure virtual |
To be overridden by a DSP implementation.
Returns true if DSP needs to know exact track change point (eg. for crossfading, removing silence).
Signaling this will force-flush any DSPs placed before this DSP so when it gets on_endoftrack(), relevant chunks contain last samples of the track.
Signaling this may interfere with gapless playback in certain scenarios (forces flush of DSPs placed before you) so don't use it unless you have reasons to.
Implemented in dsp_sample.
|
protectedpure virtual |
To be overridden by a DSP implementation.
Processes a chunk of audio data.
You can call insert_chunk() from inside on_chunk() to insert any audio data before currently processed chunk.
.
p_chunk | Current chunk being processed. You can alter it in any way you like. |
Implemented in dsp_sample.
|
protectedpure virtual |
To be overridden by a DSP implementation.
Called at the end of played stream, typically at the end of last played track, to allow the DSP to return all data it has buffered-ahead.
Use insert_chunk() to return any data you have buffered.
Note that this call does not imply that the DSP will be destroyed next.
This is also called on track changes if some DSP placed after your DSP requests track change marks.
Implemented in dsp_sample.
|
protectedpure virtual |
To be overridden by a DSP implementation.
Called on track change. You can use insert_chunk() to dump any data you have to flush.
Note that you must implement need_track_change_mark() to return true if you need this method called.
Implemented in dsp_sample.
|
private |
|
private |
Definition at line 166 of file dsp.h.
|
private |
|
private |
|
private |