Add a volume control to xbmc with dvd remote

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
W@tcher Offline
Junior Member
Posts: 2
Joined: Dec 2004
Reputation: 0
Post: #1
note!! xbmc just changed as of 02/01/2005 - they've added remote volume control support for the media center extender remote. this uses the same global volume definitions as those in this tutorial. therefore, the tutorial applies (for now) only for those of you without a media center extender remote.


this short tutorial may be useful for those of you that find controlling volume within xbmc is a pain in the ass if you're not using a gamepad or keyboard. this is particularly pertinent if you've chosen to add an external set of nice/loud speakers into the scenario, where those speakers don't have their own remote volume control associated with their external amp, or if you use xbmc with an xlcd, and don't necessarily want your television on just to play music. in these cases, it is nice to be able to control the volume with the dvd remote as well as the normal sources.

to achieve this, you must make a rather simple customisation of the keymap.xml file for your xbmc build to map the volume controls onto a couple of infrequently used keys on the dvd remote. i chose button 3 for volumeup and button 9 for volumedown (the changes i describe in this tutorial are for those buttons - don't choose different ones unless you understand the keymappings well, as it's easy to choose buttons that are already assigned to other functions).

warning!
you should ensure that you keep a backup of keymap.xml to make restoring back to the defaults a trivial process by renaming or recopying your backup to keymap.xml via ftp. this will save you if you somehow fudge up your customised keymap.xml file.


1. backup keymap.xml, by either;

a. copy original file to keymap.old via some file manager
b. ftp a copy of the original file to an external location that you keep


2. open your keymap.xml for edit - usually you'll do this on your pc. you'll see a number of sections within the xml definitions for mapping of keys on the gamepad, keyboard, and dvd remote control. the first section is global mappings, just after the comments;

Quote:<!-- this file contains the mapping of keys (gamepad and remote) to actions within xbmc -->
<!-- see the guilib\key.h file for the definition of the windows, actions, and keys. -->
<!-- the <global> section is a fall through - they will only be used if the button is not -->
<!-- used in the current window's <window> section.  note that there is only handling for -->
<!-- a single action per button at this stage. -->
<!-- the remotecode tags are only needed if you intend to map buttons from other remotes. -->
<!-- in this case, the remotecodes are the obcs (original button codes) in the rca 5 protocol -->

<!-- note that you can use a builtin function as the id, eg <id>xbmc.activatewindow(501)</id> -->
<!-- would automatically go to my music on the button press. -->

<!-- mod 18/12/2004 w@tcher - remove global remote 3 and 9 definitions, reassign to volumeup and volumedown -->

<keymap>
 <global>
   <action>
     <description>remote button 0</description>
     <id>58</id>
     <remote>0</remote>
   </action>
   <action>
     <description>remote button 1</description>
     <id>59</id>
     <remote>1</remote>
   </action>
...etc



3. remove the global action definitions for remote button 3 and remote button 9 - they look like this;


Quote:    <action>
     <description>remote button 3</description>
     <id>61</id>
     <remote>3</remote>
   </action>


simply delete the entire section for each button, including the opening and closing action tags. note; you do not need to delete the actions for other numbered buttons on the dvd remote, just the two buttons you have chosen.


4. find the volumeup and volumedown sections within globals - they look like this in an unmodified keymap.xml file;

Quote:    <action>
     <description>volumeup</description>
     <id>88</id>
     <gamepad>rightthumbstickup</gamepad>
     <keyboard>+</keyboard>
   </action>



5. add the dvd remote controls to each volume action - for example, volumeup will look like this when appended correctly;

Quote:    <action>
     <description>volumeup</description>
     <id>88</id>
     <remote>3</remote>
     <remotecode></remotecode>
     <gamepad>rightthumbstickup</gamepad>
     <keyboard>+</keyboard>
   </action>



6. save your new keymap.xml file to the root folder of your xbmc install (usually this is e:\apps\xbmc). then reboot xbmc and test your new volume control.


notes
you will find in some screens that further definitions for buttons 3 and 9 (in this example) have been mapped onto specific other functions. for example, when in a playlist, button 3 moves an item up a playlist, and button 9 moves an item down a playlist. this customisation of global actions does not override these specific mappings, and so they will continue to work as expected. to control the volume using your new button assignments, simply move back to another screen (like home).

also note that the above applies when playing back a dvd or video. make your own choice about whether or not to override the default action here. i chose not to, mainly because i'm listening to audio through my television when playing back dvd or video so i personally find an extra volume control doesn't get used very much there.

please use the above at your own risk, it is provided as is without support. enjoy.
find quote