View Full Version : Volume level from scripts?
DaninFuchs
2007-03-20, 08:08
Hey all. First off, I have to say, I love XBMC. And I love my car audio. So, I put the two together... Here's the problem though:
I've rigged up a system with over 3000 watts of power in my car. I've got three amps, two line-level EQs, an in-dash LCD, and more cables than most people would know what to do with. I'm pushing just shy of 118db. I also have an XBox running off a custom made power supply. Here's where it gets interesting: My XBox is plugged directly into the EQs, straight to the amps, straight to the speakers. XBMC comes up at 0db. This is bad, because at 0db output on the XBox, my speakers would give a single very valliant effort at shattering my glass/eardrums, burning up the amps, and destroying the entire project.
I need a way to set XBMC's volume output on start-up through the autoexec script, but I can't find the scripting command to do so. I've looked at the docs rar files, I've browsed tutorials, I don't know where else to look. I'm starting to suspect the command doesn't exist, so perhaps I should file a feature request, however I felt I should verify it's NOT a feature before that.... I'd like it to default to a tolerable level upon boot, and let me manage the rest. I've got my remote keymapped, so once it's booted I'm golden, but until then, evil things happen.... Any help would be appreciated.
If you looked harder than bragging up your system, you would have found..
http://www.xboxmediacenter.com/wiki/index.php?title=List_of_Built_In_Functions -> XBMC.SetVolume(percent)
or even
http://www.xboxmediacenter.com/wiki/index.php?title=WebServerHTTP-API -> http://xbox/xbmcCmds/xbmcHttp?command=setvolume¶meter=80
DaninFuchs
2007-03-21, 02:58
Actually, I did look. As stated, I searched several references. I couldn't find that in the wiki, and I'm sure you'll excuse me for not taking note of the WebServerHTTP-API link, being that I'm looking for Python Scripting Reference, and they're more than vaguely unrelated. Thanks for the help, nevermind the needless bash. I was not 'bragging up my system' but rather providing my reasoning for the requirement. More than once, I've seen worthless comments such as "Why would you need to do that in a script? Just turn it down yourself."
It was also intended to be phrased as something comical, or to perhaps spur discussion. I appreciate your taking a few minutes to help, though I'd also have appreciated taking two seconds to consider your reply. Enjoy your perfection, I suppose, the rest of us here on Earth aren't quite there yet.
jmarshall
2007-03-21, 03:11
Also, XBMC should use the previously saved volume level. It saves it on exit, assuming you power down using the soft power off, rather than the power button on the xbox.
You could probably reasonably easily mod XBMC so that it hardcodes a preset volume level for you. Check for the initial volume setting in Application.cpp.
I presume you have modded the xbox startup so it doesn't play that horrible sound already during the X logo?
Cheers,
Jonathan
DaninFuchs
2007-03-21, 03:49
jmarshall - Yes, I did assume it would use previously saved volume level, but I don't want to risk anything. However, I don't have a method to soft-power the box when I shut the car off - I really wish I did.
I could also edit the source, but until last night I did not have the XDK - I'll likely do that, since both of the links listed don't apply. The built-in functions link is for skinning, not scripting. The functions don't seem to work for scripting.
Yes, I'm using IND-5003, and have the startup sound disabled - I wish I could simply skip the animation entirely, but I get no video when I do that. However, that's for a different forum...
Thanks for your input - I'll likely hard-code a volume limiter and default it to 10% (ish) on boot.
jmarshall
2007-03-21, 03:53
The functions do work for scripting - you can execute any of the builtin functions from python using xbmc.executebuiltin().
Good luck :)
Cheers,
Jonathan
DaninFuchs
2007-03-21, 04:16
Okay, I figured it out. I was being a dunce and forgot about the script command allowing execution of builtin functions. hooray.
DaninFuchs
2007-03-21, 05:14
If only I could figure out how to trigger the vis, now... ActivateWindow doesn't seem to want to work..
Try sleeping for a bit... I dont think you can activate the fullscreen window immediately after you start playing due to threading issues.
DaninFuchs
2007-03-21, 20:04
I did think of that - I tried 30 and 45 seconds. Didn't fire properly still, but thanks for the input. Maybe I'll start a second thread and get lambasted for something 'obvious' again... If I can't figure it out, no huge thing - I have the screensaver set to vis during playback, and down to one minute. Maybe I can trick it into running after 30 seconds by putting a non-integer directly into the .xml file for the screensaver delay..
stanley87
2007-03-22, 01:06
boy, do i have the thing for you
MY xbox is going in my car so i wrote a nice little script:
Link:
http://www.xbmcscripts.com/index.php?option=com_docman&task=search_result&Itemid=Array&search_mode=phrase&search_phrase=ResumeX%20v0.4
This constantly saves all xbox data about every 2seconds, perfect for resuming last song/video playing/last volume level, etc
You should also disable your XBMC startup sound as this is always loud and volume of this can't be changed.
Keep posted about a new release of this with more features (it will be able to disable/enable startup sound, change save data time intervals etc etc)
Let me know how it works for you :-D
stanley87
2007-03-22, 01:09
also, if you shut off xbox suddenly, this script still remembers, so if you are playing eg. Tool - Right In Two at 3:45sec in fullsceen viz, and your xbox shuts off with car ACC. Turn it on, and watch the magic! (right back to where it was)
DaninFuchs
2007-03-22, 07:46
Hey, that's cool. I don't really mind much if it doesn't right where I was, but that's just the extra little detail in the icing on the cake. Now if only the vis would fire sooner...... Heheh. Thanks man. When I get it all pieced together, I'll have to send you a few pics..
xbmc.executebuiltin("xbmc.activatewindow(12006)")
This activates fullscreen visualizations in my script.
Meat_PoPsiclez
2007-03-26, 00:04
boy, do i have the thing for you
MY xbox is going in my car so i wrote a nice little script:
Link:
http://www.xbmcscripts.com/index.php?option=com_docman&task=search_result&Itemid=Array&search_mode=phrase&search_phrase=ResumeX%20v0.4
This constantly saves all xbox data about every 2seconds, perfect for resuming last song/video playing/last volume level, etc
You should also disable your XBMC startup sound as this is always loud and volume of this can't be changed.
Keep posted about a new release of this with more features (it will be able to disable/enable startup sound, change save data time intervals etc etc)
Let me know how it works for you :-D
That seems pretty cool, BUT, since the xbox in question is not going through a safe (soft) shutdown.. there's a huge chance for data corruption on the harddrive if you're constantly writing to it (plus writing the same space on the hd every two seconds is a sure way to create some bad sectors).
stanley87
2007-03-26, 01:13
The time it takes the script to write the file is so minitature that the chance of the xbox shutting down at the excact time the xbox turns off is not very likely (i havnt faulted it). I dont know about the bad sectors thing. But my future release of this will have changable time for it to save, plus, a backup feature, so if the first file is corrupt, it will use the one it saved before that one.