a440hz Posted May 27, 2010 Share Posted May 27, 2010 Good Hi to you all,Is it even possible to get a command line program that outputs to a file to output to a memory location instead? My feeble attempt follows:Link to CenterCutLink to BASSThanks,Joeexpandcollapse popup;WinAPI coded by UEZ 2010 #include <WinAPI.au3> #include <Bass.au3> Opt('MustDeclareVars', 0) OnAutoItExitRegister("ExitFunctions") _BASS_Startup() _BASS_Init($BASS_DEVICE_MONO, -1, 44100, 0, "") Const $CC = @ScriptDir & "\CenterCutCl.exe" $iFile = @ScriptDir & "\stereo.wav" $oFile = @ScriptDir & "\mono.wav" Dim $tfile $file_size = FileGetSize($iFile)/2 If $file_size Then $tBuffer = DllStructCreate("byte[" & $file_size & "]") $pMem = DllStructGetPtr($tBuffer) Global $nBytes $hFile =_WinAPI_CreateFile($tfile, 2, 2) _WinAPI_SetFilePointer($hFile, 3) _WinAPI_ReadFile($hFile, $pMem, $file_size, $nBytes) _WinAPI_CloseHandle($hFile) EndIf If FileExists($oFile) Then FileDelete($oFile) ;~ ================ This doesn't work <============== ;~ RunWait($CC & ' "' & $iFile &'"' & " -c " & '"' & $hFile & '"' ,@ScriptDir,@SW_HIDE) ;~ $FHnd = _BASS_StreamCreateFile(1,$pMem, 0, $file_size, $BASS_DEVICE_SPEAKERS) ;~ $dur = _BASS_ChannelGetLength($FHnd, $BASS_POS_BYTE) ;~ _BASS_ChannelPlay($FHnd, False) ;~ ================ This works but has to create a file <============== RunWait($CC & ' "' & $iFile &'"' & " -c " & '"' & $oFile & '"' ,@ScriptDir,@SW_HIDE) $FHnd = _BASS_StreamCreateFile(0,$oFile, 0, 0, $BASS_DEVICE_SPEAKERS) $dur = _BASS_ChannelGetLength($FHnd, $BASS_POS_BYTE) _BASS_ChannelPlay($FHnd, False) Do Sleep(50) $pos = _BASS_ChannelGetPosition($FHnd, $BASS_POS_BYTE) Until $pos >= $dur Exit Func ExitFunctions () _BASS_Stop() _BASS_Free() EndFunc Are you experienced? Link to comment Share on other sites More sharing options...
jaberwacky Posted May 28, 2010 Share Posted May 28, 2010 Now I've never used any of the DLL functions but from what I can tell you need to write to the struct using DLLStructSetData()? Don't quote me on this, I'm stabbing in the dark here. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
eukalyptus Posted May 28, 2010 Share Posted May 28, 2010 (edited) Take a look at the BassEnc examples.You can set a cmdline-encoder on a channel, like: "lame.exe -b128 - - "The first "-" tells lame that input = stdin, the second "-" that output=stdoutYou have to test if centercut can handle input and output from stdin/out (helpfile!?)EDIT:here you can find a winamp-dsp-plugin: http://moitah.net/that is based on VirtualDub CenterCut.Maybe you can use it with BASS_WADSP.dll www.un4seen.com Edited May 28, 2010 by eukalyptus DirectSound UDF Direct2D UDF Link to comment Share on other sites More sharing options...
UEZ Posted May 28, 2010 Share Posted May 28, 2010 Will this help you? #include <Constants.au3> Local $run = @ComSpec & " /c " & "dir c:\" $prg = Run($run, @SystemDir, @SW_HIDE, $STDOUT_CHILD) Local $line, $mem While 1 $line = StdoutRead($prg) If @error Then ExitLoop $mem &= $line Wend MsgBox(0, "", $mem) BR, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
a440hz Posted May 28, 2010 Author Share Posted May 28, 2010 Thanks guys, From what I've been able to test (there's nothing about it using the help switch), there is no option to output to stdout and his winamp plugin is old and buggy and doesn't sound as good as the recent version. I've posted a request on the VirtualDub forum where the program was introduced and have made a request to the author. I'm hopeful he'll add a switch because a friend of mine was recently able to get him to modify the GUI to create the cmd line version. He's posted the source code but I don't know the first thing about C programming. Best to you all, Joe Are you experienced? Link to comment Share on other sites More sharing options...
a440hz Posted June 1, 2010 Author Share Posted June 1, 2010 Hi all,CenterCut now has support for stdin and stdout. Please see my post in the BASS thread.Thanks,Joe Are you experienced? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now