Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/replaygain.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 //! Structure storing ReplayGain configuration: album/track source data modes, gain/peak processing modes and preamp values. | |
| 3 struct t_replaygain_config | |
| 4 { | |
| 5 enum /*t_source_mode*/ { | |
| 6 source_mode_none, | |
| 7 source_mode_track, | |
| 8 source_mode_album, | |
| 9 // New in 1.3.8 | |
| 10 // SPECIAL MODE valid only for playback settings; if set, track gain will be used for random & shuffle-tracks modes, album for shuffle albums & ordered playback. | |
| 11 source_mode_byPlaybackOrder | |
| 12 }; | |
| 13 enum /*t_processing_mode*/ {processing_mode_none,processing_mode_gain,processing_mode_gain_and_peak,processing_mode_peak}; | |
| 14 typedef t_uint32 t_source_mode; typedef t_uint32 t_processing_mode; | |
| 15 | |
| 16 t_replaygain_config() {reset();} | |
| 17 t_replaygain_config(t_source_mode p_source_mode,t_processing_mode p_processing_mode,float p_preamp_without_rg, float p_preamp_with_rg) | |
| 18 : m_source_mode(p_source_mode), m_processing_mode(p_processing_mode), m_preamp_without_rg(p_preamp_without_rg), m_preamp_with_rg(p_preamp_with_rg) {} | |
| 19 | |
| 20 | |
| 21 t_source_mode m_source_mode; | |
| 22 t_processing_mode m_processing_mode; | |
| 23 float m_preamp_without_rg, m_preamp_with_rg;//preamp values in dB | |
| 24 | |
| 25 void reset(); | |
| 26 audio_sample query_scale(const file_info & info) const; | |
| 27 audio_sample query_scale(const metadb_handle_ptr & info) const; | |
| 28 audio_sample query_scale(const replaygain_info & info) const; | |
| 29 | |
| 30 static void print_preamp(double val, pfc::string_base & out); | |
| 31 | |
| 32 void format_name(pfc::string_base & p_out) const; | |
| 33 bool is_active() const; | |
| 34 | |
| 35 static bool equals(const t_replaygain_config & v1, const t_replaygain_config & v2) { | |
| 36 return v1.m_source_mode == v2.m_source_mode && v1.m_processing_mode == v2.m_processing_mode && v1.m_preamp_without_rg == v2.m_preamp_without_rg && v1.m_preamp_with_rg == v2.m_preamp_with_rg; | |
| 37 } | |
| 38 bool operator==(const t_replaygain_config & other) const {return equals(*this, other);} | |
| 39 bool operator!=(const t_replaygain_config & other) const {return !equals(*this, other);} | |
| 40 }; | |
| 41 | |
| 42 FB2K_STREAM_READER_OVERLOAD(t_replaygain_config) { | |
| 43 return stream >> value.m_source_mode >> value.m_processing_mode >> value.m_preamp_with_rg >> value.m_preamp_without_rg; | |
| 44 } | |
| 45 FB2K_STREAM_WRITER_OVERLOAD(t_replaygain_config) { | |
| 46 return stream << value.m_source_mode << value.m_processing_mode << value.m_preamp_with_rg << value.m_preamp_without_rg; | |
| 47 } | |
| 48 | |
| 49 //! Core service providing methods to retrieve/alter playback ReplayGain settings, as well as use ReplayGain configuration dialog. | |
| 50 class NOVTABLE replaygain_manager : public service_base { | |
| 51 public: | |
| 52 //! Retrieves playback ReplayGain settings. | |
| 53 virtual void get_core_settings(t_replaygain_config & p_out) = 0; | |
| 54 t_replaygain_config get_core_settings(); | |
| 55 | |
| 56 //! Creates embedded version of ReplayGain settings dialog. Note that embedded dialog sends WM_COMMAND with id/BN_CLICKED to parent window when user makes changes to settings. | |
| 57 virtual fb2k::hwnd_t configure_embedded(const t_replaygain_config & p_initdata,fb2k::hwnd_t p_parent,unsigned p_id,bool p_from_modal) = 0; | |
| 58 //! Retrieves settings from embedded version of ReplayGain settings dialog. | |
| 59 virtual void configure_embedded_retrieve(fb2k::hwnd_t wnd,t_replaygain_config & p_data) = 0; | |
| 60 | |
| 61 //! Shows popup/modal version of ReplayGain settings dialog. Returns true when user changed the settings, false when user cancelled the operation. Title parameter can be null to use default one. | |
| 62 virtual bool configure_popup(t_replaygain_config & p_data,fb2k::hwnd_t p_parent,const char * p_title) = 0; | |
| 63 | |
| 64 //! Alters playback ReplayGain settings. | |
| 65 virtual void set_core_settings(const t_replaygain_config & p_config) = 0; | |
| 66 | |
| 67 //! New in 1.0 | |
| 68 virtual void configure_embedded_set(fb2k::hwnd_t wnd, t_replaygain_config const & p_data) = 0; | |
| 69 //! New in 1.0 | |
| 70 virtual void get_core_defaults(t_replaygain_config & out) = 0; | |
| 71 | |
| 72 //! Helper; queries scale value for specified item according to core playback settings. | |
| 73 audio_sample core_settings_query_scale(const file_info & p_info); | |
| 74 //! Helper; queries scale value for specified item according to core playback settings. | |
| 75 audio_sample core_settings_query_scale(const metadb_handle_ptr & info); | |
| 76 | |
| 77 FB2K_MAKE_SERVICE_COREAPI(replaygain_manager); | |
| 78 }; | |
| 79 | |
| 80 //! \since 1.4 | |
| 81 class NOVTABLE replaygain_core_settings_notify { | |
| 82 public: | |
| 83 virtual void on_changed( t_replaygain_config const & cfg ) = 0; | |
| 84 }; | |
| 85 | |
| 86 //! \since 1.4 | |
| 87 //! Adds new method for getting notified about core RG settings changing | |
| 88 class NOVTABLE replaygain_manager_v2 : public replaygain_manager { | |
| 89 FB2K_MAKE_SERVICE_COREAPI_EXTENSION( replaygain_manager_v2, replaygain_manager ); | |
| 90 public: | |
| 91 virtual void add_notify(replaygain_core_settings_notify *) = 0; | |
| 92 virtual void remove_notify(replaygain_core_settings_notify *) = 0; | |
| 93 }; |
