26 if (idx>max) idx = max;
37 if (best_found==hint_size)
break;
39 int delta_old = abs((
int)best_found - (
int)hint_size), delta_new = abs((
int)size - (
int)hint_size);
40 if (delta_new < delta_old)
54 else ret = pfc::rcnew_t<audio_chunk_impl>();
75 if (blah)
console::info(
"one or more bad chunks removed from dsp chunk list");
82 if (!g_get_interface(ptr,p_preset.
get_owner()))
return false;
83 return ptr->instantiate(p_out,p_preset);
89 if (!g_get_interface(ptr,p_guid))
return false;
91 if (!ptr->get_default_preset(preset))
return false;
92 return ptr->instantiate(p_out,preset);
98 if (!g_get_interface(ptr,p_guid))
return false;
106 return g_get_interface(blah,p_guid);
112 if (!g_get_interface(ptr,p_guid))
return false;
113 return ptr->get_default_preset(p_out);
118 p_stream->write_lendian_t(count,p_abort);
119 for(n=0;n<count;n++) {
120 get_item(n).contents_to_stream(p_stream,p_abort);
129 p_stream->read_lendian_t(count,p_abort);
133 for(n=0;n<count;n++) {
154 m_data.contents_to_stream(p_stream,p_abort);
158 m_data.contents_from_stream(p_stream,p_abort);
200 *
m_data[p_index] = p_data;
210 m_data.delete_mask(p_mask);
219 t_size size = get_data_size();
220 p_stream->write_lendian_t(get_owner(),p_abort);
221 p_stream->write_lendian_t(size,p_abort);
223 p_stream->write_object(get_data(),size,p_abort);
230 p_stream->read_lendian_t(guid,p_abort);
232 p_stream->read_lendian_t(size,p_abort);
233 if (size > 1024*1024*32)
throw exception_io_data();
234 set_data_from_stream(p_stream,size,p_abort);
240 p_stream->read_lendian_t(guid,p_abort);
241 p_stream->read_lendian_t(size,p_abort);
242 if (size > 1024*1024*32)
throw exception_io_data();
243 p_stream->skip_object(size,p_abort);
248 if (p_bytes > 0) p_stream->read_object(
m_data.
get_ptr(),p_bytes,p_abort);
261 if (!g_get_interface(entry,p_guid))
return false;
262 return entry->have_config_popup();
267 return g_have_config_popup(p_preset.
get_owner());
273 if (!g_get_interface(entry,p_preset.
get_owner()))
return false;
274 return entry->show_config_popup(p_preset,p_parent);
279 if (g_get_interface(entry,p_preset.
get_owner())) {
281 if (entry->service_query_t(entry_v2)) {
282 entry_v2->show_config_popup_v2(p_preset,p_parent,p_callback);
297 if (ptr->get_guid() == p_guid)
312 float found_priority = 0;
314 while(e.
next(ptr_dsp))
316 if (ptr_dsp->service_query_t(ptr_resampler))
318 if (p_srate_from == 0 || ptr_resampler->is_conversion_supported(p_srate_from,p_srate_to))
320 float priority = ptr_resampler->get_priority();
321 if (found.
is_empty() || priority > found_priority)
323 found = ptr_resampler;
324 found_priority = priority;
337 if (!g_get_interface(entry,p_srate_from,p_srate_to))
return false;
338 return entry->create_preset(p_out,p_srate_to,p_qualityscale);
344 if (!g_get_interface(entry,p_srate_from,p_srate_to))
return false;
346 if (!entry->create_preset(preset,p_srate_to,p_qualityscale))
return false;
347 return entry->instantiate(p_out,preset);
353 if (count != v2.
get_count())
return false;
354 for(
t_size walk = 0; walk < count; ++walk) {
363 for(
unsigned n=0;n<count;n++)
368 if (added) p_out +=
", ";
380 if (this->service_query_t(this_v2)) this_v2->run_v2(p_chunk_list,p_cur_file,p_flags,p_abort);
381 else run(p_chunk_list,p_cur_file,p_flags);
395 PFC_ASSERT(p_data.
get_owner() == get_guid());
399 dsp_preset_edit_callback_impl cb(temp);
400 show_config_popup_v2(p_data,p_parent,cb);
402 PFC_ASSERT(temp.get_owner() == get_guid());
403 if (temp == p_data)
return false;
static bool g_get_default_preset(dsp_preset &p_out, const GUID &p_guid)
virtual void on_preset_changed(const dsp_preset &)=0
void contents_to_stream(stream_writer *p_stream, abort_callback &p_abort) const
Interface to a DSP chunk list. A DSP chunk list object is passed to the DSP chain each time...
static bool g_instantiate_default(service_ptr_t< dsp > &p_out, const GUID &p_guid)
static bool g_show_config_popup(dsp_preset &p_preset, HWND p_parent)
void add_item(const dsp_preset &p_data)
static void g_contents_from_stream_skip(stream_reader *p_stream, abort_callback &p_abort)
virtual t_size get_count() const =0
void remove_item(t_size p_index)
void reset()
Resets all audio_chunk data.
virtual void set_srate(unsigned val)=0
Sets sample rate of contained audio data.
void info(const char *p_message)
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
void set_data(const dsp_chain_config &p_data)
pfc::list_t< pfc::rcptr_t< audio_chunk > > m_data
void insert_item(const dsp_preset &p_data, t_size p_index)
Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
void instantiate(service_list_t< dsp > &p_out)
pfc::list_t< pfc::rcptr_t< audio_chunk > > m_recycled
virtual const dsp_preset & get_item(t_size p_index) const =0
void replace_item(const dsp_preset &p_data, t_size p_index)
static bool g_create(service_ptr_t< dsp > &p_out, unsigned p_srate_from, unsigned p_srate_to, float p_qualityscale)
const T * get_ptr() const
void remove_mask(const bit_array &mask)
void remove_mask(const bit_array &mask)
void get_name_list(pfc::string_base &p_out) const
static bool equals(dsp_chain_config const &v1, dsp_chain_config const &v2)
void run_abortable(dsp_chunk_list *p_chunk_list, const metadb_handle_ptr &p_cur_file, int p_flags, abort_callback &p_abort)
audio_chunk * get_item(t_size n) const
static bool g_have_config_popup(const GUID &p_guid)
static bool g_get_interface(service_ptr_t< dsp_entry > &p_out, const GUID &p_guid)
void set_data_from_stream(stream_reader *p_stream, t_size p_bytes, abort_callback &p_abort)
t_size add_item(const T &item)
bool show_config_popup(dsp_preset &p_data, HWND p_parent)
T remove_by_idx(t_size idx)
audio_chunk * insert_item(t_size idx, t_size hint_size=0)
audio_chunk * add_item(t_size hint_size=0)
static bool g_dsp_exists(const GUID &p_guid)
bool is_valid() const
Returns whether the chunk contents are valid (for bug check purposes).
static void g_show_config_popup_v2(const dsp_preset &p_preset, HWND p_parent, dsp_preset_edit_callback &p_callback)
virtual GUID get_owner() const =0
void contents_from_stream(stream_reader *p_stream, abort_callback &p_abort)
virtual void set_channels(unsigned p_count, unsigned p_config)=0
Sets channel count / channel map.
void set_size(t_size p_count)
static bool g_instantiate(service_ptr_t< dsp > &p_out, const dsp_preset &p_preset)
void remove_by_idx(t_size idx)
t_size insert_item(const t_in &item, t_size idx)
void remove_mask(const bit_array &p_mask)
static bool g_create_preset(dsp_preset &p_out, unsigned p_srate_from, unsigned p_srate_to, float p_qualityscale)
void contents_from_stream(stream_reader *p_stream, abort_callback &p_abort)
bool get_data(dsp_chain_config &p_data) const
void copy(const dsp_chain_config &p_source)
const dsp_preset & get_item(t_size p_index) const
static bool g_name_from_guid(pfc::string_base &p_out, const GUID &p_guid)
void contents_to_stream(stream_writer *p_stream, abort_callback &p_abort) const
bool next(service_ptr_t< t_query > &p_out)
virtual void set_sample_count(t_size val)=0
Sets number of valid samples in the buffer. WARNING: sample count * channel count should never be abo...
static bool g_get_interface(service_ptr_t< resampler_entry > &p_out, unsigned p_srate_from, unsigned p_srate_to)
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...
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...