In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, classes, extctrls, comctrls; Type tform1 = Class (tform) opendialog1: topendialog; dependencies: dependencies; button1: tbutton; button2: tbutton; button3: tbutton; colorbox1: tcolorbox; colorbox2: tcolorbox; Procedure outputs (Sender: tobject ); procedure Define (Sender: tobject); Procedure define (Sender: tobject); Procedure colorbox1change (Sender: tobject); Procedure colorbox2change (Sender: tobject); Procedure define (Sender: tobject ); procedure paintbox1paint (Sender: tobject); Private Procedure draw; end; var form1: tform1; implementation {$ R *. DFM} uses bass; var HS: hstream; {stream handle} data: array of cardinal; bit: tbitmap; Procedure tform1. Formcreate (Sender: tobject); begin bit: = tbitmap. create; paintbox1.align: = altop; colorbox1.selected: = clblack; colorbox2.selected: = cllime; If hiword (bass_getversion) bassversion then MessageBox (0, '"Bass. the DLL file version is not suitable! ', Nil, mb_iconerror); if not bass_init (-1, 44100, 0, 0, nil) Then showmessage ('initialization error'); end; {open} procedure tform1.button1click (Sender: tobject); var mp3path: ansistring; I: Cardinal; Time: Double; hs2: hstream; begin bass_streamfree (HS); opendialog1.filter: = 'mp3 file (*. MP3) | *. MP3 | WAV file (*. wav) | * WAV '; If opendialog1.execute then mp3path: = ansistring (opendialog1.filename); HS: = bass_streamcreatefile (false, pansichar (mp3path), 0, 0, 0); if hs
Form file:
Object form1: tform1 left = 222 Top = 114 caption = 'form1' clientheight = 173 clientwidth = 504 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesigned oncreate = formcreate ondestroy = formdestroy pixelsperinch = 96 textheight = 13 object paintbox1: tpaintbox left = 40 top = 0 width = 105 Height = 131 onpaint = paintbox1paint end object button1: tbutton left = 8 Top = 137 width = 75 Height = 25 caption = #25171 #24320 taborder = 0 onclick = button1click end object button2: tbutton left = 89 Top = 137 width = 75 Height = 25 caption = #25773 #25918 taborder = 1 onclick = button2click end object button3: tbutton left = 170 Top = 137 width = 75 Height = 25 caption = #26242 #20572 taborder = 2 onclick = button3click end object colorbox1: tcolorbox left = 315 Top = 139 width = 85 Height = 22 itemheight = 16 taborder = 3 onchange = colorbox1change end object colorbox2: tcolorbox left = 406 Top = 139 width = 90 Height = 22 itemheight = 16 taborder = 4 onchange = colorbox2change end object opendialog1: topendialog left = 192 Top = 32 endend