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 Discussion / Sound length?

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Mar 2008 22:29
Hey Guys!

1)How do I get the sound/music length of a sound file in seconds?
2)If I am playing a sound/music file, how do I know, how far through I am?
3)How can I fast forwards(assuming I had the above questions answered) with a time line? Is there a command "set music position"?

I will be needing the above information for a media player I would like to make. And please don`t quote that and say "why not just use the windows media player", because it is an interesting experience to make something like that.

Thanks, TheComet

Oooooops!!! I accidentally formated drive c.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Mar 2008 00:45 Edited at: 23rd Mar 2008 01:07
Were you able to download DBC 1.2 through your order history? So do you now have enhanced? If so, there are a series of functions that can be used with WINMM.dll . This applies to avi animations as well.

Though my brain is a bit cloudy at the moment you can get a pretty good estimate of the the length in seconds of a wave file by:
file size / samples per sec x (bit depth/8) x channels

Enjoy your day.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Mar 2008 06:10
To be honest, as DB is designed for making games rather than applications, these sorts of things are not well supported.

As Latch says, your best option would be to do it via dll.

I personally wouldn't bother at all...

TDK_Man

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Mar 2008 00:22
Can you recommend a dll?

Oooooops!!! I accidentally formated drive c.
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Mar 2008 03:41
Divide the number of samples by the frequency to get the length in seconds:



You could possibly estimate the current position in the song, just by keeping track of when it started. As for fast forwarding, it's not possible natively.

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Mar 2008 20:16
@Benjamin

Thanks, I`ll try that once I installed v1.2, and let you know if it works.

Oooooops!!! I accidentally formated drive c.

Login to post a reply

Server time is: 2025-06-04 03:34:59
Your offset time is: 2025-06-04 03:34:59