Use the multi-media library bass. DLL to play MP3 [5]-set and obtain the volume and phase

Source: Internet
Author: User
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; button1: tbutton; button2: tbutton; button3: tbutton; trackbar1: ttrackbar; trackbar2: ttrackbar; label1: tlabel; label2: tlabel; Procedure formcreate (Sender: tobject ); procedure button1click (Sender: tobject ); Procedure submit (Sender: tobject); Procedure trackbar1change (Sender: tobject); Procedure submit (Sender: tobject ); end; var form1: tform1; implementation {$ R *. DFM} uses bass; var HS: hstream; {stream handle} procedure tform1.formcreate (Sender: tobject); begin trackbar1.showselrange: = false; trackbar1.min: = 0; trackbar 1. MAX: = 40; trackbar1.position: = trackbar1.max; trackbar2.showselrange: = false; trackbar2.min: =-20; trackbar2.max: = 20; trackbar2.position: = 0; 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; 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 = 205 Top = 107 caption = 'form1' clientheight = 157 clientwidth = 286 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 label1: tlabel left = 32 top = 59 width = 31 Height = 13 caption = 'label1' end object label2: tlabel left = 32 top = 109 width = 31 Height = 13 caption = 'label2' end object button1: tbutton left = 24 Top = 17 width = 75 Height = 25 caption = #25171 #24320 taborder = 0 onclick = button1click end object button2: tbutton left = 105 Top = 17 width = 75 Height = 25 caption = #25773 #25918 taborder = 1 onclick = button2click end object button3: tbutton left = 186 Top = 17 width = 75 Height = 25 caption = #26242 #20572 taborder = 2 onclick = button3click end object trackbar1: ttrackbar left = 24 Top = 74 width = 237 Height = 32 taborder = 3 onchange = trackbar1change end object trackbar2: ttrackbar left = 24 Top = 123 width = 237 Height = 28 taborder = 4 onchange = trackbar2change end object opendialog1: topendialog left = 248 Top = 32 endend
 
  
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.