Tip

Managing Audio Cd In Notes

A little scriptlibrary with functions for managing audio cds from within a
notes database.
it also contains a function which calculates the CD key, which is needed to
access information from the CDDB databases on the Internet.
'mciLib:

Option Public


Dim RetInt As Long
Dim RetLength As Long
Dim RetHandle As Long
Dim RetString As String
Dim cdSecs As String
Type TOC
min As Long
sec As Long
frame As Long
End Type
Dim cdTOC () As TOC
Declare Function mciSendStringA Lib "winmm.dll" (Byval CMD$, Byval Ret$, Byval
RETLEN&, Byval HwndBack&) As Long
Function CDEject As Long
CDEject = mciSendStringA ("set cdaudio door open", "", 0, 0)
End Function

Function CDStop As Long
RetInt = mciSendStringA ("stop cdaudio", RetString, 63, 0)
CDStop = mciSendStringA ("close cdaudio", RetString, 63, 0)
End Function
Function CDPlay As Long
CDPlay = mciSendStringA ("play cdaudio", RetString, 63, 0)
End Function


Function CDClose As Long
CDClose = mciSendStringA ("set cdaudio door close", RetString, 63, 0)
End Function
Function CDSetTimeFormat (Form%) As Long
Select Case (Form% )
Case 1 : F$ = "ms"
Case 2 : F$ = "msf"
Case 3 : F$ = "tmsf"
End Select
mciString$ = "set cdaudio time format " & F$
CDSetTimeFormat = mciSendStringA ( mciString$, RetString, 63, 0)
End Function

Function CDNumOfTracks As Integer
RetString = Space (63)
RetInt = mciSendStringA ("status cdaudio number of tracks", RetString, 63,
0)
CDNumOfTracks = Val (Retstring)
End Function


Function CDCurrentTrack As Long
RetInt = mciSendStringA ("status cdaudio current track", RetString, 63, 0)
CDCurrentTrack = Val (RetString)
End Function
Function CDTrackLen (Track%) As String
mciString$ = "status cdaudio length track " & Str (Track%)
RetInt = mciSendStringA (mciString$, RetString, 10, 0)
CDTrackLen = Retstring
End Function

Function CDLength As String
RetString = Space (63)
RetInt = mciSendStringA ("status cdaudio length ", RetString, 63, 0)
CDLength = Retstring
End Function
Function CDTrackPos (Track%) As String
mciString$ = "status cdaudio position track " & Str (Track%)
RetInt = mciSendStringA (mciString$, RetString, 10, 0)
CDTrackPos = Trim$ (Retstring)
End Function
Function CDMode As String
RetString = Space (63)
RetInt = mciSendStringA ("status cdaudio mode", RetString, 63, 0)
CDMode = RetString
End Function

Function CDIsReady As Integer
RetString = Space (63)
CDIsReady = False
RetInt = mciSendStringA ("status cdaudio ready", RetString, 63, 0)
If Retstring = "true" Then
CDIsReady = True
End If
End Function


Function CDPause As Long
CDPause = mciSendStringA ("pause cdaudio", RetString, 63, 0)
End Function
Function CDSeekTo (Track%) As Long
mciString$ = "seek cdaudio to " & Str (Track%)
CDSeekTo = mciSendStringA (mciString$, RetString, 10, 0)
End Function

Function CDToStart As Long
CDToStart = mciSendStringA ("seek cdaudio to start", RetString, 63, 0)
End Function

Function CDToEnd As Long
CDToPlay = mciSendStringA ("seek cdaudio to end", RetString, 63, 0)
End Function
Function CDPlayFrom (Track%) As Long
mciString$ = "play cdaudio from " & Str (Track%)
CDPlayFrom = mciSendStringA (mciString$, RetString, 63, 0)
End Function

Function CDPlayFromTo (Track1%, Track2%) As Long
mciString$ = "play cdaudio from " & Str (Track1%) & " to " & Str(Track2%)
CDPlayFromTo = mciSendStringA (mciString$, RetString, 63, 0)
End Function

Function CDPrevTrack As Long
ret% = CDSetTimeFormat (3)
total% = CDNumOfTracks
current% = CDCurrentTrack
prev% = current% - 1
If CDIsPlaying Then
If prev% > 0 Then
CDPrevTrack = CDPlayFrom (prev%)
Else
CDPrevTrack = CDPlayFrom (total%)
End If
Else
If prev% > 0 Then
CDPrevTrack = CD

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.