Jump to content

DllCall for fftdll.dll


Recommended Posts

Hello.  It's easy. Check this example.

 

#include <GUIConstantsEx.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 500, 300)
    GUISetState(@SW_SHOW, $hGUI)

    Local $tWave = DllStructCreate("short[1025]")
    Local $tMid = DllStructCreate("float[1025]")
    Local $tAmplitude = DllStructCreate("float[1025]")
    Local $tPhase = DllStructCreate("float[1025]")
    Local $iFs = 5120
    Local $iLen = 1024
    Local $iDX = (1.0 / $iFs)
    Local $iDF = ($iFs / 1024.0)
    Local $iDT = $iDX

    For $i = 1 To $iLen
        Local $t1 = 6.28 * $iDT * $i * 20
        DllStructSetData($tWave, 1, (3276 * Sin($t1)), $i)
        DllStructSetData($tMid, 1, (DllStructGetData($tWave, 1, $i) / 3276.0), $i)
    Next

    Local $hFFT = DllOpen("fftdll.dll")
    DllCall($hFFT, "none", "initDraw", "handle", $hGUI)
    DllCall($hFFT, "none", "spectrum_a_p", "ptr", DllStructGetPtr($tMid), "ptr", DllStructGetPtr($tAmplitude), "ptr", DllStructGetPtr($tPhase))
    DllCall($hFFT, "none", "display", "int", 25, "int", 30, "int", 100, "int", 450, "int", 2, "float", $iDX, "ptr", DllStructGetPtr($tMid), "int", 12, "int", 1, "int", 3, "int", 7)
    DllCall($hFFT, "none", "display", "int", 25, "int", 150, "int", 100, "int", 450, "int", 1, "float", $iDF, "ptr", DllStructGetPtr($tAmplitude), "int", 12, "int", 1, "int", 3, "int", 7)


    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                DllClose($hFFT)
                ExitLoop

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example


 

 

pd: I'll update sintaxis highlight later (all around know about my internet issue 🤫)

Saludos

Edited by Danyfirex
edited code tag
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...