V_Bang Volume_up Problem Thread last updated on 2006-09-09 19:37:32

Posted by member 335518 on 2006-07-16 02:02:57

I recently got the volume hotkeys on the front of my laptop to start working by using the v_bang and jkey edits from the wiki and they work fine. But when I go down to a volume of 0 and then try to hit the volume up button, the v_bang module errors with the message: LiteStep :: !Volume_up :: Error Exception during bang command execution. Bang parameters: 0

Just wondering if there's a quick coding fix to the edits I made to any of the files.

Here's a link to the wiki code by the way:
http://wiki.litestep.com/Enabling_special_keyboard_keys

Posted by member 5575 on 2006-07-16 02:44:26 link

Hmmm, that's funny. I use a different volume module (umslider) and still get the same exception. :\

I can set the volume to a specific level and *then* use the up and down bangs, but something goes wrong with them once you're at zero. So... I can't help you, but I can sympathize. =P

UPDATE: Ok, I think I found the problem, assuming the v_bang source is similar to the umslider source. The snippet of code looks like so:

void CVolumeControl::VolumeUp(int channel)
{
int left, right, balance;

GetVolume(channel, left, right);
if (right > left)
{
balance = 100 * left / right;
right += 655 * VOLUME_STEP;
if (right > 65535) right = 65535;
left = balance * (right / 100);
}
else
{
balance = 100 * right / left;
left += 655 * VOLUME_STEP;
if (left > 65535) left = 65535;
else
right = balance * (left / 100);
}
SetVolume(channel, left, right);
}


The volume is computed by
a) determining the balance (right/left)
b) changing the left channel volume, and then
c) multiplying left*balance to get right.

When left and right are zero, step a) causes a problem (0/0, balance not well defined). If none of the original module authors step in and fix this, I can update the code and compile a new version for you. And me. And anyone else who's been annoyed by this. =)

Posted by member 335518 on 2006-07-16 03:26:24 link

Heh, forgot to post it in the Module section, but thanks for the reply. I guess for now I'll just have to hit the mute button and try to keep the volume away from 0.

Posted by member 212670 on 2006-07-16 03:26:26 link

That was fixed with "v_bang-lite". (Just tested it.)

Posted by member 5836 on 2006-09-09 10:54:26 link

:/ still doesn't work for me.

I keep getting error messages with the v_bang module.

Posted by member 5575 on 2006-09-09 19:37:32 link

Try using umslider-0.3. The bang syntax is changed slightly, so be sure to read the docs. Oops, wait, same bug still exists there, too. I'll have to fix it and release 0.4. ;)