-- Primer files
cPathDLL = "Autoplay\\docs\\bass.dll"; -- required library (http://www.un4seen.com/)
-- Mod music also supported (some modification in code required) but use for this smaller bassmod.dll
-- Parameters for playing, see included sources and help for bass.dll for more parameters
BASS_MUSIC_MONO = "0";
BASS_MUSIC_LOOP = "0";
-- Initializing, loading and playing (place PlayBassMusic() function in 'On Startup' actions)
function PlayBassMusic(cPathMuz)
-- Loading dll into the memory
hDLL = DLL.CallFunction("kernel32.dll", "LoadLibraryA", "\""..cPathDLL.."\"", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
if (hDLL ~= 0) then -- if loaded then
-- Initializes an output device
fDll = DLL.CallFunction(cPathDLL, "BASS_Init", "-1,44100,0,0,0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
if (fDLL ~= 0) then -- if initialized then
DLL.CallFunction(cPathDLL, "BASS_PluginLoad", "\"Autoplay\\docs\\bassflac.dll\", 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
DLL.CallFunction(cPathDLL, "BASS_PluginLoad", "\"Autoplay\\docs\\bass_aac.dll\", 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
DLL.CallFunction(cPathDLL, "BASS_PluginLoad", "\"Autoplay\\docs\\bass_alac.dll\", 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
DLL.CallFunction(cPathDLL, "BASS_PluginLoad", "\"Autoplay\\docs\\bass_ape.dll\", 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
DLL.CallFunction(cPathDLL, "BASS_PluginLoad", "\"Autoplay\\docs\\bass_mpc.dll\", 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
DLL.CallFunction(cPathDLL, "BASS_PluginLoad", "\"bass_ofr.dll\", 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
--Starts the output
sDLL = DLL.CallFunction(cPathDLL, "BASS_Start", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
if (sDLL ~= 0) then -- if successful then
-- Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file
-- Please note: new bass.dll v2.4 used in some functions 64-bit parameters (QWORD)
-- In this case parameters must be doubled (64 = 32 and 32), for example: "result, result, integer, integer"
iDLL = DLL.CallFunction(cPathDLL, "BASS_StreamCreateFile", "0,\""..cPathMuz.."\", 0, 0, 0, 0,"..BASS_MUSIC_MONO+BASS_MUSIC_LOOP, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
if (iDLL ~= 0) then
-- Starts playback of a stream
DLL.CallFunction(cPathDLL, "BASS_ChannelPlay", iDLL..",1", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
tam = DLL.CallFunction(cPathDLL, "BASS_ChannelGetLength", iDLL..", BASS_FILEPOS_END", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Progress.SetRange("Progress1", 0, 100);
end
end
end
end
end
-- Unload dll from the memory
-- Please note: this function must be called every time before exiting from setup
-- Place it on each screen on 'On Cancel' properties:
--[[
if g_ConfirmSetupAbort() then
UnloadBassMusic()
Application.Exit(EXIT_REASON_USER_ABORTED);
end
]]--
-- On finish page place it on 'On Next' (and 'On Cancel') screen properties
--[[
UnloadBassMusic()
Screen.Next();
]]--
function UnloadBassMusic()
Page.StopTimer(10);
-- Frees all resources used by the output device, including all its samples, streams and MOD musics
DLL.CallFunction(cPathDLL, "BASS_Free", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
DLL.CallFunction("kernel32.dll", "FreeLibrary", hDLL, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
end