commands/async_queue.hpp \
commands/cmd_add_item.cpp \
commands/cmd_add_item.hpp \
+ commands/cmd_audio.cpp \
+ commands/cmd_audio.hpp \
commands/cmd_dummy.hpp \
commands/cmd_generic.hpp \
commands/cmd_change_skin.cpp \
--- /dev/null
+/*****************************************************************************
+ * cmd_audio.cpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Cyril Deguet <asmax@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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#include "cmd_audio.hpp"
+#include <vlc/aout.h>
+#include "aout_internal.h"
+#include <string>
+
+void CmdSetEqualizer::execute()
+{
+ // Get the audio output
+ aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
+ VLC_OBJECT_AOUT, FIND_ANYWHERE );
+
+ // XXX
+ string filters;
+ if( m_enable)
+ {
+ filters = "equalizer";
+ }
+
+ if( pAout )
+ {
+ var_SetString( pAout, "audio-filter", (char*)filters.c_str() );
+ for( int i = 0; i < pAout->i_nb_inputs; i++ )
+ {
+ pAout->pp_inputs[i]->b_restart = VLC_TRUE;
+ }
+ vlc_object_release( pAout );
+ }
+ else
+ {
+ config_PutPsz( getIntf(), "audio-filter", filters.c_str() );
+ }
+}
+
--- /dev/null
+/*****************************************************************************
+ * cmd_audio.hpp
+ *****************************************************************************
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Cyril Deguet <asmax@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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#ifndef CMD_AUDIO_HPP
+#define CMD_AUDIO_HPP
+
+#include "cmd_generic.hpp"
+
+/// Command to enable/disable the equalizer
+class CmdSetEqualizer: public CmdGeneric
+{
+ public:
+ CmdSetEqualizer( intf_thread_t *pIntf, bool iEnable ):
+ CmdGeneric( pIntf ), m_enable( iEnable ) {}
+ virtual ~CmdSetEqualizer() {}
+
+ /// 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"; }
+
+ private:
+ /// Enable or disable the equalizer
+ bool m_enable;
+};
+
+
+#endif
#include "interpreter.hpp"
#include "expr_evaluator.hpp"
+#include "../commands/cmd_audio.hpp"
#include "../commands/cmd_muxer.hpp"
#include "../commands/cmd_playlist.hpp"
#include "../commands/cmd_playtree.hpp"
REGISTER_CMD( "vlc.minimize()", CmdMinimize )
REGISTER_CMD( "vlc.onTop()", CmdOnTop )
REGISTER_CMD( "vlc.quit()", CmdQuit )
+ m_commandMap["equalizer.enable()"] =
+ CmdGenericPtr( new CmdSetEqualizer( getIntf(), true ) );
+ m_commandMap["equalizer.disable()"] =
+ CmdGenericPtr( new CmdSetEqualizer( getIntf(), false ) );
// Register the constant bool variables in the var manager
VarManager *pVarManager = VarManager::instance( getIntf() );
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
- m_varVoutSize( pIntf ), m_varEqBands( pIntf ), m_pVout( NULL ),
- m_pAout( NULL ), m_cmdManage( this )
+ m_varVoutSize( pIntf ), m_varEqBands( pIntf ),
+ m_pVout( NULL ), m_pAout( NULL ), m_cmdManage( this )
{
// Create a timer to poll the status of the vlc
OSFactory *pOsFactory = OSFactory::instance( pIntf );
REGISTER_VAR( m_cVarStopped, VarBoolImpl, "vlc.isStopped" )
REGISTER_VAR( m_cVarPaused, VarBoolImpl, "vlc.isPaused" )
REGISTER_VAR( m_cVarSeekable, VarBoolImpl, "vlc.isSeekable" )
+ REGISTER_VAR( m_cVarEqualizer, VarBoolImpl, "equalizer.isEnabled" )
#undef REGISTER_VAR
m_cVarStreamName = VariablePtr( new VarText( getIntf(), false ) );
pVarManager->registerVar( m_cVarStreamName, "streamName" );
void VlcProc::refreshAudio()
{
+ char *pFilters = NULL;
+
// Check if the audio output has changed
aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
VLC_OBJECT_AOUT, FIND_ANYWHERE );
- if( pAout != NULL )
+ if( pAout )
{
if( pAout != m_pAout )
{
onEqBandsChange, this ) )
{
m_pAout = pAout;
-
//char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
}
}
+ // Get the audio filters
+ pFilters = var_GetString( pAout, "audio-filter" );
vlc_object_release( pAout );
}
+ else
+ {
+ // Get the audio filters
+ pFilters = config_GetPsz( getIntf(), "audio-filter" );
+ }
// Refresh sound volume
audio_volume_t volume;
// Set the mute variable
VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
pVarMute->set( volume == 0 );
+
+ // Refresh the equalizer variable
+ VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
+ pVarEqualizer->set( pFilters && strstr( pFilters, "equalizer" ) );
}
VarBox m_varVoutSize;
/// Equalizer variable
EqualizerBands m_varEqBands;
+ VariablePtr m_cVarEqualizer;
/// Set of handles of vout windows
/**
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 );
if( pAout )
{
// Update the audio output
- var_SetString( pAout, "equalizer-bands", (char*)ss.str().c_str() );
+ var_SetString( pAout, "equalizer-bands", bands );
vlc_object_release( pAout );
}
}