Jump to content

Search the Community

Showing results for tags 'Audio Meter'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. I've been studying the AudioMeter2 script by eukalyptus. It's an incredible piece of work, but way over my head. I would like to use only the FFT portion of the meter as a visualizer. I've removed quite a bit and am now at a point where my lack of understanding GDI+ makes me feel like a carpenter trying to perform heart surgery. Can anyone point out additional unneeded code and BASS calls in the script below? Please note that I'll be playing a single mp3 file in my script, so I'll ultimately remove the FileOpenDialog and Debug code, too. ;thx to Authenticity for GDIp.au3 #AutoIt3Wrapper_UseX64=n #include "Bass.au3" #include "BassExt.au3" #include <GDIPlus.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $sFile = FileOpenDialog("Open...", "", "playable formats (*.MP3;*.MP2;*.MP1;*.OGG;*.WAV;*.AIFF;*.AIF)") If @error Or Not FileExists($sFile) Then Exit Global $iWidth = 410 Global $iHeight = 170 Global $hGui, $hGraphics, $hGfxBuffer, $hBmpBuffer, $hBmpBk, $hBmpMeter, $hBmpLed, $hBmpPhase, $hBmpPhaseMeter, $hBmpWave, $hBrushFFT, $hPenPhase, $hPenWaveL, $hPenWaveR Global $aFFT, $aPeak, $aPhaseCorr, $aPhase, $aWave Global $iTimer Global $hStream $hGui = GUICreate("BASS_EXT AudioMeter", $iWidth, $iHeight) GUISetOnEvent(-3, "_EXIT") GUISetBkColor(0x000000) _GDIPlus_Startup() $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) $hBrushFFT = _BrushCreateFFT(0, 0, 410, 170, $iWidth, $iHeight, $hGraphics) $aFFT = _BASS_EXT_CreateFFT(82, 0, 0, 410, 170, 1, 70, True) $hBmpBk = _BMPCreateBackGround($iWidth, $iHeight, $hGraphics) _BASS_Startup(@ScriptDir & "\bass.dll") ___Debug(@error, "load bass.dll") _BASS_EXT_Startup(@ScriptDir & "\bassExt.dll") ___Debug(@error, "load bassext.dll") _BASS_Init(0, -1, 44100, 0, "") ___Debug(@error, "initialize bass") _BASS_SetConfig($BASS_CONFIG_UPDATEPERIOD, 100) ___Debug(@error, "set update period") _BASS_SetConfig($BASS_CONFIG_BUFFER, 250) ___Debug(@error, "set buffer size") GUIRegisterMsg(0x000F, "WM_PAINT") GUISetState() $hStream = _BASS_StreamCreateFile(False, $sFile, 0, 0, 0) ___Debug(@error, "create stream from file: " & $sFile) $aPeak = _BASS_EXT_ChannelSetMaxPeakDsp($hStream) ___Debug(@error, "set dsp callback to check for the highest peak") _BASS_ChannelPlay($hStream, True) ___Debug(@error, "start stream") $iTimer = TimerInit() While _BASS_ChannelIsActive($hStream) If TimerDiff($iTimer) > 25 Then $iTimer = TimerInit() _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBmpBk, 0, 0) _DrawFFT() _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) ;ConsoleWrite(TimerDiff($iTimer) & @CRLF) EndIf WEnd _Exit() Func _DrawFFT() Local $iTimer = TimerInit() _BASS_EXT_ChannelGetFFT($hStream, $aFFT, 6) If Not @error Then DllCall($ghGDIPDll, "int", "GdipFillPolygonI", "handle", $hGfxBuffer, "handle", $hBrushFFT, "ptr", $aFFT[0], "int", $aFFT[1], "int", "FillModeAlternate") EndFunc ;==>_DrawFFT Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return 'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func _BMPCreateBackGround($iW, $iH, $hGraphics) Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) _GDIPlus_GraphicsClear($hContext, 0xFF000000) Local $hBrushBK = _GDIPlus_BrushCreateSolid(0xEE000000) Local $hBrushTXT = _GDIPlus_BrushCreateSolid(0xFF99AAFF) Local $hPen = _GDIPlus_PenCreate(0xFF222222, 1) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrushBK) _GDIPlus_BrushDispose($hBrushTXT) _GDIPlus_GraphicsDispose($hContext) Return $hBitmap EndFunc ;==>_BMPCreateBackGround Func _BrushCreateFFT($iX, $iY, $iW, $iH, $iWidth, $iHeight, $hGraphics) Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsClear($hContext, 0xFF000000) Local $hBrush[5] $hBrush[0] = _GDIPlus_BrushCreateSolid(0xFFFF0000) $hBrush[1] = _GDIPlus_LineBrushCreate(0, 0, 0, 20, 0xFFFF0000, 0xFFFFAA00, 1) $hBrush[2] = _GDIPlus_LineBrushCreate(0, 20, 0, 40, 0xFFFFAA00, 0xFF00AAFF, 1) $hBrush[3] = _GDIPlus_BrushCreateSolid(0xFF00AAFF) $hBrush[4] = _GDIPlus_LineBrushCreate(0, 0, 0, 4, 0x00000000, 0xAA000000, 0) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY, $iW, 20, $hBrush[0]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY + 20, $iW, 20, $hBrush[1]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY + 40, $iW, 20, $hBrush[2]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY + 60, $iW, $iH - 60, $hBrush[3]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY, $iW, $iH, $hBrush[4]) For $i = 0 To 4 _GDIPlus_BrushDispose($hBrush[$i]) Next _GDIPlus_GraphicsDispose($hContext) Local $aRet = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "hwnd", $hBitmap, "int", 0, "int*", 0) _GDIPlus_BitmapDispose($hBitmap) Return $aRet[3] EndFunc ;==>_BrushCreateFFT Func _Exit() _BASS_EXT_ChannelRemoveMaxPeakDsp($aPeak) ___Debug(@error, "remove peak dsp") _BASS_ChannelStop($hStream) ___Debug(@error, "stop stream") _BASS_StreamFree($hStream) ___Debug(@error, "free stream") _BASS_Free() ___Debug(@error, "free bass") ;~ _GDIPlus_BitmapDispose($hBmpMeter) ;~ _GDIPlus_BitmapDispose($hBmpLed) ;~ _GDIPlus_BitmapDispose($hBmpPhaseMeter) ;~ _GDIPlus_BitmapDispose($hBmpPhase) ;~ _GDIPlus_PenDispose($hPenPhase) ;~ _GDIPlus_BitmapDispose($hBmpWave) ;~ _GDIPlus_PenDispose($hPenWaveL) ;~ _GDIPlus_PenDispose($hPenWaveR) _GDIPlus_BrushDispose($hBrushFFT) _GDIPlus_BitmapDispose($hBmpBk) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Func ___DeBug($iError, $sAction) Switch $iError Case -1 ConsoleWrite(@CRLF & "-" & $sAction & @CRLF) Case -2 ConsoleWrite(@CRLF & ">" & $sAction & @CRLF) Case 0 ConsoleWrite(@CRLF & "+" & $sAction & " - OK" & @CRLF) Case Else ConsoleWrite(@CRLF & "!" & $sAction & " - FAILED, @error: " & $iError & @CRLF) _Exit() EndSwitch EndFunc ;==>___DeBug Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0) Local $tPointF1, $pPointF1 Local $tPointF2, $pPointF2 Local $aResult $tPointF1 = DllStructCreate("float;float") $pPointF1 = DllStructGetPtr($tPointF1) $tPointF2 = DllStructCreate("float;float") $pPointF2 = DllStructGetPtr($tPointF2) DllStructSetData($tPointF1, 1, $nX1) DllStructSetData($tPointF1, 2, $nY1) DllStructSetData($tPointF2, 1, $nX2) DllStructSetData($tPointF2, 2, $nY2) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0) If @error Then Return SetError(@error, @extended, 0) ;$GDIP_STATUS = $aResult[0] Return $aResult[6] EndFunc ;==>_GDIPlus_LineBrushCreate
  2. Hi guys, I need help with making a vu meter for the audio-out. I checked the forum threads, i even looked on google, and it either requires higher level of programming or not enough information was given. I even looked into C++ ( I am NOT good at C++ at all) and it looks like it could get me somewhere but I really want to be able to get it on autoit. Program Idea: Go to a video website, play the video, DETECT IF ANY SOUND IS COMING OUT, if not, click on next video, else, activate full screen. I saw something involving the mci from microsoft msdn, but it only involved audio-in. I really just need the output, even a small little boolean would work. Just as long as I know there's either sound coming out or not. Steer me in the right direction perhaps? I'm up for learning... just not so much though... =/
×
×
  • Create New...