Use the multi-media library bass. DLL to play MP3 [2]-bass_getdeviceinfo: Get the current audio output device list

Source: Internet
Author: User
In Delphi 2009, you need to modify the bass_deviceinfo structure definition in bass. Pas. Otherwise, garbled characters will occur:
 
// Change bass_deviceinfo = Record Name: pchar; // description DRIVER: pchar; // driver flags: DWORD; end; // to bass_deviceinfo = Record Name: pansichar; // description DRIVER: pansichar; // driver flags: DWORD; end;

  

In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; listbox1: tlistbox; procedure formcreate (Sender: tobject); Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses bass; Procedure tform1.formcreate (Sender: tobject); begin if hiword (bass_getversion) bass Version then MessageBox (0, '"Bass. dll" file version is not suitable! ', Nil, mb_iconerror); listbox1.align: = altop; button1.caption: = 'get current audio output device list'; end; Procedure tform1.button1click (Sender: tobject); var info: bass_deviceinfo; i: integer; begin I: = 1; while bass_getdeviceinfo (I, Info) Do begin listbox1.items. add (string (info. name); Inc (I); end.

  

Form file:

 Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 125 clientwidth = 195 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object button1: tbutton left = 8 Top = 86 width = 179 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object listbox1: tlistbox left = 24 Top = 8 width = 113 Height = 73 itemheight = 13 taborder = 1 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.