
TheDaverMan
Active Members-
Posts
21 -
Joined
-
Last visited
Everything posted by TheDaverMan
-
Thanks you guinness. I have adapted the code to the new function: #include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\TheDaverMan\Pictures\test.png") $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) $tBitmap = DllStructCreate($tagBITMAPINFO) If _WinAPI_GetObject($hBitmap, DllStructGetSize($tBitmap), DllStructGetPtr($tBitmap)) Then $tSize = DllStructCreate($tagSIZE) DllStructSetData($tSize, 'X', DllStructGetData($tBitmap, 'Width')) DllStructSetData($tSize, 'Y', DllStructGetData($tBitmap, 'Height')) EndIf $hGUI1 = GUICreate("GUI", 640, 480, 200, 150) $hGUI2 = GUICreate("", 640, 440, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD,$WS_EX_LAYERED, $WS_EX_TOPMOST),$hGUI1) _SetBitmap($hGUI2, $hBitmap,$tSize, 0) GUISetState(@SW_SHOW, $hGUI1) GUISetState(@SW_SHOW, $hGUI2) Sleep(1000) For $i = 5 to 255 step 5 _SetBitmap($hGUI2, $hBitmap, $tSize, $i); alpha fade-in Sleep(40) Next Sleep(1000) For $i = 250 to 0 step -5 _SetBitmap($hGUI2, $hBitmap, $tSize, $i); alpha fade-out Sleep(40) Next Sleep(500) _GDIPlus_Shutdown() Exit Func _SetBitmap($hGUI, $hBitmap, $tSize, $iOpacity) Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local Const $hPrevImage = _WinAPI_SelectObject($hMemDC, $hBitmap) Local Const $tPoint = DllStructCreate($tagPOINT) Local Const $tBlend = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBlend, 'Op', 0) DllStructSetData($tBlend, 'Flags', 0) DllStructSetData($tBlend, 'Alpha', $iOpacity) DllStructSetData($tBlend, 'Format', 1) _WinAPI_UpdateLayeredWindow($hGUI, $hDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tPoint), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_SelectObject($hMemDC, $hPrevImage) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap
-
OK I have found !! Here is the solution: #include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\TheDaverMan\Pictures\test.png") $hGUI1 = GUICreate("GUI", 640, 480, 200, 150) $hGUI2 = GUICreate("", 640, 480, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD,$WS_EX_LAYERED, $WS_EX_TOPMOST),$hGUI1) SetBitmap($hGUI2, $hImage, 0) GUISetState(@SW_SHOW, $hGUI1) GUISetState(@SW_SHOW, $hGUI2) Sleep(1000) For $i = 5 to 255 step 5 SetBitmap($hGUI2, $hImage, $i); alpha fade-in Sleep(40) Next Sleep(1000) For $i = 250 to 0 step -5 SetBitmap($hGUI2, $hImage, $i); alpha fade-out Sleep(40) Next Sleep(500) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Exit Func SetBitmap($hgui, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hgui, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc
-
I search to put a fading window with png control buttons, in a parent window. When I set to parent the second window disappear. Can you help me ? #include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Opt("MustDeclareVars", 0) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\TheDaverMan\Pictures\button.png") $hGUI = GUICreate("GUI", 750, 500, 192, 128) $hGUI2 = GUICreate("", 500, 250, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TRANSPARENT));BitOR($WS_EX_MDICHILD, $WS_EX_TOPMOST)) ;~ DllCall("user32.dll", "int", "SetParent", "hwnd", $hGUI2, "hwnd", $hGUI) ; <= if I put parent, I don't see the png SetBitmap($hGUI2, $hImage, 125);alpha GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI2) Sleep(5000) Func SetBitmap($hgui, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hgui, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc
-
There is a free dll library, but you must write the calling functions for autoit. http://libnoise.sourceforge.net/index.html
-
Nice, thanks.
-
I have backup this from the forum but it is a frequency generator. #AutoIt3Wrapper_UseX64=n #include "Bass.au3" Global $nFreq = 5000 ; Hz Global Const $pi = ATan(1) * 4 _BASS_Startup() _BASS_Init(0, -1, 44100, 0, "") Global $hSample = _Bass_SampleCreate(88200, 44100, 1, 1, $BASS_SAMPLE_LOOP) Global $tSampleData = DllStructCreate("short[44100]") Global $fTmp = $pi * 2 / (44100 / $nFreq) For $i = 1 To 44100 DllStructSetData($tSampleData, 1, 32767 * Sin($i * $fTmp), $i) Next _Bass_SampleSetData($hSample, DllStructGetPtr($tSampleData)) Global $hChan = _Bass_SampleGetChannel($hSample, 0) _BASS_ChannelSetVolume($hChan, 30) _Bass_ChannelPlay($hChan, 0) Sleep(5000) _Bass_SampleStop($hSample) _BASS_SampleFree($hSample) _BASS_Free() You need to download BASS UDF :
-
Bass - How to save file after vst effect ?
TheDaverMan replied to TheDaverMan's topic in AutoIt General Help and Support
I have found a solution to record sound after VST effect. I post the resulting code: #include <BASS.au3> #include <BASSConstants.au3> #include <BASSVST.au3> #include <BASSVSTConstants.au3> #include <BASSENC.au3> #include <BASSMIX.au3> #include <File.au3> Global $VSTdll = @ScriptDir & "\VST\epicVerb.dll" Global $BassDir = @ScriptDir & "\DLL\" Global $Buffer = DllStructCreate("byte[20000]") Global $BufferPointer = DllStructGetPtr($Buffer) Global $BufferSize = DllStructGetSize($Buffer) #Region BASS INIT _BASS_STARTUP($BassDir & "Bass.dll") ___Debug(@error, " _BASS_STARTUP "&@error) _BASS_VST_STARTUP($BassDir & "bassvst.dll") ___Debug(@error, " _BASS_VST_STARTUP "&@error) _BASS_Encode_Startup($BassDir & "bassenc.dll") ___Debug(@error, " _BASS_Encode_Startup "&@error) _BASS_MIX_STARTUP($BassDir & "bassmix.dll") ___Debug(@error, " _BASS_MIX_STARTUP "&@error) _BASS_Init($BASS_DEVICE_DEFAULT, -1, 44100, 0, "Null") ___Debug(@error, " _BASS_Init "&@error) #EndRegion BASS INIT ; $SoundFile = FileOpenDialog("Open...", @UserProfileDir & "\Music", "MP3,Wav Files (*.wav;*.mp3)", 1) $StreamHandle = _BASS_StreamCreateFile(False, $SoundFile, 0, 0, $BASS_STREAM_DECODE);$BASS_STREAM_DECODE) ; Create a stream1 with file. ___Debug(@error, "_BASS_StreamCreateFile ") $InfoStream = _BASS_ChannelGetInfo($StreamHandle) ; Get info on stream(freq, chan, ...) ___Debug(@error, "_BASS_ChannelGetInfo ") $StreamMixerHandle = _BASS_Mixer_StreamCreate($InfoStream[0], $InfoStream[1], BitOR($BASS_MIXER_END, $BASS_STREAM_DECODE)) ; Create a streamMixer with same freq and num of Chan ___Debug(@error, "_BASS_Mixer_StreamCreate "&@error) _BASS_Mixer_StreamAddChannel($StreamMixerHandle, $StreamHandle, 0) ; Add stream1 on streamMixer ___Debug(@error, "_BASS_Mixer_StreamAddChannel "&@error) $VSTchanHandle = _BASS_VST_ChannelSetDSP($StreamHandle, $VSTdll, 1, 1) ; Assigns a VST effects to stream1 ___Debug(@error, "_BASS_VST_ChannelSetDSP ") Sleep(2500) ; Wait 2,5sec, to fill the Mixer buffer before recording $hEncoder = _BASS_Encode_Start($StreamMixerHandle, @ScriptDir & "\TEST.wav", $BASS_ENCODE_PCM) ; Start encoding from streamMixer ___Debug(@error, "_BASS_Encode_Start ") $iBytes = _BASS_ChannelGetLength($StreamHandle, $BASS_POS_BYTE) ; Get size in bytes ___Debug(@error, "_BASS_ChannelGetLength " & $iBytes) $iDone = 0 ; Init length counter While _BASS_ChannelIsActive($StreamMixerHandle) ; while streamMixer actif $iLength = _BASS_ChannelGetData($StreamMixerHandle, $BufferPointer, $BufferSize) ; Read data ___Debug(@error, "_BASS_ChannelGetData " & $iLength & " bytes ") $iDone += $iLength ; Increment lenghtCounter with data ___Debug(-1, Round($iDone * 100 / $iBytes) & "% done") ; Check counter Error WEnd _BASS_Encode_Stop($hEncoder) ; Stop encoding ___Debug(@error, "_BASS_Encode_Stop ") _BASS_StreamFree($StreamMixerHandle) ; Release streamMixer ___Debug(@error, "_BASS_StreamFree ") Func ___DeBug($Error, $sAction) Switch $Error Case -1 ConsoleWrite(@CRLF & "-" & $sAction & @CRLF) Case 0 ConsoleWrite(@CRLF & "+" & $sAction & " - OK" & @CRLF) Case Else ConsoleWrite(@CRLF & "!" & $sAction & " - FAILED" & @CRLF) Exit EndSwitch EndFunc -
Audiorecorder mp3/ogg/wav (bass.dll)
TheDaverMan replied to eukalyptus's topic in AutoIt Example Scripts
Which is stupid, I'm looking for examples to complete a program. I made a post for help, but nobody helps me. I am looking for the solution to record the resuting channel after VST effect. if you're not too stupid, you know help me ? Thanks. -
Audiorecorder mp3/ogg/wav (bass.dll)
TheDaverMan replied to eukalyptus's topic in AutoIt Example Scripts
Link is dead, can you repost the recorder, please ? -
Receiving sound over UDP/TCP
TheDaverMan replied to Pottery's topic in AutoIt General Help and Support
The link is dead, can you repost this file, please ? -
Bass - How to save file after vst effect ?
TheDaverMan replied to TheDaverMan's topic in AutoIt General Help and Support
Thank you for your response Decipher. Yes I have read this post. The simply way to record: " SoundRecorder.exe", but in my case he is not working correctly with my sound card. >_< Problem: "Periphérique d'enregistrement audio introuvable", he not found record device. All program sound working correctly but microsoft recorder software not working. Another, working, way (for mee) is to use "ffmpeg", but I found this way not a real solution, too heavy: 22MB just to save a .wav sound. I think the correct solution is to write a function same as "WaveWriter" to record sound to file. But I don't have the level for this. I think we need to use Bass_ChannelGetData to take data before save it. I continue to search , thx. -
BASS Function Library (Sound and Music Functions)
TheDaverMan replied to BrettF's topic in AutoIt Example Scripts
Hi, I need help to "Record output of VST Pluggin" on this post : I want to record the output channels after VST effect and save this to file. It this possible to record output windows channels ? Can anybody help me, please !!! -
Bass - How to save file after vst effect ?
TheDaverMan replied to TheDaverMan's topic in AutoIt General Help and Support
-Should I use Bass_Record ?? -And then how to save the file ? Which Bass function use to save ? In other language (VB.Net), I saw the use of "WaveWriter" to save ! Can you help me to take the good way ? Edit I have found this: Topic: Saving a mixer stream (with syncs) to file WaveWriter ww = new WaveWriter(filename, mixerStream, 32, true); float[] data = new float[32768]; while (Bass.BASS_ChannelIsActive(mixerStream) == BASSActive.BASS_ACTIVE_PLAYING) { int length = Bass.BASS_ChannelGetData(mixerStream, data, data.Length); if (length > 0 ) ww.Write(data, length); else break; } ww.Close();on http://www.un4seen.com/ -
Hello, I search to save Bass output channel after a VST effect pluggin !! I found, with an example, how to launch and play Bass VST pluggin. But i don't found how to save the result to a file (wav or mp3). >_< Can anybody help me, please ? #include <BassVST.au3> #include <BassVSTConstants.au3> #include <Bass.au3> #include <BassConstants.au3> $vst_dll = @ScriptDir & "\epicVerb.dll" _BASS_STARTUP ( @ScriptDir & "\BASS.dll") _BASS_VST_STARTUP ( @ScriptDir & "\bass_vst.dll") $GUI = GuiCreate ("GUI", 990, 190) _BASS_Init(0, -1, 44100, 0, "") ;Initalize bass. If @error Then MsgBox(0, "Error", "Could not initialize audio") Exit EndIf $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)") ;Open file dialog. $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0) ;Create a stream with file. If @error Then MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error) Exit EndIf $chan = _BASS_VST_ChannelSetDSP($MusicHandle, $vst_dll, 0, 0) _BASS_ChannelPlay($MusicHandle, False) ;Iniate playback $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) ;Get the length of the song in bytes. _BASS_VST_EmbedEditor($chan, $GUI) GUISetState (@SW_SHOW) While 1 Sleep(20) If GUIGetMsg () = -3 Then _BASS_ChannelStop($MusicHandle) Exit Endif If _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) >= $song_length Then ExitLoop WEnd Func OnAutoItExit() _BASS_Free() EndFunc Free VST pluggins link :http://audio.tutsplus.com/articles/general/over-90-free-vst-effects-plugins/