Mp3 working version (slightly modified
from here)
#SingleInstance Force
#Persistent
SetBatchLines,-1
Thread, NoTimers
onexit, exit
#include bass.ahk
; Caller must ensure sufficient space at DestPtr.
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)
}
BASS_Load()
BASS_Init()
Filter := *
; Convert pipe-delimited ANSI filter string to null-delimited Unicode string.
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)
; Initialize filename to empty unicode string.
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)
; Unicode support on 9x/ME (WIN32_WINDOWS) by Lexikos
DllCall((A_OSType="WIN32_WINDOWS" ? "unicows" : "comdlg32") . "\GetOpenFileNameW", "uint", &ofn)
BASS_StreamFree(stream)
stream:=BASS_StreamCreateFile(false,&wFile,0,0,0x80000000) ; 0x80000000 BASS_Unicode
BASS_ChannelPlay(stream,1)
return
exit:
BASS_Free()
ExitApp
I tried to replace with Midi but it doesn't work
#SingleInstance Force
#Persistent
SetBatchLines,-1
Thread, NoTimers
onexit, exit
#include bass.ahk
; Caller must ensure sufficient space at DestPtr.
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)
}
BASS_Load()
BASS_Init()
[color=red]BASS_MIDI_Init()[/color]
Filter := *
; Convert pipe-delimited ANSI filter string to null-delimited Unicode string.
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)
; Initialize filename to empty unicode string.
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)
; Unicode support on 9x/ME (WIN32_WINDOWS) by Lexikos
DllCall((A_OSType="WIN32_WINDOWS" ? "unicows" : "comdlg32") . "\GetOpenFileNameW", "uint", &ofn)
BASS_StreamFree(stream)
[color=red]stream:=BASS_MIDI_StreamCreateFile(false,&wFile,0,0,0x80000000,44100) ; 0x80000000 BASS_Unicode[/color]
BASS_ChannelPlay(stream,1)
return
exit:
BASS_Free()
[color=red] BASS_MIDI_Free()[/color]
ExitApp
K3ph is obviously not on this forum anymore, so if anyone can help it's great