Hello, I'm not sure if this thread is still alive or not but I will hope someone can help here.
Fixed:
I am trying to get pitch to work, which requires loading bass_fx.dll. The problem is that when I load the .dll it gives me error 41, file is not a plugin. I'm not using your wrappers exactly, but my dllcalls are based off of them so they have the same structure.
When I call BASS_ChannelSetAttribute, it gives me error 19, which is Param Illtype. The structure of the call was taken from your wrapper.
Also credit to k3ph and lexi for the code under BASS_StreamCreateChannel and CopyAnsiToUnicode.
Code:
#NoEnv
SetBatchLines -1
OnExit, Exit
#Include bass.ahk
bassfx := A_ScriptDir . "\bass_fx.dll"
BASS_ATTRIB_TEMPO_PITCH := 0x10001
hBassModule := DllCall("LoadLibrary", "str", "bass.dll")
hBassFXModule := DllCall("LoadLibrary", Str, "bass_fx.dll")
DllCall("bass.dll\BASS_PluginLoad", Ustr, &bassfx, Uint, 0)
Error := DllCall("bass.dll\BASS_ErrorGetCode")
;Msgbox % Error
Gui, Add, Text,, Pitch (-60 to 60)
Gui, Add, Edit, vPitch
Gui, Add, Button, gPitch, Set
Gui, Show,, Pitch Test
Return
Pitch:
Gui, Submit, NoHide
hStream := BASS_StreamCreateChannel()
PitchErr := DllCall("bass.dll\BASS_ChannelSetAttribute", Uint, hStream, Uint, BASS_ATTRIB_TEMPO_PITCH, Float, Pitch) ;This part doesn't work
Error := DllCall("bass.dll\BASS_ErrorGetCode")
Msgbox % Error . " " . PitchErr
DllCall("bass.dll\BASS_ChannelPlay", Uint, hStream, Int, 0)
Error := DllCall("bass.dll\BASS_ErrorGetCode")
Msgbox % Error
Return
BASS_StreamCreateChannel(device=-1,freq=44100,flags=0,win=0,clsid=0) {
DllCall("bass.dll\BASS_Init", Int, device, Int, freq, Int, flags, UInt, win, UInt, clsid)
Filter := "BASS Streamable built-in (*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aif;*.aiff;*.aifc;)|*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aif;*.aiff;*.aifc;|All files (*.*)|*.*"
VarSetCapacity(wFilter, StrLen(Filter)*2+2)
ptr := &wFilter
Loop, Parse, Filter, |
ptr += 2 * CopyAnsiToUnicode(A_LoopField, ptr, StrLen(A_LoopField))
NumPut(0, ptr+0, "short")
VarSetCapacity(wFile,(nMaxFile:=65535)*2)
NumPut(0, wFile, "short")
VarSetCapacity(ofn, 88, 0)
if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME
NumPut(76, ofn)
else
NumPut(88, ofn)
NumPut(&wFilter, ofn, 12)
NumPut(&wFile, ofn, 28)
NumPut(nMaxFile, ofn, 32)
NumPut((OFN_HIDEREADONLY:=0x4)|(OFN_EXPLORER:=0x80000), ofn, 52)
DllCall((A_OSType="WIN32_WINDOWS" ? "unicows" : "comdlg32") . "\GetOpenFileNameW", "uint", &ofn)
NumGet(ofn, 56, "UShort")
Return DllCall("bass.dll\BASS_StreamCreateFile", Uint, 0, Uint, &wfile, Uint64, 0, Uint64, 0, Uint, 0x80000000)
}
CopyAnsiToUnicode(Source, DestPtr, Len)
{ ; Not sure how well this works on 9x/ME:
return DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &Source, "int", Len + 1, "Uint", DestPtr, "int", Len + 1)
}
GuiClose:
Exit:
DllCall("FreeLibrary", "UInt", hBassModule)
DllCall("FreeLibrary", "UInt", hBassFXModule)
ExitApp