Appendix A: QCDAUDIO
Documentation component by D.Glodt (c)2000-2001 |
Appendix A: QCDAUDIO |
|
QCDAUDIO Component
QCDAUDIO is a media component used for read cd audio.
QCDAUDIO Properties
Field |
Type |
R\W |
Default |
|
|
|
|
Timer |
QTIMER |
RW |
|
|
Control the fréquency of the évent
OnChange. |
Time |
STRING |
R |
|
|
Time of cd. |
TrackTime |
STRING |
R |
|
|
Time of songs. |
TrackNumber |
INTEGER |
R |
|
|
Number of song from cd. |
TimePosition |
STRING |
R |
|
|
Position tmsf(track,minutes,seconds,frame)
of cd. |
State |
INTEGER |
R |
CD_CLOSE |
|
State of cd,can be CD_PLAY,CD_PAUSE,CD_STOP. |
AudioOpen |
Boolean |
R |
FALSE |
|
cd open. |
Present |
Boolean |
R |
FALSE |
|
State cd present. |
CurrentTrack |
INTEGER |
RW |
|
|
current song. |
Error |
STRING |
R |
|
|
Text error if OPEN méthod return FALSE |
|
|
QCDAUDIO Methods
Method |
Type |
Description |
Params |
|
|
|
|
Open |
FUNCTION |
Open cd audio, return TRUE if no error |
0 |
Close |
SUB |
Close cd audio |
0 |
Play |
SUB |
Play cd audio |
0 |
Stop |
SUB |
Stop cd audio |
0 |
Pause |
SUB |
Set cd audio to mode pause |
0 |
Eject |
SUB |
Eject cd audio |
0 |
QCDAUDIO Events
Event |
Type |
Occurs when... |
Params |
|
|
|
|
OnChange |
(track as integer,time as string) |
position cd during play mode |
2 |
QCDAUDIO Examples
'**************************************************************************
'* application:player cd *
'* auteur:D.Glodt *
'* date:7-4-2001 *
'**************************************************************************
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\Qcdaudio.inc"
$RESOURCE PLAYBMP as "play.bmp"
$RESOURCE STOPBMP as "Stop.bmp"
$RESOURCE PAUSEBMP as "Pause.bmp"
$RESOURCE BACKBMP as "back.bmp"
$RESOURCE FORWARDBMP as "forward.bmp"
$RESOURCE EJECTBMP as "eject.bmp"
$RESOURCE CDICO as "cdaudio.ico"
Declare Sub Play
Declare Sub Stop
Declare Sub Pause
Declare Sub Back
Declare Sub Forward
Declare Sub Eject
Declare Sub Open
Declare Sub Close
Declare Sub Quitter
Declare Sub PostimerOnTimer(track as integer,time as string)
Dim cd as Qcdaudio
cd.OnChange=PostimerOnTimer
cd.timer.interval=200
CREATE Form AS QFORM
Caption="CD Audio"
Width=288
Height=110
Center
BorderStyle=bsSingle
icoHandle=CDICO
OnClose=Quitter
OnShow=Open
CREATE Panel1 AS QPANEL
Left=0
Top=0
Width=281
Height=80
BevelOuter=bvNone
CREATE BtPlay AS QCOOLBTN
BMPHandle=PLAYBMP
Left=8
Top=6
Width=28
Height=28
Flat=true
Hint="Play"
ShowHint=true
GroupIndex=1
OnClick=Play
END CREATE
CREATE BtStop AS QCOOLBTN
BMPHandle=STOPBMP
Left=46
Top=6
Width=28
Height=28
Down=true
Flat=true
Hint="Stop"
ShowHint=true
GroupIndex=1
OnClick=Stop
END CREATE
CREATE BtPause AS QCOOLBTN
BMPHandle=PAUSEBMP
Left=84
Top=6
Width=28
Height=28
Flat=true
GroupIndex=1
Hint="Pause"
ShowHint=true
OnClick=Pause
END CREATE
CREATE BtBack AS QCOOLBTN
BMPHandle=BACKBMP
Left=114
Top=6
Width=28
Height=28
Flat=true
GroupIndex=0
Hint="Back"
ShowHint=true
OnClick=Back
END CREATE
CREATE BtForward AS QCOOLBTN
BMPHandle=FORWARDBMP
Left=144
Top=6
Width=28
Height=28
Flat=true
GroupIndex=0
Hint="Forward"
ShowHint=true
OnClick=Forward
END CREATE
CREATE BtEject AS QCOOLBTN
BMPHandle=EJECTBMP
Left=174
Top=6
Width=28
Height=28
Flat=true
GroupIndex=0
Hint="Eject"
ShowHint=true
OnClick=Eject
END CREATE
CREATE Infos AS QSTATUSBAR
AddPanels "Track:",""
Panel(0).width=100
END CREATE
END CREATE
END CREATE
Form.ShowModal
Sub Open
if cd.open then
infos.panel(0).caption="Track:"+str$(cd.tracknumber)
infos.panel(1).caption=cd.time
end if
End Sub
Sub Close
cd.close
End Sub
Sub Play
if cd.audioOpen=false then
if cd.open then
infos.panel(0).caption="Track:"+str$(cd.tracknumber)
infos.panel(1).caption=cd.time
else
btStop.down=true
end if
end if
cd.play
End Sub
Sub Stop
cd.stop
End Sub
Sub Pause
cd.pause
End Sub
Sub Back
cd.currentTrack=cd.currentTrack-1
infos.panel(0).caption="Track:"+str$(cd.currentTrack)
infos.panel(1).caption=cd.tracktime
if cd.state=CD_PLAY then cd.play
End Sub
Sub Forward
cd.currentTrack=cd.currentTrack+1
infos.panel(0).caption="Track:"+str$(cd.currentTrack)
infos.panel(1).caption=cd.tracktime
if cd.state=CD_PLAY then cd.play
End Sub
Sub Eject
cd.eject
btStop.down=true
End Sub
Sub PostimerOnTimer(track as integer,time as string)
infos.panel(0).caption="Track:"+str$(track)
infos.panel(1).caption=time
if cd.state=CD_STOP then
btStop.down=true
end if
End Sub
Sub Quitter
cd.close
form.close
End Sub
|
|