mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-04 09:11:33 +02:00
* all: added a new variable "equalizer.preamp" (self-explanatory ;) in skins
* winamp2.xml: added preamp slider and fixed offsets
This commit is contained in:
parent
af908f4e2c
commit
eb4bf29866
@ -65,3 +65,9 @@ void CmdSetEqBands::execute()
|
||||
m_rEqBands.set( m_value );
|
||||
}
|
||||
|
||||
|
||||
void CmdSetEqPreamp::execute()
|
||||
{
|
||||
// Change the preamp variable
|
||||
m_rPreamp.set( m_value, false );
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "../utils/ustring.hpp"
|
||||
|
||||
class EqualizerBands;
|
||||
class EqualizerPreamp;
|
||||
class VarText;
|
||||
|
||||
/// Command to notify the playlist of a change
|
||||
@ -79,6 +80,29 @@ class CmdSetText: public CmdGeneric
|
||||
};
|
||||
|
||||
|
||||
/// Command to set the equalizer preamp
|
||||
class CmdSetEqPreamp: public CmdGeneric
|
||||
{
|
||||
public:
|
||||
CmdSetEqPreamp( intf_thread_t *pIntf, EqualizerPreamp &rPreamp,
|
||||
float value ):
|
||||
CmdGeneric( pIntf ), m_rPreamp( rPreamp ), m_value( value ) {}
|
||||
virtual ~CmdSetEqPreamp() {}
|
||||
|
||||
/// This method does the real job of the command
|
||||
virtual void execute();
|
||||
|
||||
/// Return the type of the command
|
||||
virtual string getType() const { return "set equalizer preamp"; }
|
||||
|
||||
private:
|
||||
/// Preamp variable to set
|
||||
EqualizerPreamp &m_rPreamp;
|
||||
/// Value to set
|
||||
float m_value;
|
||||
};
|
||||
|
||||
|
||||
/// Command to set the equalizerbands
|
||||
class CmdSetEqBands: public CmdGeneric
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Cyril Deguet <asmax@via.ecp.fr>
|
||||
* Olivier Teulière <ipkiss@via.ecp.fr>
|
||||
* Olivier Teuli<EFBFBD>e <ipkiss@via.ecp.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -98,6 +98,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
|
||||
REGISTER_VAR( m_cVarPaused, VarBoolImpl, "vlc.isPaused" )
|
||||
REGISTER_VAR( m_cVarSeekable, VarBoolImpl, "vlc.isSeekable" )
|
||||
REGISTER_VAR( m_cVarEqualizer, VarBoolImpl, "equalizer.isEnabled" )
|
||||
REGISTER_VAR( m_cVarEqPreamp, EqualizerPreamp, "equalizer.preamp" )
|
||||
#undef REGISTER_VAR
|
||||
m_cVarStreamName = VariablePtr( new VarText( getIntf(), false ) );
|
||||
pVarManager->registerVar( m_cVarStreamName, "streamName" );
|
||||
@ -304,9 +305,11 @@ void VlcProc::refreshAudio()
|
||||
{
|
||||
if( pAout != m_pAout )
|
||||
{
|
||||
// Register the equalizer callback
|
||||
// Register the equalizer callbacks
|
||||
if( !var_AddCallback( pAout, "equalizer-bands",
|
||||
onEqBandsChange, this ) )
|
||||
onEqBandsChange, this ) &&
|
||||
!var_AddCallback( pAout, "equalizer-preamp",
|
||||
onEqPreampChange, this ) )
|
||||
{
|
||||
m_pAout = pAout;
|
||||
//char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
|
||||
@ -567,3 +570,20 @@ int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
|
||||
return VLC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
|
||||
vlc_value_t oldVal, vlc_value_t newVal,
|
||||
void *pParam )
|
||||
{
|
||||
VlcProc *pThis = (VlcProc*)pParam;
|
||||
EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
|
||||
|
||||
// Post a set preamp command
|
||||
CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
|
||||
(newVal.f_float + 20.0) / 40.0 );
|
||||
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
|
||||
pQueue->push( CmdGenericPtr( pCmd ) );
|
||||
|
||||
return VLC_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Cyril Deguet <asmax@via.ecp.fr>
|
||||
* Olivier Teulière <ipkiss@via.ecp.fr>
|
||||
* Olivier Teuli<EFBFBD>e <ipkiss@via.ecp.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -119,8 +119,9 @@ class VlcProc: public SkinObject
|
||||
VariablePtr m_cVarSeekable;
|
||||
/// Variable for the vout
|
||||
VarBox m_varVoutSize;
|
||||
/// Equalizer variable
|
||||
/// Equalizer variables
|
||||
EqualizerBands m_varEqBands;
|
||||
VariablePtr m_cVarEqPreamp;
|
||||
VariablePtr m_cVarEqualizer;
|
||||
|
||||
/// Set of handles of vout windows
|
||||
@ -194,6 +195,11 @@ class VlcProc: public SkinObject
|
||||
static int onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
|
||||
vlc_value_t oldVal, vlc_value_t newVal,
|
||||
void *pParam );
|
||||
|
||||
/// Callback for equalizer-preamp variable
|
||||
static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
|
||||
vlc_value_t oldVal, vlc_value_t newVal,
|
||||
void *pParam );
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ void EqualizerBands::onUpdate( Subject<VarPercent> &rBand )
|
||||
ss << " " << val;
|
||||
}
|
||||
|
||||
aout_instance_t *pAout= (aout_instance_t *)vlc_object_find( getIntf(),
|
||||
aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
|
||||
VLC_OBJECT_AOUT, FIND_ANYWHERE );
|
||||
char *bands = (char*)ss.str().c_str();
|
||||
config_PutPsz( getIntf(), "equalizer-bands", bands );
|
||||
@ -109,3 +109,31 @@ void EqualizerBands::onUpdate( Subject<VarPercent> &rBand )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EqualizerPreamp::EqualizerPreamp( intf_thread_t *pIntf ): VarPercent( pIntf )
|
||||
{
|
||||
// Initial value
|
||||
VarPercent::set( 0.8 );
|
||||
}
|
||||
|
||||
|
||||
void EqualizerPreamp::set( float percentage, bool updateVLC )
|
||||
{
|
||||
VarPercent::set( percentage );
|
||||
|
||||
// Avoid infinite loop
|
||||
if( updateVLC )
|
||||
{
|
||||
float val = 40 * percentage - 20;
|
||||
|
||||
aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
|
||||
VLC_OBJECT_AOUT, FIND_ANYWHERE );
|
||||
config_PutFloat( getIntf(), "equalizer-preamp", val );
|
||||
if( pAout )
|
||||
{
|
||||
// Update the audio output
|
||||
var_SetFloat( pAout, "equalizer-preamp", val );
|
||||
vlc_object_release( pAout );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,17 @@ class EqualizerBands: public SkinObject, public Observer<VarPercent>
|
||||
};
|
||||
|
||||
|
||||
/// Variable for equalizer preamp
|
||||
class EqualizerPreamp: public VarPercent
|
||||
{
|
||||
public:
|
||||
EqualizerPreamp( intf_thread_t *pIntf );
|
||||
virtual ~EqualizerPreamp() {}
|
||||
|
||||
virtual void set( float percentage, bool updateVLC );
|
||||
|
||||
void set( float percentage ) { set( percentage, true ); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Cyril Deguet <asmax@via.ecp.fr>
|
||||
* Olivier Teulière <ipkiss@via.ecp.fr>
|
||||
* Olivier Teuli<EFBFBD>e <ipkiss@via.ecp.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,7 +28,7 @@
|
||||
#include "../utils/var_percent.hpp"
|
||||
#include <string>
|
||||
|
||||
/// Variable for VLC strem time
|
||||
/// Variable for VLC stream time
|
||||
class StreamTime: public VarPercent
|
||||
{
|
||||
public:
|
||||
|
@ -248,34 +248,37 @@
|
||||
<Button x="254" y="3" up="eq_switch_up" down="eq_switch_down" over="eq_switch_up" action="equalizer_window.setLayout(eq_small_layout)" tooltiptext="Switch" />
|
||||
<Button x="264" y="3" up="eq_close_up" down="eq_close_down" over="eq_close_up" action="equalizer_window.hide()" tooltiptext="Close the window" />
|
||||
<Checkbox x="15" y="18" up1="eq_notok_up" down1="eq_notok_down" up2="eq_ok_up" down2="eq_ok_down" state="equalizer.isEnabled" action1="equalizer.enable()" action2="equalizer.disable()" tooltiptext1="Enable equalizer" tooltiptext2="Disable equalizer" />
|
||||
<Slider value="equalizer.band(0)" x="78" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.preamp" x="21" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(1)" x="96" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(0)" x="78" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(2)" x="114" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(1)" x="96" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(3)" x="132" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(2)" x="114" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(4)" x="150" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(3)" x="132" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(5)" x="168" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(4)" x="150" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(6)" x="186" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(5)" x="168" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(7)" x="204" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(6)" x="186" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(8)" x="222" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(7)" x="204" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(9)" x="240" y="37" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<Slider value="equalizer.band(8)" x="222" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
<Slider value="equalizer.band(9)" x="240" y="39" up="eq_slider_up" down="eq_slider_down" points="(6,55),(6,7)" thickness="6" tooltiptext="">
|
||||
<SliderBackground image="eq_slider_bg" nbhoriz="14" nbvert="2" padhoriz="1" padvert="1" />
|
||||
</Slider>
|
||||
</Group>
|
||||
|
Loading…
Reference in New Issue
Block a user