View Full Version : Lua help...
JSMain
December 24th, 2003, 01:13 PM
I am trying to figure out how to create a LUA script that will determine the mute state of a sound card, and if muted, flash an OSD every couple seconds as a visual indicator.
I have run into a couple situations where when I power up my system, the mute is active, and I thought it was my sound card acting up. There is no reason that the mute should have been active when shut down, but anyway, I would like to do this to keep me from going insane for no reason. LOL
Any suggestions?
Promixis
December 24th, 2003, 01:39 PM
Shouldn't be to hard.... :)
Just use the volume command to get the mute status into register 25. Then use lua to test the value 1=mute, 0= no.
In a future version of Girder, the volume commands will be integrated into lua.
You can also do this using luacom and an activex control. Search the net for VRMixer. This would allow you to do it all in lua. You can then even have an event generated when the card goes into a mute state! I have written some code to this if interested.
Mike
Francois
December 24th, 2003, 07:49 PM
JSMain,
The bad news is not all cards follow the Windows standard. For instance, the approach that Mike suggested won't work with M-audio cards.
The good news is, if Mike suggestion doesn't work, there are workarounds (If you do have an M-audio card, PM me, and I'll share with you what I did to control the volume and mute state of my M-audio delta 410)
Eiffel
JSMain
December 25th, 2003, 08:46 AM
Thanks to you both. I should be a bit clearer. I can already determine the reg25 setting. My problem is getting the result out of LUA to trigger a new command. I don't quite understand the triggerevent command. And to be honest, I'm not to up on LUA as yet (LUA Newbie still in diapers).
Again, as long as it is in the mute state, I wish for it to loop a command that triggers the Mute OSD untill the state has changed to not muted. The end result is a flashing OSD until released.
For thetime being, I have created a startup command that un sets the mute state. It is still desirable that when I set the mute state that I get a visual indicator as a reminder.
Promixis
December 25th, 2003, 11:46 AM
okay, well you could set up a script something like this (they are many ways to do this - which is part of the fun of Girder.
Set up a comand to display the mute OSD.
Setup an alarm timer that fires say every 30 seconds or so. It should point to a multi group.
The first command loads the mute value.
The second command is a Lua script
print (reg25) -- not need but can use for debuging..
result = reg25
Then, on the lua script command, bottom right hand corner, you will see name and a browse button. Set the first one to point to the command that displays the mute OSD using the browse button.
Hard to explain, but hopefully makes sense :)[/code]
Promixis
January 12th, 2004, 11:41 AM
The latest version of girder now includes a plugin which generates event for any change in the mixer. ie. if a line is muted or volume is changed an event is generated.
Ron
January 12th, 2004, 12:18 PM
Hold off on using LuaVolume since we changed the return values for the functions.... I'll update the release asap.
Promixis
February 4th, 2004, 04:00 AM
Did you ever get this working?
JSMain
February 4th, 2004, 05:12 AM
I had held off!
Time hasn't been to free as of late anyhow.
Hope to get back to this soon.
Liickdude
February 4th, 2004, 07:35 AM
I have this function working well on my system, however, there is a bit of a difference in how I did it. Rather than querying the mute status, I use girder to toggle mute on and off, then I can always assume the mute state. If girder mutes the volume, and sets a reg value to 1, then unmutes and sets the reg value to 0, you can simply query the reg value. I also have the benefit of controlling mute over the serial port, so I can send discreet mute on and mute off commands. If you use some LUA to measure your volume level, then you can check volume, save the current level to a value, then mute the volume, flash to OSD and return to the previous volume setting when you toggle it off. The trickiest part was getting a flashing OSD, as using the wait function in girder caused the whole system to freeze up as it waited between flash on and flash off intervals. Bitmonster was kind enough to provide some script that makes setting timed interval events very simple, and the XP-OSD has a function to clear the OSD message. Check out this post for how to do it:
http://www.girder.nl/phpBB2/viewtopic.php?t=5642&highlight=flashing
JSMain
February 4th, 2004, 08:01 AM
The problem I had was at startup.
I would boot my system at a gig, and with 3 sound cards this confuses things a little, but I would begin a track in my DJ software, and there would be no music output. There was no reason for the mute to be set, but investigation at home, I came to the conclusion that mute was set on this sound card.
I have a script configured to start my program, and have placed a work around in this script.
It opens my light control software, then my DJ software, and sets mute to disabled. Mo more fear of sound card gone bad. That is what I was after, so I guess I am happy.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.