
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Key aliases for iViewer mode
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[Protocol]=iViewer

SETUP_DEFAULT_MIXER=\
	Macro(SETUP_AMIXER,pactl -h|grep set-sink-mute|wc -l);\
	Macro(SETUP_PACTL);

% SETUP_PACTL will be executed only if SETUP_AMIXER not executed

SETUP_AMIXER=\
	Make(var,default_mixer_up,by_value,amixer sset Master,0 5%- -q);\
	Make(var,default_mixer_down,by_value,amixer sset Master,0 toggle -q);\
	Make(var,default_mixer_mute,by_value,amixer sset Master,0 5%- -q);\
	Make(var,default_mixer_get,by_value,amixer sget Master,0|grep "\["|head -1|cut -f 6 -d ' '|tr -d ' ');\
	Make(var,default_mixer_set,by_value,amixer -q sset Master,0 );

SETUP_PACTL=\
	Make(var,default_sink,LANG=C;pactl stat|grep "Default Sink"|cut -f 2 -d ":"|tr -d ' ');\
	Make(var,default_mixer_down,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh down $(default_sink));\
	Make(var,default_mixer_up,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh up $(default_sink));\
	Make(var,default_mixer_mute,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh mute $(default_sink));\
	Make(var,default_mixer_get,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh get $(default_sink));\
	Make(var,default_mixer_set,by_value,$(CfgDir)/Utils/pulse-audio-ctl.sh set $(default_sink) );

DEFAULT_VOLUME_UP=\
    Exec($(default_mixer_up));

DEFAULT_VOLUME_DOWN=\
    Exec($(default_mixer_down));

DEFAULT_TOGGLE_MUTE=\
    Exec($(default_mixer_mute));

% default_mixer_value in range 0 - 65535
DEFAULT_VOLUME_GET=\
	Make(var,mixer_value,$(default_mixer_get));\
	Make(var,default_mixer_value,echo "$(mixer_value)*65535/100"|bc);

DEFAULT_VOLUME_SET=\
	Make(var,mixer_value,echo "$(default_mixer_value)*100/65535"|bc);\
	Exec($(default_mixer_set) $(mixer_value));

% Password p(PASSWORD)"
p($$)=Send(string,p=ok);Send(bytes,3);

[End]
