1 #ifndef _FOOBAR2000_SDK_OUTPUT_H_ 2 #define _FOOBAR2000_SDK_OUTPUT_H_ 20 inline t_pcmspec(
const t_pcmspec & p_source) {*
this = p_source;}
26 inline unsigned align()
const {
return (m_bits_per_sample / 8) * m_channels;}
28 t_size time_to_bytes(
double p_time)
const {
return (
t_size)audio_math::time_to_samples(p_time,m_sample_rate) * (m_bits_per_sample / 8) * m_channels;}
29 double bytes_to_time(
t_size p_bytes)
const {
return (
double) (p_bytes / ((m_bits_per_sample / 8) * m_channels)) / (
double) m_sample_rate;}
42 return !(*
this == p_spec2);
45 inline void reset() {m_sample_rate = 0; m_bits_per_sample = 0; m_channels = 0; m_channel_config = 0; m_float =
false;}
48 return m_sample_rate >= 1000 && m_sample_rate <= 1000000 &&
49 m_channels > 0 && m_channels <= 256 && m_channel_config != 0 &&
50 (m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24 || m_bits_per_sample == 32);
64 inline void reset() {m_sample_rate = 0; m_channels = 0; m_channel_config = 0;}
71 return !(*
this == p_spec2);
92 virtual void on_device(
const GUID & p_guid,
const char * p_name,
unsigned p_name_length) = 0;
99 virtual double get_latency() = 0;
101 virtual void process_samples(
const audio_chunk & p_chunk) = 0;
104 virtual void update(
bool & p_ready) = 0;
106 virtual void pause(
bool p_state) = 0;
108 virtual void flush() = 0;
110 virtual void force_play() = 0;
114 virtual void volume_set(
double p_val) = 0;
135 virtual GUID get_guid() = 0;
137 virtual const char * get_name() = 0;
142 virtual void advanced_settings_popup(HWND p_parent,POINT p_menupoint) = 0;
145 flag_needs_bitdepth_config = 1 << 0,
146 flag_needs_dither_config = 1 << 1,
147 flag_needs_advanced_config = 1 << 2,
148 flag_needs_device_list_prefixes = 1 << 3,
151 virtual t_uint32 get_config_flags() = 0;
156 static bool g_find(
const GUID & outputID, output_entry::ptr & outObj );
157 static output_entry::ptr g_find(
const GUID & outputID );
161 template<
typename T,
typename E = output_entry>
191 virtual void on_update() = 0;
194 virtual t_size can_write_samples() = 0;
195 virtual t_size get_latency_samples() = 0;
196 virtual void on_flush() = 0;
200 virtual void pause(
bool p_state) = 0;
201 virtual void force_play() = 0;
202 virtual void volume_set(
double p_val) = 0;
207 void flush_changing_track();
208 void update(
bool & p_ready);
209 double get_latency();
220 virtual void on_volume_scale(
float v) = 0;
221 virtual void on_volume_arbitrary(
int v) = 0;
235 virtual style_t getStyle() = 0;
237 virtual float scaleGet() = 0;
238 virtual void scaleSet(
float v) = 0;
240 virtual void arbitrarySet(
int val) = 0;
241 virtual int arbitraryGet() = 0;
242 virtual int arbitraryGetMin() = 0;
243 virtual int arbitraryGetMax() = 0;
244 virtual bool arbitraryGetMute() = 0;
245 virtual void arbitrarySetMute(
bool val) = 0;
252 virtual bool get_volume_control(
const GUID &
id, volume_control::ptr & out) = 0;
253 virtual bool hasVisualisation() = 0;
256 #pragma pack(push, 1) 267 enum { flagUseDither = 1 << 0 };
279 virtual output::ptr instantiateCoreDefault(
double overrideBufferLength = 0) = 0;
280 virtual void getCoreConfig(
void * out,
size_t outSize ) = 0;
289 #endif //_FOOBAR2000_SDK_OUTPUT_H_
bool operator==(const t_samplespec &p_spec2) const
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
t_samplespec m_incoming_spec
double bytes_to_time(t_size p_bytes) const
t_size time_to_bytes(double p_time) const
unsigned get_sample_rate() const
Helper, same as get_srate().
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
void enum_devices(output_device_enum_callback &p_callback)
exception_output_device_not_found
virtual unsigned get_channels() const =0
Retrieves channel count of contained audio data.
bool operator!=(const t_samplespec &p_spec2) const
void fromchunk(const audio_chunk &p_chunk)
unsigned m_bits_per_sample
void advanced_settings_popup(HWND p_parent, POINT p_menupoint)
t_size time_to_samples(double p_time) const
virtual unsigned get_channel_config() const =0
Retrieves channel map of contained audio data. Conditions where number of channels specified by chann...
virtual void enable_fading(bool state)
Structure describing PCM audio data format, with basic helper functions.
static unsigned g_count_channels(unsigned p_config)
Counts channels specified by channel map.
Use this to register your output implementation.
Helper; implements output_entry for specific output class implementation. output_entry methods are fo...
void instantiate(service_ptr_t< output > &p_out, const GUID &p_device, double p_buffer_length, bool p_dither, t_uint32 p_bitdepth)
t_uint32 m_channel_config
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
bool operator==(const t_pcmspec &p_spec2) const
void write(const service_ptr_t< file > &p_file, abort_callback &p_abort, const char *p_string, bool is_utf8)
PFC_DECLARE_EXCEPTION(exception_output_device_not_found, pfc::exception,"Audio device not found") PFC_DECLARE_EXCEPTION(exception_output_module_not_found
static t_samplespec g_fromchunk(const audio_chunk &p_chunk)
virtual void on_track_mark()
const GUID output_id_null
const GUID output_id_default
void getCoreConfig(outputCoreConfig_t &out)
unsigned m_channel_config
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
virtual bool want_track_marks()
virtual void on_flush_changing_track()
t_pcmspec(const t_pcmspec &p_source)
bool operator!=(const t_pcmspec &p_spec2) const
t_uint32 get_config_flags()
virtual void flush_changing_track()
t_samplespec(audio_chunk const &in)
double samples_to_time(t_size p_samples) const
pfc::array_t< audio_sample, pfc::alloc_fast_aggressive > m_incoming