MpegErnie
October 13th, 2002, 12:55 PM
When I seek forward or backward in Winamp I let Girder display the current prosition in ms.
Now I use the dcCalculator plug to calculate the minutes and seconds, store this in a text register and display it.
So something like this
- get position in ms from Winamp and store in reg5
- dcCalculator:
#gdef seconds = reg5 / 1000
#gdef minutes = seconds / 60
#gdef remainSeconds = seconds - minutes * 60
#gdef treg25 = print("%d:%d",minutes,remainSeconds)
-OSD: display [treg25]
The problem now is that it doesn't display 05:02 but 5:2 (ofcourse). It there a way I can let dcCalculator display mm:ss instead of m:s? Or do I have tor create some if-statements? I can figure that out but it isn't a nice solution...
Then I'd make something like this:
if minutes < 10
treg25 = print("0%d:%d",minutes,remainSeconds)
else if remainSeconds < 10
treg25 = print("%d:0%d",minutes,remainSeconds)
else if remainSeconds < 0 && minutes < 10
treg25 = print("0%d:0%d",minutes,remainSeconds)
else
treg25 = print("%d:%d",minutes,remainSeconds)
And some other questions:
where does the %d stand for? mr Clemens uses %s for strings and %d for integers (right?).
Does this matter of is the choice mine? I saw once something like this in C++ and I figured this would be about the same. I don't have any experience with this..
In Java I could just say something like:
systemout.println(minutes+":"+remainseconds);
And does it matter if I'd use def instead of gdef (I think not because I won't need the values later)
<font size=-1>[ This Message was edited by: MpegErnie on 2002-02-13 15:34 ]</font>
<font size=-1>[ This Message was edited by: MpegErnie on 2002-02-13 15:35 ]</font>
Now I use the dcCalculator plug to calculate the minutes and seconds, store this in a text register and display it.
So something like this
- get position in ms from Winamp and store in reg5
- dcCalculator:
#gdef seconds = reg5 / 1000
#gdef minutes = seconds / 60
#gdef remainSeconds = seconds - minutes * 60
#gdef treg25 = print("%d:%d",minutes,remainSeconds)
-OSD: display [treg25]
The problem now is that it doesn't display 05:02 but 5:2 (ofcourse). It there a way I can let dcCalculator display mm:ss instead of m:s? Or do I have tor create some if-statements? I can figure that out but it isn't a nice solution...
Then I'd make something like this:
if minutes < 10
treg25 = print("0%d:%d",minutes,remainSeconds)
else if remainSeconds < 10
treg25 = print("%d:0%d",minutes,remainSeconds)
else if remainSeconds < 0 && minutes < 10
treg25 = print("0%d:0%d",minutes,remainSeconds)
else
treg25 = print("%d:%d",minutes,remainSeconds)
And some other questions:
where does the %d stand for? mr Clemens uses %s for strings and %d for integers (right?).
Does this matter of is the choice mine? I saw once something like this in C++ and I figured this would be about the same. I don't have any experience with this..
In Java I could just say something like:
systemout.println(minutes+":"+remainseconds);
And does it matter if I'd use def instead of gdef (I think not because I won't need the values later)
<font size=-1>[ This Message was edited by: MpegErnie on 2002-02-13 15:34 ]</font>
<font size=-1>[ This Message was edited by: MpegErnie on 2002-02-13 15:35 ]</font>