Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / variable=music playing(1) question - please help

Author
Message
Jammy
23
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 6th Jun 2003 01:17


Hi,

I am making a dance game which will use a playstation dance mat (i have a converter to usb - costs about £15 and well worth it )
You will be able to dance to any mp3 or cd you have - you are stuck to about 30 songs in the playstation game.

************here is the question**********************

the game needs to know when a song has finished so it can start a new round - how do i do that ?

******************************************************************


the music playing(1) command only seems to return a '0'if you stop the music - see code.

Any help would be welcome cos otherwise the game is looking good.
Jammy
23
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 6th Jun 2003 01:20 Edited at: 6th Jun 2003 01:21


Matto
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location:
Posted: 6th Jun 2003 02:26
The sound commands need beefing up a little I agree that when using the Music Playing(Music Number) Command if the song has finished it should return an 0, you'l have to try and get around it with the use of variables or timers.

Timers:
If you know how long the song plays for and have an in-game/application Timer that is true to the clock(maybe even use the system clock you should be able to write a small piece of code to make a count down timer which is initialised when a song plays with it's total time and as it plays count it down, when it reaches 0 it would automatically play the next song.

Variables:
You can use Variables to count when a song or sound is played and in conjunction with the count down timer should work ok. ie:-

REM Note this is note correct code. just idea's.

Load Music "Blah Blah.MP3",1
Load Music "Blah Blah.MP3",2

Song1Timer=Song "Blah Blah.MP3" Length in Time(Probably seconds)
Play Music 1
Song1Playing=1

REM Put timer code here, you will need to reduce the Song1Timer
REM correctly, proper timing is required or you'l be cutting
REM songs short or leaving empty pauses between songs.

REM Once Your timer is at Zero this piece of code would signal for
REM the next Song.

If Song1Playing=1 And Song1Timer=0
Stop Music 1
Song1Playing=0
Play Music 2
Song2Playing=1
Song2Timer=Song "Blah Blah.MP3" Length in Time(Probably seconds)
Endif

This is just off the top of my head, and would need arranging properly within a loop or Function but it might give you an idea of how to tackle the problem.. good luck.

1ghz Cel,512 sdram 133,Gf2 MX 400 64,SBL 5.1,Win98
Best Upcoming MMOG - http://WWW.Atriarch.com
Project: Card Game with No Name
Jammy
23
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 6th Jun 2003 06:25
Thanks for the very comprehensive reply –

Unfortunately the point of the program was that you could use any song you wanted which makes a known timer impossible.

Maybe I could set a timer – say 3 min`s and make it user adjustable, which is still going to be inaccurate, but at least it would be the users fault and not mine.

Or set a key that the user has to press to finish the song.

Or even both options.

But I would still like to hear if anyone has any better ideas

Perhaps a DLL and instructions on how to use it as I have never got a DLL to work.

Thanks again

Jammy

Matto
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location:
Posted: 7th Jun 2003 08:48
I am sure there must be a way to get the song time, if windows media player can tell you how long a song is as almost all other music playing programs can too, there certainly should be a way to get the track length to use as mentioned.

tricky one this as there is too little help on sound and music about.

1ghz Cel,512 sdram 133,Gf2 MX 400 64,SBL 5.1,Win98
Best Upcoming MMOG - http://WWW.Atriarch.com
Project: Card Game with No Name
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 7th Jun 2003 08:58
Well, you could always write a DLL just to read the MP3 files header info, and extract the total length of the sound.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Jammy
23
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 8th Jun 2003 04:44
thanks bulleyes

But the reason i use DBP is i dont know C++. Can you write a DLL to help me ? - with instructions on how to use it.... and make it freeware. im sure it would help many DBP programmers and not just me.

Jammy

Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 8th Jun 2003 06:45
Sure... I could do it, after I figure out how to write a DLL. (If you notice, I have another posting asking about how to write a DLL). But when do you need it? Any deadlines?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Jammy
23
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 9th Jun 2003 04:07
I have no timescale - i can continue as above the now and change the program once a dll is available. But as i said i have never got a dll to work so would need instructions and if possible an example of how to use it.

thanks to any who would help.

Jammy

Login to post a reply

Server time is: 2026-07-11 11:42:18
Your offset time is: 2026-07-11 11:42:18