From: <man...@us...> - 2013-05-21 14:46:18
|
Revision: 2160 http://sourceforge.net/p/modplug/code/2160 Author: manxorist Date: 2013-05-21 14:46:11 +0000 (Tue, 21 May 2013) Log Message: ----------- [Mod] Change unit of MASTERGAIN render_param in libopenmpt from decibel to millibel. [Ref] Clarify render_param names in libeopenmpt API. [Ref] Cleanup libopenmpt_settings. Remove libopenmpt_settings_dialog.*. [Mod] Properly CamelCase registry keys for in_openmpt and xmp-openmpt. [Fix] class openmpt::exception_message has to be exported from shared libraries so that type_info lookup does not crash. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/SettingsForm.h trunk/OpenMPT/libopenmpt/libopenmpt.h trunk/OpenMPT/libopenmpt/libopenmpt.hpp trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp trunk/OpenMPT/libopenmpt/libopenmpt_settings.h trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp trunk/OpenMPT/openmpt123/openmpt123.cpp Removed Paths: ------------- trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.cpp trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.h Modified: trunk/OpenMPT/libopenmpt/SettingsForm.h =================================================================== --- trunk/OpenMPT/libopenmpt/SettingsForm.h 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/SettingsForm.h 2013-05-21 14:46:11 UTC (rev 2160) @@ -47,7 +47,7 @@ comboBoxSamplerate->Enabled = settings->with_outputformat; comboBoxChannels->Enabled = settings->with_outputformat; - trackBarGain->Value = settings->mastergain; + trackBarGain->Value = settings->mastergain_millibel; trackBarMaxPolyphony->Value = settings->maxmixchannels; @@ -197,13 +197,15 @@ // // trackBarGain // - this->trackBarGain->LargeChange = 3; + this->trackBarGain->LargeChange = 300; this->trackBarGain->Location = System::Drawing::Point(106, 63); - this->trackBarGain->Maximum = 12; - this->trackBarGain->Minimum = -12; + this->trackBarGain->Maximum = 1200; + this->trackBarGain->Minimum = -1200; this->trackBarGain->Name = L"trackBarGain"; this->trackBarGain->Size = System::Drawing::Size(121, 42); + this->trackBarGain->SmallChange = 100; this->trackBarGain->TabIndex = 6; + this->trackBarGain->TickFrequency = 100; this->trackBarGain->TickStyle = System::Windows::Forms::TickStyle::Both; this->trackBarGain->Scroll += gcnew System::EventHandler(this, &SettingsForm::trackBarGain_Scroll); // @@ -399,7 +401,7 @@ settings->changed(); } private: System::Void trackBarGain_Scroll(System::Object^ sender, System::EventArgs^ e) { - settings->mastergain = (int)trackBarGain->Value; + settings->mastergain_millibel = (int)trackBarGain->Value; settings->changed(); } private: System::Void comboBoxInterpolation_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { Modified: trunk/OpenMPT/libopenmpt/libopenmpt.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.h 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt.h 2013-05-21 14:46:11 UTC (rev 2160) @@ -63,14 +63,14 @@ LIBOPENMPT_API void openmpt_module_destroy( openmpt_module * mod ); -#define OPENMPT_MODULE_RENDER_MASTERGAIN_DB 1 -#define OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT 2 -#define OPENMPT_MODULE_RENDER_REPEATCOUNT 3 -#define OPENMPT_MODULE_RENDER_QUALITY_PERCENT 4 -#define OPENMPT_MODULE_RENDER_MAXMIXCHANNELS 5 -#define OPENMPT_MODULE_RENDER_INTERPOLATION_MODE 6 -#define OPENMPT_MODULE_RENDER_VOLUMERAMP_IN_US 7 -#define OPENMPT_MODULE_RENDER_VOLUMERAMP_OUT_US 8 +#define OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL 1 +#define OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT 2 +#define OPENMPT_MODULE_RENDER_REPEATCOUNT 3 +#define OPENMPT_MODULE_RENDER_QUALITY_PERCENT 4 +#define OPENMPT_MODULE_RENDER_MAXMIXCHANNELS 5 +#define OPENMPT_MODULE_RENDER_INTERPOLATION_MODE 6 +#define OPENMPT_MODULE_RENDER_VOLUMERAMP_IN_MICROSECONDS 7 +#define OPENMPT_MODULE_RENDER_VOLUMERAMP_OUT_MICROSECONDS 8 #define OPENMPT_MODULE_RENDER_INTERPOLATION_NEAREST 1 #define OPENMPT_MODULE_RENDER_INTERPOLATION_LINEAR 2 Modified: trunk/OpenMPT/libopenmpt/libopenmpt.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.hpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt.hpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -77,14 +77,14 @@ public: enum render_param { - RENDER_MASTERGAIN_DB = 1, - RENDER_STEREOSEPARATION_PERCENT = 2, - RENDER_REPEATCOUNT = 3, - RENDER_QUALITY_PERCENT = 4, - RENDER_MAXMIXCHANNELS = 5, - RENDER_INTERPOLATION_MODE = 6, - RENDER_VOLUMERAMP_IN_US = 7, - RENDER_VOLUMERAMP_OUT_US = 8, + RENDER_MASTERGAIN_MILLIBEL = 1, + RENDER_STEREOSEPARATION_PERCENT = 2, + RENDER_REPEATCOUNT = 3, + RENDER_QUALITY_PERCENT = 4, + RENDER_MAXMIXCHANNELS = 5, + RENDER_INTERPOLATION_MODE = 6, + RENDER_VOLUMERAMP_IN_MICROSECONDS = 7, + RENDER_VOLUMERAMP_OUT_MICROSECONDS = 8, }; enum interpolation_mode { Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -41,7 +41,8 @@ } // namespace version -class exception_message : public exception { +// has to be exported for type_info lookup to work +class LIBOPENMPT_CXX_API exception_message : public exception { public: exception_message( const char * text_ ) throw() : text(text_) { } virtual ~exception_message() throw() { } @@ -256,8 +257,8 @@ public: std::int32_t get_render_param( int command ) const { switch ( command ) { - case module::RENDER_MASTERGAIN_DB: { - return static_cast<std::int32_t>( 10.0f * 2.0f * std::log10( fx16_to_float( m_sndFile.m_MixerSettings.m_FinalOutputGain ) ) ); + case module::RENDER_MASTERGAIN_MILLIBEL: { + return static_cast<std::int32_t>( 1000.0f * 2.0f * std::log10( fx16_to_float( m_sndFile.m_MixerSettings.m_FinalOutputGain ) ) ); } break; case module::RENDER_STEREOSEPARATION_PERCENT: { return m_sndFile.m_MixerSettings.m_nStereoSeparation * 100 / 128; @@ -295,10 +296,10 @@ } throw openmpt::exception_message("unknown interpolation mode set internally"); } break; - case module::RENDER_VOLUMERAMP_IN_US: { + case module::RENDER_VOLUMERAMP_IN_MICROSECONDS: { return m_sndFile.m_MixerSettings.GetVolumeRampUpMicroseconds(); } break; - case module::RENDER_VOLUMERAMP_OUT_US: { + case module::RENDER_VOLUMERAMP_OUT_MICROSECONDS: { return m_sndFile.m_MixerSettings.GetVolumeRampDownMicroseconds(); } break; default: throw openmpt::exception_message("unknown command"); break; @@ -307,8 +308,8 @@ } void set_render_param( int command, std::int32_t value ) { switch ( command ) { - case module::RENDER_MASTERGAIN_DB: { - float gainFactor = static_cast<float>( std::pow( 10.0f, value * 0.1f * 0.5f ) ); + case module::RENDER_MASTERGAIN_MILLIBEL: { + float gainFactor = static_cast<float>( std::pow( 10.0f, value * 0.001f * 0.5f ) ); if ( static_cast<std::int32_t>( m_sndFile.m_MixerSettings.m_FinalOutputGain ) != float_to_fx16( gainFactor ) ) { MixerSettings settings = m_sndFile.m_MixerSettings; settings.m_FinalOutputGain = float_to_fx16( gainFactor ); @@ -356,14 +357,14 @@ m_sndFile.SetResamplerSettings( newsettings ); } } break; - case module::RENDER_VOLUMERAMP_IN_US: { + case module::RENDER_VOLUMERAMP_IN_MICROSECONDS: { MixerSettings newsettings = m_sndFile.m_MixerSettings; newsettings.SetVolumeRampUpMicroseconds( value ); if ( m_sndFile.m_MixerSettings.glVolumeRampUpSamples != newsettings.glVolumeRampUpSamples ) { m_sndFile.SetMixerSettings( newsettings ); } } break; - case module::RENDER_VOLUMERAMP_OUT_US: { + case module::RENDER_VOLUMERAMP_OUT_MICROSECONDS: { MixerSettings newsettings = m_sndFile.m_MixerSettings; newsettings.SetVolumeRampDownMicroseconds( value ); if ( m_sndFile.m_MixerSettings.glVolumeRampDownSamples != newsettings.glVolumeRampDownSamples ) { Modified: trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_modplug.c 2013-05-21 14:46:11 UTC (rev 2160) @@ -329,14 +329,14 @@ int32_t val; if(!file) return 0; val = 0; - if(!openmpt_module_get_render_param(file->mod,OPENMPT_MODULE_RENDER_MASTERGAIN_DB,&val)) return 128; - return (unsigned int)(128.0*pow(10.0,val*0.05)); + if(!openmpt_module_get_render_param(file->mod,OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL,&val)) return 128; + return (unsigned int)(128.0*pow(10.0,val*0.0005)); } LIBOPENMPT_MODPLUG_API void ModPlug_SetMasterVolume(ModPlugFile* file,unsigned int cvol) { if(!file) return; - openmpt_module_set_render_param(file->mod,OPENMPT_MODULE_RENDER_MASTERGAIN_DB,(int32_t)(20.0*log10(cvol/128.0))); + openmpt_module_set_render_param(file->mod,OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL,(int32_t)(2000.0*log10(cvol/128.0))); } LIBOPENMPT_MODPLUG_API int ModPlug_GetCurrentSpeed(ModPlugFile* file) Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.cpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -7,9 +7,11 @@ * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ +#include "libopenmpt_internal.h" + #define LIBOPENMPT_BUILD_SETTINGS_DLL #include "libopenmpt_settings.h" -#include "libopenmpt_settings_dialog.h" +#include "SettingsForm.h" namespace openmpt { @@ -21,4 +23,29 @@ return; } +void registry_settings::read_setting( const char * key, int & val ) { + System::String ^ net_root = "HKEY_CURRENT_USER\\Software\\libopenmpt\\"; + System::String ^ net_path = gcnew System::String( subkey ); + System::String ^ net_key = gcnew System::String( key ); + System::Object ^ retval = Microsoft::Win32::Registry::GetValue( System::String::Concat( net_root, net_path ), net_key, val ); + if ( retval == nullptr ) { + return; + } else { + val = (int)retval; + } +} + +void registry_settings::write_setting( const char * key, int val ) { + System::String ^ net_root = "HKEY_CURRENT_USER\\Software\\libopenmpt\\"; + System::String ^ net_path = gcnew System::String( subkey ); + System::String ^ net_key = gcnew System::String( key ); + Microsoft::Win32::Registry::SetValue( System::String::Concat( net_root, net_path ), net_key, val ); +} + +void registry_settings::edit_settings( HWND parent, const char * title ) { + libopenmpt::SettingsForm ^ form = gcnew libopenmpt::SettingsForm( title, this ); + System::Windows::Forms::IWin32Window ^w = System::Windows::Forms::Control::FromHandle((System::IntPtr)parent); + form->Show(w); +} + } // namespace openmpt Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.h 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.h 2013-05-21 14:46:11 UTC (rev 2160) @@ -37,7 +37,7 @@ bool with_outputformat; int samplerate; int channels; - int mastergain; + int mastergain_millibel; int stereoseparation; int repeatcount; int maxmixchannels; @@ -56,27 +56,27 @@ }; inline void settings::load() { - read_setting( "samplerate", samplerate ); - read_setting( "channels", channels ); - read_setting( "mastergain", mastergain ); - read_setting( "stereoseparation", stereoseparation ); - read_setting( "repeatcount", repeatcount ); - read_setting( "maxmixchannels", maxmixchannels ); - read_setting( "interpolationmode", interpolationmode ); - read_setting( "volrampin_microseconds", volrampinus ); - read_setting( "volrampout_microseconds", volrampoutus ); + read_setting( "Samplerate_Hz", samplerate ); + read_setting( "Channels", channels ); + read_setting( "MasterGain_milliBel", mastergain_millibel ); + read_setting( "SeteroSeparation_Percent", stereoseparation ); + read_setting( "RepeatCount", repeatcount ); + read_setting( "MixerChannels", maxmixchannels ); + read_setting( "InterpolationMode", interpolationmode ); + read_setting( "VolumeRampingIn_microseconds", volrampinus ); + read_setting( "VolumeRampingOut_microseconds", volrampoutus ); } inline void settings::save() { - write_setting( "samplerate", samplerate ); - write_setting( "channels", channels ); - write_setting( "mastergain", mastergain ); - write_setting( "stereoseparation", stereoseparation ); - write_setting( "repeatcount", repeatcount ); - write_setting( "maxmixchannels", maxmixchannels ); - write_setting( "interpolationmode", interpolationmode ); - write_setting( "volrampin_microseconds", volrampinus ); - write_setting( "volrampout_microseconds", volrampoutus ); + write_setting( "Samplerate_Hz", samplerate ); + write_setting( "Channels", channels ); + write_setting( "MasterGain_milliBel", mastergain_millibel ); + write_setting( "SeteroSeparation_Percent", stereoseparation ); + write_setting( "RepeatCount", repeatcount ); + write_setting( "MixerChannels", maxmixchannels ); + write_setting( "InterpolationMode", interpolationmode ); + write_setting( "VolumeRampingIn_microseconds", volrampinus ); + write_setting( "VolumeRampingOut_microseconds", volrampoutus ); } inline void settings::edit( HWND parent, const char * title ) { @@ -86,7 +86,7 @@ inline settings::settings( bool with_outputformat_ ) : with_outputformat(with_outputformat_) { samplerate = 48000; channels = 2; - mastergain = 0; + mastergain_millibel = 0; stereoseparation = 100; repeatcount = 0; maxmixchannels = 256; Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj 2013-05-21 14:46:11 UTC (rev 2160) @@ -66,15 +66,11 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="libopenmpt_settings.cpp" /> - <ClCompile Include="libopenmpt_settings_dialog.cpp"> + <ClCompile Include="libopenmpt_settings.cpp"> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsManaged> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsManaged> <ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Async</ExceptionHandling> <ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Async</ExceptionHandling> - <DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ProgramDatabase</DebugInformationFormat> - <MinimalRebuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</MinimalRebuild> - <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks> </ClCompile> <ClCompile Include="SettingsForm.cpp"> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsManaged> @@ -93,7 +89,6 @@ </ItemGroup> <ItemGroup> <ClInclude Include="libopenmpt_settings.h" /> - <ClInclude Include="libopenmpt_settings_dialog.h" /> <ClInclude Include="SettingsForm.h"> <FileType>CppForm</FileType> </ClInclude> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings.vcxproj.filters 2013-05-21 14:46:11 UTC (rev 2160) @@ -18,9 +18,6 @@ <ClCompile Include="libopenmpt_settings.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="libopenmpt_settings_dialog.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="SettingsForm.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -29,9 +26,6 @@ <ClInclude Include="libopenmpt_settings.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="libopenmpt_settings_dialog.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="SettingsForm.h"> <Filter>Header Files</Filter> </ClInclude> Deleted: trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.cpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.cpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -1,35 +0,0 @@ - -#include "libopenmpt_internal.h" - -#define LIBOPENMPT_BUILD_SETTINGS_DLL -#include "libopenmpt_settings_dialog.h" -#include "SettingsForm.h" - -namespace openmpt { - -void registry_settings::read_setting( const char * key, int & val ) { - System::String ^ net_root = "HKEY_CURRENT_USER\\Software\\libopenmpt\\"; - System::String ^ net_path = gcnew System::String( subkey ); - System::String ^ net_key = gcnew System::String( key ); - System::Object ^ retval = Microsoft::Win32::Registry::GetValue( System::String::Concat( net_root, net_path ), net_key, val ); - if ( retval == nullptr ) { - return; - } else { - val = (int)retval; - } -} - -void registry_settings::write_setting( const char * key, int val ) { - System::String ^ net_root = "HKEY_CURRENT_USER\\Software\\libopenmpt\\"; - System::String ^ net_path = gcnew System::String( subkey ); - System::String ^ net_key = gcnew System::String( key ); - Microsoft::Win32::Registry::SetValue( System::String::Concat( net_root, net_path ), net_key, val ); -} - -void registry_settings::edit_settings( HWND parent, const char * title ) { - libopenmpt::SettingsForm ^ form = gcnew libopenmpt::SettingsForm( title, this ); - System::Windows::Forms::IWin32Window ^w = System::Windows::Forms::Control::FromHandle((System::IntPtr)parent); - form->Show(w); -} - -} // namespace openmpt Deleted: trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.h 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_settings_dialog.h 2013-05-21 14:46:11 UTC (rev 2160) @@ -1,10 +0,0 @@ - -#pragma once - -#include "libopenmpt_settings.h" - -namespace openmpt { - -void edit_settings( settings * s, HWND parent, const char * title ); - -} Modified: trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -116,13 +116,13 @@ static void apply_options() { if ( self->mod ) { - self->mod->set_render_param( openmpt::module::RENDER_MASTERGAIN_DB, self->settings->mastergain ); + self->mod->set_render_param( openmpt::module::RENDER_MASTERGAIN_MILLIBEL, self->settings->mastergain_millibel ); self->mod->set_render_param( openmpt::module::RENDER_STEREOSEPARATION_PERCENT, self->settings->stereoseparation ); self->mod->set_render_param( openmpt::module::RENDER_REPEATCOUNT, self->settings->repeatcount ); self->mod->set_render_param( openmpt::module::RENDER_MAXMIXCHANNELS, self->settings->maxmixchannels ); self->mod->set_render_param( openmpt::module::RENDER_INTERPOLATION_MODE, self->settings->interpolationmode ); - self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_IN_US, self->settings->volrampinus ); - self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_OUT_US, self->settings->volrampoutus ); + self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_IN_MICROSECONDS, self->settings->volrampinus ); + self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_OUT_MICROSECONDS, self->settings->volrampoutus ); } self->settings->save(); } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -102,13 +102,13 @@ static void apply_options() { if ( self->mod ) { - self->mod->set_render_param( openmpt::module::RENDER_MASTERGAIN_DB, self->settings->mastergain ); + self->mod->set_render_param( openmpt::module::RENDER_MASTERGAIN_MILLIBEL, self->settings->mastergain_millibel ); self->mod->set_render_param( openmpt::module::RENDER_STEREOSEPARATION_PERCENT, self->settings->stereoseparation ); self->mod->set_render_param( openmpt::module::RENDER_REPEATCOUNT, self->settings->repeatcount ); self->mod->set_render_param( openmpt::module::RENDER_MAXMIXCHANNELS, self->settings->maxmixchannels ); self->mod->set_render_param( openmpt::module::RENDER_INTERPOLATION_MODE, self->settings->interpolationmode ); - self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_IN_US, self->settings->volrampinus ); - self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_OUT_US, self->settings->volrampoutus ); + self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_IN_MICROSECONDS, self->settings->volrampinus ); + self->mod->set_render_param( openmpt::module::RENDER_VOLUMERAMP_OUT_MICROSECONDS, self->settings->volrampoutus ); } self->settings->save(); } Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-05-21 14:38:33 UTC (rev 2159) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-05-21 14:46:11 UTC (rev 2160) @@ -125,7 +125,7 @@ s << "Buffer: " << flags.buffer << std::endl; s << "Repeat count: " << flags.repeatcount << std::endl; s << "Sample rate: " << flags.samplerate << std::endl; - s << "Gain: " << flags.gain << std::endl; + s << "Gain: " << flags.gain / 100.0 << std::endl; s << "Quality: " << flags.quality << std::endl; s << "Seek target: " << flags.seek_target << std::endl; s << "Float: " << flags.use_float << std::endl; @@ -367,7 +367,7 @@ std::clog << " --[no]-float Output 32bit floating point instead of 16bit integer [default: " << openmpt123_flags().use_float << "]" << std::endl; std::clog << " --buffer n Set output buffer size to n ms [default: " << openmpt123_flags().buffer << "]," << std::endl; std::clog << " --samplerate n Set samplerate to n Hz [default: " << openmpt123_flags().samplerate << "]" << std::endl; - std::clog << " --gain n Set output gain to n dB [default: " << openmpt123_flags().gain << "]" << std::endl; + std::clog << " --gain n Set output gain to n dB [default: " << openmpt123_flags().gain / 100.0 << "]" << std::endl; std::clog << " --repeat n Repeat song n times (-1 means forever) [default: " << openmpt123_flags().repeatcount << "]" << std::endl; std::clog << " --quality n Set rendering quality to n % [default: " << openmpt123_flags().quality << "]" << std::endl; std::clog << " --seek n Seek to n seconds on start [default: " << openmpt123_flags().seek_target << "]" << std::endl; @@ -506,9 +506,9 @@ mod.set_render_param( openmpt::module::RENDER_REPEATCOUNT, flags.repeatcount ); mod.set_render_param( openmpt::module::RENDER_QUALITY_PERCENT, flags.quality ); - mod.set_render_param( openmpt::module::RENDER_MASTERGAIN_DB, flags.gain ); - mod.set_render_param( openmpt::module::RENDER_VOLUMERAMP_IN_US, flags.rampinus ); - mod.set_render_param( openmpt::module::RENDER_VOLUMERAMP_OUT_US, flags.rampoutus ); + mod.set_render_param( openmpt::module::RENDER_MASTERGAIN_MILLIBEL, flags.gain ); + mod.set_render_param( openmpt::module::RENDER_VOLUMERAMP_IN_MICROSECONDS, flags.rampinus ); + mod.set_render_param( openmpt::module::RENDER_VOLUMERAMP_OUT_MICROSECONDS, flags.rampoutus ); if ( flags.seek_target > 0.0 ) { mod.seek_seconds( flags.seek_target ); @@ -643,7 +643,9 @@ ++i; } else if ( arg == "--gain" && nextarg != "" ) { std::istringstream istr( nextarg ); - istr >> flags.gain; + double gain = 0.0; + istr >> gain; + flags.gain = static_cast<std::int32_t>( gain * 100.0 ); ++i; } else if ( arg == "--repeat" && nextarg != "" ) { std::istringstream istr( nextarg ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |