Here is some code to add functionality to the MS remote for music playback (globally, the functions work in any menu). You can change songs, switch playback type, mute, stop, start, and switch soundtracks. It's pretty much just copy and paste, no modification of current code.
Skip+ --> next song
Skip- --> previous song
Pause --> mute/unmute
Stop --> stop
Play --> play
Forward --> next soundtrack
Reverse --> previous soundtrack
Title --> change between 'random' and 'continuous'
All code goes in default.xap --> default.xip
Add this one variable declaration at the top with all the other global variables
Find CODE |
DEF theBackgroundMusicPlayer AudioClip { blah blah blah } |
After this definition (after it's closing bracket), add the rest of this code.
CODE |
function OnPlay() { if(BGMon == false) { BackgroundMusicOn(); } }
function OnStop() { if(BGMon == true) { BackgroundMusicOff(); } }
function OnPause() { if(BGMon == true) { if(theBackgroundMusicPlayer.volume > 0) { BGMoldVol = theBackgroundMusicPlayer.volume; theBackgroundMusicPlayer.volume = 0; } else if(theBackgroundMusicPlayer.volume == 0) { theBackgroundMusicPlayer.volume = BGMoldVol; } } }
function OnSkipForward() { if(BGMmode == "Random") { BGMPlayerRandom(); if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } } else if(BGMmode == "Playlist") { BGMPlayerPlaylistFFWD(); if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } } else if(BGMmode == "Continuous") { BackgroundMusicFFWD(); if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } } }
function OnSkipBack() { if(BGMmode == "Random") { BGMPlayerRandom(); if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } } else if(BGMmode == "Playlist") { BGMPlayerPlaylistREW(); if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } } else if(BGMmode == "Continuous") { BackgroundMusicREW(); if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } } }
function OnForward() { BackgroundMusicUpSDTRK();
if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } }
function OnReverse() { BackgroundMusicDwnSDTRK();
if((theDashSettings[51] == "true") & (temp != true)) { var c = theMainMenu.children[0].children[0]; c.theNowPlaying_text.text = vCurAlbum + "n" + vCurSong; } if(g_bAudioDisplayed == true) { var d = theMessageInline.children[0]; d.theNowPlaying_text_01.text = vCurSong; } }
function OnGuide() { if(BGMmode == "Random") { BGMmode = "Continuous"; } else if(BGMmode == "Continuous") { BGMmode = "Random"; } }
|
In the BackgroundMusicOn() function, fix this typo in tHc's release:
CODE |
else if(BGMmode = "Continuous") |
should be
CODE |
else if(BGMmode == "Continuous") |
You're just adding the double equals for equality instead of assigning the value.
Hope this helps some people out. Maybe something like this (or this code itself ) will be included in the next release. It really makes it nice to just use the remote for the music.