Jump to content

Recommended Posts

Posted

As valik said, it's not AutoIt's fault. Its probably how we are using it :( Or a bug in my lame ass coding.

You don't hammer nails into windows do they... Thats misusing the tools... Exactly what where doing... Hahahahaha.

I think we might need to see how eukalyptus goes with maybe making another dll to handle the callback like he did with the recording functions? :mellow:

I will sleep on it, and see what I can come up with later, but for now I need to do assignments.

Posted (edited)

Here i have a DLL with Callback-Procs :mellow: (written in freebasic)

#Include "windows.bi"

Function StreamProc ALIAS "StreamProc"(BYVAL handle As Dword, ByVal buffer As PCVOID, ByVal length As Dword,ByVal user As PCVOID) As Boolean Export
     Return True
End Function

Function DownloadProc ALIAS "DownloadProc"(ByVal buffer As PCVOID, ByVal length As Dword,ByVal user As PCVOID) As Boolean Export
     Return True
End Function


function StreamProcWriteFile ALIAS "StreamProcWriteFile"(BYVAL handle As Dword, ByVal buffer As PCVOID, ByVal length As Dword,ByVal user As PCVOID) As Boolean EXPORT
    Dim As Integer written
    If Not WriteFile(user,buffer,length,@written,NULL) Then Return FALSE
    If written < length Then Return False
     RETURN True
End Function

get the Pointers:

; #FUNCTION# ====================================================================================================================
; Name...........: __BASS_LoadLibrary
; Author ........: Paul Campbell (PaulIA)
; ===============================================================================================================================
Func __BASS_LoadLibrary($sFileName)
    Local $aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryA", "str", $sFileName)
    If @error Then Return SetError(1,0,0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_LoadLibrary
; #FUNCTION# ====================================================================================================================
; Name...........: __BASS_LoadLibrary
; Author ........: Prog@ndy
; ===============================================================================================================================
Func __BASS_GetProcAddress($hModule,$sFunctionName)
    Local $aResult = DllCall("Kernel32.dll", "hwnd", "GetProcAddress","hwnd",$hModule, "str", $sFunctionName)
    If @error Then Return SetError(1,0,0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_LoadLibrary


Global Const $hLibBassCB = __BASS_LoadLibrary("BassCB.dll")

Global Const $DownloadProc = __BASS_GetProcAddress($hLibBassCB,"DownloadProc@12")
Global Const $StreamProc = __BASS_GetProcAddress($hLibBassCB,"StreamProc@16")
Global Const $StreamProcWriteFile = __BASS_GetProcAddress($hLibBassCB,"StreamProcWriteFile@16")

Then just use the pointers in place of the Callback parameter.

Example as attachment

BassCB.dll

Bass_Ext.au3

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

I'm telling you, double check your calling conventions on the DllCallback stuff. Stack corruption due to using the wrong calling convention is exactly the sort of thing that can lead to unexpected crashes much later.

Posted

I will bump my original topic in Support... I'm not too good with the callbacks, so it is very possible that it isn't working... I hope someone there has an answer.

Thanks,

Brett

Posted

I'm telling you, double check your calling conventions on the DllCallback stuff. Stack corruption due to using the wrong calling convention is exactly the sort of thing that can lead to unexpected crashes much later.

It's nothing wrong with the calling convention. Here's how the StreamProc callback is defined:

typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user);

And CALLBACK == __stdcall so...

Broken link? PM me and I'll send you the file!

Posted

Here i have a DLL with Callback-Procs :mellow: (written in freebasic)

#Include "windows.bi"

Function StreamProc ALIAS "StreamProc"(BYVAL handle As Dword, ByVal buffer As PCVOID, ByVal length As Dword,ByVal user As PCVOID) As Boolean Export
     Return True
End Function

Function DownloadProc ALIAS "DownloadProc"(ByVal buffer As PCVOID, ByVal length As Dword,ByVal user As PCVOID) As Boolean Export
     Return True
End Function


function StreamProcWriteFile ALIAS "StreamProcWriteFile"(BYVAL handle As Dword, ByVal buffer As PCVOID, ByVal length As Dword,ByVal user As PCVOID) As Boolean EXPORT
    Dim As Integer written
    If Not WriteFile(user,buffer,length,@written,NULL) Then Return FALSE
    If written < length Then Return False
     RETURN True
End Function

get the Pointers:

; #FUNCTION# ====================================================================================================================
; Name...........: __BASS_LoadLibrary
; Author ........: Paul Campbell (PaulIA)
; ===============================================================================================================================
Func __BASS_LoadLibrary($sFileName)
    Local $aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryA", "str", $sFileName)
    If @error Then Return SetError(1,0,0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_LoadLibrary
; #FUNCTION# ====================================================================================================================
; Name...........: __BASS_LoadLibrary
; Author ........: Prog@ndy
; ===============================================================================================================================
Func __BASS_GetProcAddress($hModule,$sFunctionName)
    Local $aResult = DllCall("Kernel32.dll", "hwnd", "GetProcAddress","hwnd",$hModule, "str", $sFunctionName)
    If @error Then Return SetError(1,0,0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_LoadLibrary


Global Const $hLibBassCB = __BASS_LoadLibrary("BassCB.dll")

Global Const $DownloadProc = __BASS_GetProcAddress($hLibBassCB,"DownloadProc@12")
Global Const $StreamProc = __BASS_GetProcAddress($hLibBassCB,"StreamProc@16")
Global Const $StreamProcWriteFile = __BASS_GetProcAddress($hLibBassCB,"StreamProcWriteFile@16")

Then just use the pointers in place of the Callback parameter.

Example as attachment

hmm i get this error:

Bass.au3 (2363) : ==> Badly formatted "Func" statement.:

$dcProc = DllCallbackRegister ($proc, "ptr", "ptr;dword;ptr")

?????????????????????????????????????[..]

>Exit code: 1 Time: 4.792

Posted (edited)

_BASS_StreamCreateURL has to be changed, too

Func _BASS_StreamCreateURL($bass_dll, $url, $offset, $flags, $proc = 0, $user = "")
    Local $dsURL = DllStructCreate("char[255]")
    DllStructSetData($dsURL, 1, $url)
    Local $dsUser = DllStructCreate("char[255]")
    DllStructSetData($dsUser, 1, $user)
    Local $BASS_ret_ = DllCall($bass_dll, "dword", "BASS_StreamCreateURL", "ptr", DllStructGetPtr($dsURL), "DWORD", $offset, "DWORD", $flags, "ptr", $Proc, "ptr", DllStructGetPtr($dsUser))
    Local $error = _BASS_ErrorGetCode($bass_dll)
    If $error <> 0 Then
        Return SetError($error, "", 0)
    Else
        Return SetError(0, "", $BASS_ret_[0])
    EndIf
EndFunc ;==>_BASS_StreamCreateURL
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

Hey there, just a minor observation:

In _BASS_GetVersion(), you probably want to return the hex value of the version. Else, the returned decimal value doesn't make much sense:

For example, 0x02040103 (hex), would be version 2.4.1.3

Still working on BASSmix :) Keep it up!

  • 2 weeks later...
Posted

Hey,

I'm new to Autoit and especially to BASS. I would like to create a gui with a xm music file playing in the background, is this possible? In the BASS website it says it can play xm.

Would anybody be so kind to provide a coding example?

Thank you in advance!

FLX

Posted

Hi,

See the examples contained in the zip. You should be able to modify them to suit your needs. Once you've done that post your code so we can help you more.

Cheers,

Brett

Posted

Hi Brett,

I see your hosting is up again, it was down yesterday which rendered me unable to see the examples. I'll let you know when I got some results.

Thanks,

Dennis

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
  • Recently Browsing   0 members

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