xboxscene.org forums

Author Topic: Play Specific Soundtrack But Random Song?  (Read 85 times)

chandlerdepmode

  • Archived User
  • Newbie
  • *
  • Posts: 7
Play Specific Soundtrack But Random Song?
« on: October 05, 2003, 12:40:00 PM »

Of course i got the ranadom soundtrack with random song to work in the background without any trouble. but im having a little trouble understanding the syntax of it.  I want to edit the code to play from a specific sountrack.  i.e. i dont want the random code to choose a track from any soundtrack i want it to choose from  just 1 soundtrack. (i dont want to delete my other soundtracks, thats just stupid)

any ideas? <_<  <_<  <_<

thanks :P  
Logged

chandlerdepmode

  • Archived User
  • Newbie
  • *
  • Posts: 7
Play Specific Soundtrack But Random Song?
« Reply #1 on: October 05, 2003, 12:52:00 PM »

Instead of using this to define a random soundtrack i cant figure out how to define the soundtrack i want
CODE
BGMCount = theBackgroundMusicCollection.GetSoundtrackCount();
BGMst = Math.random() * BGMCount;  //select random soundtrack from collection
BGMTracks = theBackgroundMusicCollection.GetSoundtrackSongCount(BGMst);
BGMtr = Math.random() * BGMTracks;  //select random song from soundtrack
theBackgroundMusicPlayer.url = "st:" + theBackgroundMusicCollection.GetSoundtrackSongID(BGMst, BGMtr);//tell player what u want to play


and what does "st:" stand for?  
Logged

Mordenkainen

  • Archived User
  • Sr. Member
  • *
  • Posts: 447
Play Specific Soundtrack But Random Song?
« Reply #2 on: October 05, 2003, 01:23:00 PM »

soundtrack I think!
Logged

Gcue

  • Archived User
  • Jr. Member
  • *
  • Posts: 63
Play Specific Soundtrack But Random Song?
« Reply #3 on: October 05, 2003, 10:03:00 PM »

My guess would be to find out which number the soundtrack is in your st.db file.
Im thinking they are in the order of which you placed them on the xbox.

You could go into your /E/TDATA/fffe0000/music/ folder on your xbox and try out a few files and that should tell you about where your soundtrack would be located.

Then after you find out which number soundtrack it is ( don't know if it goes off the number of the folder or if it just goes from 1 - how many soundtracks you have but you can play with it to see)

Set:

CODE
BGMst = Soundtrack#;


Soundtrack# of course would be the number of your soundtrack

Like for example if it was the 1st soundtrack you added to your xbox and it is in the first folder the it would look like this:

CODE
BGMst = 1;


Now it isn't tested so im not sure on 1 or 0 but it should be one or the other.
I hope i helped you out some.

Peace,
Gcue
Logged

iceweasel

  • Archived User
  • Newbie
  • *
  • Posts: 5
Play Specific Soundtrack But Random Song?
« Reply #4 on: October 06, 2003, 01:08:00 AM »

Gcue is right, BGMst is the var you want.  Also it is 0 based, so if you want the fist soundtrack use
CODE
BGMst = 0;

(replace "BGMst = Math.random() * BGMCount;")

You can also try setting BGMst elseware in default.xap. Say under the button input section...
CODE
function OnRightDown()
{
   BGMst = BGMst + 1;
}
and the same for OnLeftDown() (only decrementing). That way you would be able to change what soundtrack the randomizer chooses a song from.
Of course then you would have to worry about not selecting an invalid soundtrack:
[under "BGMCount = theBackgroundMusicCollection.GetSoundtrackCount();"]
CODE
if (BGMst < 0)
   BGMst = 0;
else if (BGMst > BGMCount)
   BGMst = BGMCount - 1;


I know this goes outside of the scope of the question, but hey, it might give you something to do if you get bored :)

Disclaimer: I have not tested some of the above code after typing it (read: possible syntax errors:)), so it may or may not work as is.  It can be made to work though, as I'm using it (well, plus alot more) in my lite music player.  (BGM code extended to allow full control instead of randomizing.)

This post has been edited by iceweasel: Oct 6 2003, 08:23 AM
Logged

chandlerdepmode

  • Archived User
  • Newbie
  • *
  • Posts: 7
Play Specific Soundtrack But Random Song?
« Reply #5 on: October 06, 2003, 05:51:00 AM »

That makes sense... ill fool around with it a little bit and post my results when i get it working.

thanks guys :D  
Logged

chandlerdepmode

  • Archived User
  • Newbie
  • *
  • Posts: 7
Play Specific Soundtrack But Random Song?
« Reply #6 on: October 06, 2003, 08:28:00 AM »

ah... after i messed around for a couple minutes with it, what both of you said was accurate.  starting with 0 does work so for example
replacing
CODE
"BGMst = Math.random() * BGMCount;"

with
CODE
BGMst = 0;
 does work if i wanted to just use the first soundtrack then changing 0 to 1 if i wanted to use the second soundtrack and so on..

iceweasel:
QUOTE
You can also try setting BGMst elseware in default.xap. Say under the button input section...
CODE 
function OnRightDown()
{
   BGMst = BGMst + 1;
}
and the same for OnLeftDown() (only decrementing). That way you would be able to change what soundtrack the randomizer chooses a song from.
Of course then you would have to worry about not selecting an invalid soundtrack:
[under "BGMCount = theBackgroundMusicCollection.GetSoundtrackCount();"]
CODE 
if (BGMst < 0)
   BGMst = 0;
else if (BGMst > BGMCount)
   BGMst = BGMCount - 1;


I know this goes outside of the scope of the question, but hey, it might give you something to do if you get bored

Disclaimer: I have not tested some of the above code after typing it (read: possible syntax errors:)), so it may or may not work as is. It can be made to work though, as I'm using it (well, plus alot more) in my lite music player. (BGM code extended to allow full control instead of randomizing.)


i was actualy thinking about figuring that out next  :P   the logic of it seems right ill have to test it out a little

thanks again
Logged

Heet

  • Archived User
  • Hero Member
  • *
  • Posts: 2809
Play Specific Soundtrack But Random Song?
« Reply #7 on: October 06, 2003, 10:03:00 AM »

You guys rock, ive wanted this since day one!  Great work   :beer:  
Logged

rjsachse

  • Archived User
  • Full Member
  • *
  • Posts: 128
Play Specific Soundtrack But Random Song?
« Reply #8 on: October 27, 2003, 05:03:00 PM »

has any one got this to work yet i have tried and tried getting closer but dam not yet ;)  
Logged

rjsachse

  • Archived User
  • Full Member
  • *
  • Posts: 128
Play Specific Soundtrack But Random Song?
« Reply #9 on: October 28, 2003, 08:23:00 PM »

well the only problem is that when you find the album you want to listen to how do you play the selected file please can alot people chip on this form even if you don't how to do it you might give ous a idea how to thankz msdash hackers  :rolleyes:  
Logged