
StopDrawing() : ok=ButtonImageGadget(gad,x,y,w,h,ImageID(text),flags) If font=#PB_Default : font=GetStockObject_(#DEFAULT_GUI_FONT) : EndIfĭrawText(w/2-TextWidth(text$)/2,h/2-TextHeight(text$)/2,text$,fgcolor,bgcolor) If fgcolor=#PB_Default : fgcolor=GetSysColor_(#COLOR_BTNFACE) : EndIf If bgcolor=#PB_Default : bgcolor=GetSysColor_(#COLOR_BTNFACE) : EndIf Comment this line out to use external sound file for tock soundĬFRunLoopTimerRef tocTimer = timerbegin 0.Code: Select all Procedure ButtonGadgetColor(gad,x,y,w,h,text$="",flags=0,fgcolor=#PB_Default,bgcolor=#PB_Default,font=#PB_Default) SoundRef tocSound = fn SoundWithContentsOfURL( soundURL, NO ) CFURLRef soundURL = fn BundleURLForSoundResource( fn BundleMain, ) Uncomment these lines to use an external sound file name toc.wave Local fn RunMetronome( bpm as CFTimeInterval ) Slider _slider, YES, _initialBPM, r, 20, 190, _windowĬolorwell _bpmIndicator, YES, fn ColorGreen, r, NO, _windowĬolorWellSetBordered( _bpmIndicator, NO )ĬFArrayRef tempo = moderato", moderato", = fn CGRectMake( 10, 460, 140, 22 )ĬontrolSetAlignment( i, NSTextAlignmentRight )ĬFRunLoopTimerRef t = (CFRunLoopTimerRef)fn AppProperty( )ĬolorWellSetColor( _bpmIndicator, fn ColorGreen ) Window _window, r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable Menu _mFile, -1, _mFile, _iClose, _mFile, _iClose, )ĬGRect r = fn CGRectMake( 0, 0, 200, 500 ) Uncomment next line to use external sound file, and make necessary adjustments in fn RunMetronome



Adagietto – slower than andante (72–76 bpm).Larghissimo – very, very slow (24 bpm and under).
Purebasic new gadget color free#
The free FB compiler is available on theīasic Tempo Markings from slowest to fastest:
Purebasic new gadget color code#
The code has been tested on Catalina (10.15.x) to Monterey (12.4.x) with Ventura still in beta at the time of this post. It's GUI includes a slider control to adjust speed, as well as blinking indicator and a sound, to indicate tempo.
Purebasic new gadget color mac#
' Sound Function v0.3 For DOS/Linux/Win by yetifoot ' Credits: ' ' # ifdef _FB_WIN32_ # include Once "windows.bi" # endif Sub Sound_DOS_LIN ( Byval freq As Uinteger, dur As Uinteger ) Dim t As Double Dim As Ushort fixed_freq = 1193181 \ freq Asm mov dx, & H61 ' turn speaker on in al, dx or al, & H03 out dx, al mov dx, & H43 ' get the timer ready mov al, & HB6 out dx, al mov ax, word Ptr ' move freq to ax mov dx, & H42 ' port to out out dx, al ' out low order xchg ah, al out dx, al ' out high order End Asm t = Timer While (( Timer - t ) * 1000 ) 0 Then Sound ( 100, 60 ) Color 10 : Print "tick " Else Sound ( 119, 60 ) Color 11 : Print "TICK " End If Sleep ( retardo ) Loop End Sub FutureBasic Īn Apple Mac application that, when compiled with FB, produces a packaged, stand-alone 64-bit application that will run on either Intel or the newer M-series Macs. REM La función Sound no es mía, incluyo los créditos correspondientes. REM FreeBASIC no tiene la capacidad de emitir sonido de forma nativa. #include #include #include #include #include #include #include struct timeval start, last inline int64_t tv_to_u ( struct timeval s ) : metronome-ui ( bpm notes - ) "Metronome" open-window : metronome-example ( - ) metronome-defaults metronome-ui : validate-args ( int-args - ) map dup validate-args unclip swap : metronome-cmdline ( - bpm notes ) command-line get if-empty : print-defaults ( - ) metronome-defaults swap prefix interleave nl : metronome-usage ( - ) "Usage: metronome " print "Arguments must be non-zero" print "Example: metronome " write print-defaults flush : metronome-main ( - ) recover ] with-ui MAIN: metronome-main
