Page 1 of 1

MUTE function?

Posted: Fri Nov 24, 2006 1:32 pm
by mchaffer
Hi there,

Congrats on NJB, I'm happy to stumble across such a useful set of scripts.

One feature would be useful to me is a Mute function in the playlist.

example:

Mute ON stores the current volume, sets Winamp volume to zero.

Then you can either:

- Increase the volume manually from zero (turns Mute OFF)
- Or click Mute OFF to restore the pre-mute Winamp volume.


Would this be something worthwhile to add? I'm happy to help out by designing the mute button(s), but it might be a while before I would be up to contributing any code.

If you don't think it's worth doing, then I'll get busy making mute work with my TIRA I/R controller and Girder =)

Thanks!

Posted: Sat Dec 02, 2006 11:29 am
by wbartels
I think it is a great idea mchaffer.

I will store the volume somewhere in the configuration_httpq database table.
So it is related to the selected httpQ profile.

Visual I want to make it this way:
When pressing the numeric volume (75% or other) it will change the "75%" in "mute" and gray out the volume bar the same way like disabled shuffle, repeat, play and pause.
This way also another web browser sees what volume was set before pressing "mute".

Posted: Thu Dec 07, 2006 8:59 am
by wbartels
It will take a while before the next netjukebox with mute functionality will be ready.

If you like to experiment in the meantime, here is a working mute function.
Place it in the httpq.php.
You also have to add a field "mute_volume" smallint(5) UNSIGNED to the "configuration_httpq" table.

Code: Select all

if	($action == 'ToggleMute')		ToggleMute();



//  +---------------------------------------------------------------------------+
//  | Toggle Mute                                                               |
//  +---------------------------------------------------------------------------+
function ToggleMute()
{
global $cfg;
authenticate('access_play');
require_once('include/httpq.inc.php');

$volume	= httpq('getvolume');

if ($volume == 0)
	{
	$query = mysql_query('SELECT mute_volume FROM configuration_httpq WHERE httpq_id = ' . $cfg['httpq_id']);
	$mute_volume = @mysql_result($query, 'mute_volume');
	
	httpq('setvolume', 'level=' . $mute_volume);
	mysql_query('UPDATE configuration_httpq
				SET mute_volume = 0
				WHERE httpq_id = ' . $cfg['httpq_id']);
	}
else
	{
	httpq('setvolume', 'level=0');
	mysql_query('UPDATE configuration_httpq
				SET mute_volume = ' . (int) $volume . '
				WHERE httpq_id = ' . $cfg['httpq_id']);
	}
}


Now you can call the mute function like this:

Code: Select all

<a href="httpq.php?action=ToggleMute" target="dummy">mute</a>
IMPORTEND:
When going to updating to a next netjukebox version always leave/make the database structure as it was.
In this case remove "mute_volume" from the "configuration_httpq" table.

Posted: Wed Dec 20, 2006 10:56 am
by mchaffer
wbartels wrote:It will take a while before the next netjukebox with mute functionality will be ready.

If you like to experiment in the meantime, here is a working mute function.
Thanks I'll give it a try =) Sorry I've been away for a while - ripping all my CDs!

Posted: Fri Aug 17, 2007 1:39 am
by wbartels
Mute functionality is implemented in the playlist since netjukebox 4.00 beta 1.