0
0

first,hi all. I’m from China. I ‘m English very poor.

I used FMOD to make a mp3 Player software. everything is ok, but I call FSOUND_Stream_GetLengthMs function get total time for display mm:ss
such as 04:30 ,but this function returnd is MILLISECONDS .

How can I do ?

I don’t know call this function is right ? if wrong ,please tell me call which function , please ~thx.

  • You must to post comments
0
0

milliseconds are thousandths of a second (1000ms=1s) do divide the result of the function by 1000 to get the length in seconds, the number of seconds mod 60 is ss the number of seconds divided by 60 is mm

  • You must to post comments
0
0

thx .

I call this function FSOUND_Stream_GetLengthMs is right ?

  • You must to post comments
0
0

Yes!

  • You must to post comments
0
0

This function returns a string from a time (must be >=0):
hh:mm:ss.ms, e.g.
00:03:24.254
change it to fit your purpose :)

Private Function SPTimeX(ByVal xLong1 As Long) As String
Dim xLong2 As Long

xLong2 = xLong1 \ 3600000
SPTimeX = Right(“00” + Trim(Str(xLong2)), 2&)
xLong1 = xLong1 – xLong2 * 3600000
xLong2 = xLong1 \ 60000
SPTimeX = SPTimeX & “:” & Right(“00” + Trim(Str(xLong2)), 2&)
xLong1 = xLong1 – xLong2 * 60000
xLong2 = xLong1 \ 1000&
SPTimeX = SPTimeX & “:” & Right(“00” + Trim(Str(xLong2)), 2&) & “.” & Right(“000” + Trim(Str(xLong1 – xLong2 * 1000)), 3&)
End Function

  • You must to post comments
0
0

I find your a bit long, here is what I have in my Media Player:

[code:2slzecob]Private Function TempsString(Temps As Long) As String
TempsString = IIf(TempsTout >= 3600, Format(Int(Temps / 3600), "0:"), Empty) & _
Format(Int((Temps Mod 3600) / 60), "00:") & Format(Int(Temps Mod 60), "00")
End Function[/code:2slzecob]

If it’s > 1 hour, it will be X:XX:XX, else it will be XX:XX.

  • You must to post comments
0
0

Yep, its little large and the output is designed for console / logfile to see the detailed time something happened, …

I mostly use optimized code for each purpose, I sent this function because it was at hand, and is a function.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.