How to Use APIs to play CD?

Source: Internet
Author: User
'Author: Gordon F. MacLeod
'How to play a CD audio disc via API

'Descare the following API
Declare function mcisendstring & lib "mmsystem" (byval lpstrcommand $, byval lpstrreturnstr as any, byval wreturnlen %, byval hcallback %)

'Add the code below to appropriate routines

Sub partition play_click ()
Dim LRET as long
Dim ncurrenttrack as integer

'Open the device
LRET = mcisendstring ("Open cdaudio alias CD wait", 0 &, 0, 0)

'Set the time format to tracks (default is milliseconds)
LRET = mcisendstring ("set CD time format tmsf", 0 &, 0, 0)

'Then to play from the beginning
LRET = mcisendstring ("play CD", 0 &, 0, 0)

'Or to play from a specific track, say track 4
Ncurrenttrack = 4
LRET = mcisendstring ("play CD from" & STR (ncurrenttrack), 0 &, 0, 0)

End sub
 

'Remember to close the device when ending playback

Sub partition stop_click ()
Dim LRET as long

'Stop the playback
LRET = mcisendstring ("Stop CD wait", 0 &, 0, 0)

Doevents 'let Windows process the event

'Close the device
LRET = mcisendstring ("Close cd", 0 &, 0, 0)

End sub

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.