Delay problem
Re: Delay problem
You have to disable the Debugger.
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Delay problem
i am even set 22.675736 for more tune, and create exe file, and close any others programm - still not same, as original.
Re: Delay problem
Can you provide a wav file?
I have no winamp.
I have no winamp.
Re: Delay problem
Hm...
I compensate a bit the calling
But for me it sounds already a bit faster as the original.
Bernd
I compensate a bit the calling
Code: Select all
DelayMicroSeconds(MusArr(i)\pause * 22.676 - 5)
Bernd
-
- Enthusiast
- Posts: 619
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Delay problem
sounds very closer. but how they get this so small pauses? i think it was made by VB6.0
Re: Delay problem
My advice: do not not not use a sequence of delays to control your timing. Error will accumulate eventually, even using a function more precise than Delay().
I would try a method similar to this:
I would try a method similar to this:
Code: Select all
Debug "play"
PlayedTicks.i = 0
PlayedUS.i = 0
CurrentUS.i = 0
StartMS.i = ElapsedMilliseconds()
For i = 0 To ArraySize(MusArr())-1
Select MusArr(i)\type
Case 1
OPN_Write(0, MusArr(i)\reg, MusArr(i)\val)
Case 2
tmp = MusArr(i)\reg+256
OPN_Write(0, tmp, MusArr(i)\val)
Case 3
;COMMENT AND UNCOMMENT HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;infratec
;DelayMicroSeconds(MusArr(i)\pause * 23) ; but need * 22.675 as 0. 000 022 675s
;CELTIC88
;DelayEx(MusArr(i)\pause) ; i even dont know how to use it
;lowest pb value
;Delay(1)
PlayedTicks + MusArr(i)\pause
PlayedUS = PlayedTicks * 22.675
While (CurrentUS < PlayedUS)
Delay(1)
CurrentUS.i = (ElapsedMilliseconds() - StartMS) * 1000
Wend
EndSelect
If stopflag
Break
EndIf
Next
Re: Delay problem
For this kind of timings you need to use MS-windows API timers (how to do this on OSX I don't know). All other timing-functions can be influenced by the user when moving a window or whatever, which will result in time interrupts.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Re: Delay problem
Microsecond delay with no loop for Windows (found a c version on net, thought I share)
CPU usage is 0.
Code: Select all
Procedure usleep(usec)
Define timer, ft.LARGE_INTEGER
ft\QuadPart = -(10 * usec)
timer = CreateWaitableTimer_(0, #True, 0);
SetWaitableTimer_(timer, @ft, 0, 0, 0, 0);
WaitForSingleObject_(timer, #INFINITE);
CloseHandle_(timer);
EndProcedure
Debug ElapsedMilliseconds()
usleep(10000)
Debug ElapsedMilliseconds()
Repeat
usleep(1)
ForEver