View Full Version : Lost in translation - GetDeviceCount
Mastiff
May 22nd, 2005, 04:49 AM
I have this code to find the number of a certain sound card and mute it:
require("AudioMixer")
local x = 0
SBLiveDeviceNum = nil
while x < GetDeviceCount () do
if strfind (GetDeviceName (x),"Live") then
SBLiveDeviceNum = x
break
end
x = x + 1
end
if not SBLiveDeviceNum then
print ("not found")
else
print (SBLiveDeviceNum)
err = SetSourceMute (SBLiveDeviceNum,0,8,0)
end
In G4 this returns:
attempt to call global `GetDeviceCount' (a nil value)
I tried adding require("AudioMixer") but that didn't change anything. Any pointers would be gratefully received.
Rob H
May 22nd, 2005, 05:01 AM
All those functions are now to be found in the mixer table e.g. mixer.GetDeviceCount
birty
May 22nd, 2005, 07:18 AM
dont forget the variable inspector which gives a list of all available lua functions (Ron a search function may be useful)
Mastiff
May 22nd, 2005, 08:13 AM
Thanks! Found it, and it's working. A short search & replace in my Peter's XML editor will fix that. I wish G4 had a GML-wide search & replace function, so I could change something in all scripts!
Rob H
May 22nd, 2005, 08:19 AM
That's one of the reasons I tend to prefer external .lua files
Mastiff
May 22nd, 2005, 08:23 AM
And of course having such a function would probably lead to around 200 newbies messing up their GMLs every hour... :wink: "This function is for power users only - you need an extra registration and must be able to prove that you know what you're doing." Sort of like when buying a Ferrari F-50.
Ron
May 23rd, 2005, 01:14 PM
G4- has a loaded-gml-wide search funtion. Just use the search on the main Girder window (as long as you don't have the scripting action selected).
Mastiff
May 23rd, 2005, 02:33 PM
Nice! Could that be expanded to replace as well? It would solve many problems (but it doesn't look like it will for instance find all instances of "302", which is the device ID for the old Internet Event server, which I have replaced with 203, for the new communications server. Then again, that's not something I would have to do that often... :wink:
Ron
May 23rd, 2005, 02:34 PM
Sorry, that wil not likely include the replace functionality :-)
Mastiff
May 23rd, 2005, 02:44 PM
No problem. I can use Peter's XML editor, it works around 90 % of the times. And the 10 % it doesn't work it is because of a known error between the chair and the keyboard...
Ron
May 23rd, 2005, 02:58 PM
:lol:
Rob H
May 23rd, 2005, 03:17 PM
Nice! Could that be expanded to replace as well? It would solve many problems (but it doesn't look like it will for instance find all instances of "302", which is the device ID for the old Internet Event server, which I have replaced with 203, for the new communications server. Then again, that's not something I would have to do that often... :wink:
Um... 203 is the old IES - I think ComServ is 232 (from memory)
Mastiff
May 23rd, 2005, 03:22 PM
Told you about the error between the keyboard and the chair! :wink: Yes, I replaced all instances of 203 with 232.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.