xx=create('mciWaveFormAudil')
xx.RecordNew('C:\MyNewFile.wav')
** Have a "Stop" button on the form that will call:
xx.Stop
* See this page for more about controlling MCI:
* [URL unfurl="true"]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_multimedia_command_strings.asp[/URL]
**************************************************
*-- Class: mci (c:\source\winutil.vcx)
*-- Author: William GC Steinford
*-- Time Stamp: 12/18/00 02:31:00 PM
*
DEFINE CLASS mci AS container
Width = 236
Height = 26
Visible = .F.
BackColor = RGB(0,128,128)
*-- This stores the name of the MCI DeviceType this object is controlling
device = "''"
*-- Specifies the alias / ID used to refer to the MCI device that has been opened
alias = "''"
*-- This stores the file name (or other element name) that this MCI object is controlling
element = "''"
Name = "mci"
ADD OBJECT lbltitle AS label WITH ;
FontBold = .T., ;
FontSize = 11, ;
BackStyle = 0, ;
Caption = "Media Control Interface (MCI)", ;
Height = 17, ;
Left = 8, ;
Top = 3, ;
Width = 220, ;
ForeColor = RGB(192,192,192), ;
Name = "lblTitle"
PROCEDURE Init
** Modify Class mci of [c:\source\WINUTIL.VCX] Method Init
*!* #define mmsystem "WINMM.DLL"
DECLARE integer mciSendString IN WinMM.DLL ;
STRING cCommand, STRING @cRetStr, INTEGER nRetLen, ;
INTEGER wHnd
* Example Strings:
*!* mciSendString("open cdaudio","",0,0)
*!* =mciSendString("play cdaudio","",0,0)
*!* =mciSendString("stop cdaudio","",0,0)
*!* =mciSendString("set cdaudio door open","",0,0)
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method Init
ENDPROC
*-- Close() -- closes the currently open MCI device ID/Alias
PROCEDURE close
** Modify Class mci of [c:\source\WINUTIL.VCX] Method close
THIS.SendString( "close "+THIS.Alias )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method close
ENDPROC
*-- Delete( cOptions ) -- If no options are specified, then deletes from here to the end.
PROCEDURE delete
** Modify Class mci of [c:\source\WINUTIL.VCX] Method delete
LPARAMETERS pcOpt
THIS.SendString( "delete "+THIS.Alias+' '+iif(VarType(pcOpt)='C',pcOpt,'') )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method delete
ENDPROC
*-- Open( cMCIType [, cAlias [, cFileName ]] )
PROCEDURE open
** Modify Class mci of [c:\source\WINUTIL.VCX] Method open
LPARAMETER lcDevice, lcAlias, lcElement
THIS.Device = lcDevice
THIS.Alias = iif( type('lcAlias')='C', lcAlias, lcDevice )
THIS.Element = iif( type('lcElement')='C', lcElement, '' )
THIS.SendString( "open "+THIS.Element+" type "+THIS.Device+" alias "+THIS.Alias)
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method open
ENDPROC
*-- Pause()
PROCEDURE pause
** Modify Class mci of [c:\source\WINUTIL.VCX] Method pause
THIS.SendString( 'pause '+THIS.alias )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method pause
ENDPROC
*-- Play( [cOptions] )
PROCEDURE play
** Modify Class mci of [c:\source\WINUTIL.VCX] Method play
LPARAMETERS pcOptions
THIS.SendString( "play "+THIS.Alias+' '+iif(VarType(pcOptions)='C',pcOptions,'') )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method play
ENDPROC
*-- Record( cOptions )
PROCEDURE record
** Modify Class mci of [c:\source\WINUTIL.VCX] Method record
LPARAMETERS pcOptions
THIS.SendString( "record "+THIS.Alias+' '+iif(Vartype(pcOptions)='C',pcOptions,'') )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method record
ENDPROC
*-- Save( cFileName )
PROCEDURE save
** Modify Class mci of [c:\source\WINUTIL.VCX] Method save
LPARAMETER pcFileName
if VarType(pcFileName)='C'
THIS.SendString( 'save '+this.alias+' '+pcFileName )
else
if lower(THIS.Element)<>'new'
THIS.SendString( 'save '+this.alias )
endif
endif
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method save
ENDPROC
*-- Seek( cLocation ) -- set the position to start from. can be: "end", "start", or a numbered position (according to the current SET TIME FORMAT (bytes/milliseconds/samples/etc.)
PROCEDURE seek
** Modify Class mci of [c:\source\WINUTIL.VCX] Method seek
LPARAMETERS pcLocation
THIS.SendString( 'seek '+this.Alias+' to '+pcLocation )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method seek
ENDPROC
*-- mciSendString( cString, @cReturn, nRetLen, wHnd )
PROCEDURE sendstring
** Modify Class mci of [c:\source\WINUTIL.VCX] Method sendstring
LPARAMETERS cString
LOCAL cRet, err
cRet = space(60)
err = mciSendString(cString,@cRet,60,0)
return cRet
** Modify Class mci of [c:\source\WINUTIL.VCX] Method sendstring
ENDPROC
*-- Set( cSetItem ) -- Use this to set the control settings for the device.
PROCEDURE set
** Modify Class mci of [c:\source\WINUTIL.VCX] Method set
LPARAMETERS cStat
RETURN THIS.SendString( 'set '+THIS.Alias+' '+cStat )
* These are all the valid 'Set' commands for each kind of device
*!* cdaudio
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* door closed
*!* door open
*!* time format milliseconds
*!* time format msf
*!* time format tmsf
*!*
*!* digitalvideo
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* door closed
*!* door open
*!* file format format
*!* seek exactly on
*!* seek exactly off
*!* speed factor
*!* still file format format
*!* time format frames
*!* time format milliseconds
*!* video off
*!* video on
*!*
*!* overlay
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* door closed
*!* door open
*!* video off
*!* video on
*!*
*!* sequencer
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* door closed
*!* door open
*!* master MIDI
*!* master none
*!* master SMPTE
*!* offset time
*!* port mapper
*!* port none
*!* port port_number
*!* slave file
*!* slave MIDI
*!* slave none
*!* slave SMPTE
*!* tempo tempo_value
*!* time format milliseconds
*!* time format SMPTE fps
*!* time format SMPTE 30 drop
*!* time format song pointer
*!*
*!* vcr
*!* assemble record on
*!* assemble record off
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* clock time
*!* counter format
*!* counter value
*!* door closed
*!* door open
*!* index counter
*!* index date
*!* index time
*!* index timecode
*!* length duration
*!* pause timeout
*!* postroll duration -
*!* duration
*!* power on
*!* power off
*!* preroll duration duration
*!* record format SP
*!* record format LP
*!* record format EP
*!* speed factor
*!* time format frames
*!* time format hms
*!* time format milliseconds
*!* time format msf
*!* time format SMPTE fps
*!* time format SMPTE 30 drop
*!* time format tmsf
*!* time mode counter
*!* time mode detect
*!* time mode timecode
*!* tracking plus
*!* tracking minus
*!* tracking reset
*!*
*!* videodisc
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* door closed
*!* door open
*!* time format frames
*!* time format hms
*!* time format milliseconds
*!* time format track
*!* video off
*!* video on
*!*
*!* waveaudio
*!* alignment <integer>
*!* any input
*!* any output
*!* audio all off
*!* audio all on
*!* audio left off
*!* audio left on
*!* audio right off
*!* audio right on
*!* bitspersample <bit_count>
*!* bytespersec <byte_rate>
*!* channels <channel_count>
*!* door closed
*!* door open
*!* format tag pcm
*!* format tag tag
*!* input integer
*!* output integer
*!* samplespersec <integer>
*!* time format bytes
*!* time format milliseconds
*!* time format samples
*!*
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method set
ENDPROC
PROCEDURE stop
** Modify Class mci of [c:\source\WINUTIL.VCX] Method stop
THIS.SendString( "stop "+THIS.Device )
Return .t.
** Modify Class mci of [c:\source\WINUTIL.VCX] Method stop
ENDPROC
ENDDEFINE
*
*-- EndDefine: mci
**************************************************
**************************************************
*-- Class: mciwaveformaudio (c:\source\winutil.vcx)
*-- ParentClass: mci (c:\source\winutil.vcx)
*-- BaseClass: container
*-- Time Stamp: 12/18/00 12:24:11 PM
*
DEFINE CLASS mciwaveformaudio AS mci
Name = "mciwaveformaudio"
lblTitle.Alignment = 2
lblTitle.Caption = "MCI WaveForm Audio"
lblTitle.Name = "lblTitle"
PROCEDURE recordnew
** Modify Class mciwaveformaudio of [c:\source\WINUTIL.VCX] Method recordnew
LPARAMETER pcFName
if not empty(THIS.Device)
THIS.SendString('close '+this.device)
endif
THIS.Device = 'mywaveaudio'
THIS.SendString('open new type waveaudio alias '+THIS.Device+' buffer 6')
THIS.SendString('record '+This.Device)
Return .t.
** Modify Class mciwaveformaudio of [c:\source\WINUTIL.VCX] Method recordnew
ENDPROC
ENDDEFINE
*
*-- EndDefine: mciwaveformaudio
**************************************************