Hi ! I want to call mciSendCommand to record a music in Windows.
I want to do same thing like in this code (Delphi): procedure TForm1.OpenMedia; var MyOpenParms: TMCI_Open_Parms; begin Flags:=mci_Wait or mci_Open_Element or mci_Open_Type; with MyOpenParms do begin dwCallback:=Handle; // TForm1.Handle lpstrDeviceType:=PChar('WaveAudio'); lpstrElementName:=PChar(''); end; MyError:=mciSendCommand(0, mci_Open, Flags,Cardinal(@MyOpenParms)); if MyError = 0 then FDeviceID:=MyOpenParms.wDeviceID; end; procedure TForm1.RecordMedia; var MyRecordParms: TMCI_Record_Parms; set_parms: MCI_WAVE_SET_PARMS; begin set_parms.wFormatTag := WAVE_FORMAT_PCM; set_parms.wBitsPerSample := 16; set_parms.nChannels := 1; set_parms.nBlockAlign := (set_parms.nChannels*set_parms.wBitsPerSample) div 8; set_parms.nSamplesPerSec := 44100; set_parms.nAvgBytesPerSec := ((set_parms.wBitsPerSample) * set_parms.nChannels * set_parms.nSamplesPerSec) div 8; MyError:=mciSendCommand(FDeviceID,MCI_SET, MCI_WAIT or MCI_WAVE_SET_FORMATTAG or MCI_WAVE_SET_BITSPERSAMPLE or MCI_WAVE_SET_CHANNELS or MCI_WAVE_SET_SAMPLESPERSEC or MCI_WAVE_SET_AVGBYTESPERSEC or MCI_WAVE_SET_BLOCKALIGN, Cardinal(@set_parms)); Flags:=mci_Notify; with MyRecordParms do begin dwCallback:=Handle; // TForm1.Handle dwFrom:=0; dwTo:=10000; end; MyError:=mciSendCommand(FDeviceID, mci_Record, Flags, Longint(@MyRecordParms)); end; procedure TForm1.StopMedia; var MyGenParms: TMCI_Generic_Parms; begin if FDeviceID <> 0 then begin Flags:=mci_Wait; MyGenParms.dwCallback:=Handle; // TForm1.Handle MyError:=mciSendCommand(FDeviceID, mci_Stop, Flags,Longint(MyGenParms)); end; end; procedure TForm1.SaveMedia(OrgFileName,FileName:string); type // not implemented by Delphi PMCI_Save_Parms = ^TMCI_Save_Parms; TMCI_Save_Parms = record dwCallback: DWord; lpstrFileName: PAnsiChar; // name of file to save end; var MySaveParms: TMCI_Save_Parms; begin if FDeviceID <> 0 then begin // save the file... Flags:=mci_Save_File or mci_Wait; with MySaveParms do begin dwCallback:=Handle; lpstrFileName:=PChar(FileName); end; MyError:=mciSendCommand(FDeviceID, mci_Save, Flags, Longint(@MySaveParms)); end; end; procedure TForm1.CloseMedia; var MyGenParms: TMCI_Generic_Parms; begin if FDeviceID <> 0 then begin Flags:=0; MyGenParms.dwCallback:=Handle; // TForm1.Handle MyError:=mciSendCommand(FDeviceID, mci_Close, Flags, Longint(MyGenParms)); if MyError = 0 then FDeviceID:=0; end; end; 1. Can I do it ? 2. If not, what is the solution (I haven't Delphi... I have only freeware things) Thanx for help: dd _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32