We dont need to allow local file to play midi.
Just input the .dls file and change it's path.
miditest.w3m
My test code below:
Jass:
library midi
function Trig_InitMIDI_Actions takes nothing returns nothing
local sound midlib=CreateMIDISound("AshenvaleDay",1,1)
call StartSound(midlib)
call StopSound(midlib,false,true)
call SetMapMusic( "cmx.mid;fxt.mid",true,2)//set bgm
endfunction
function InitTrig_InitMIDI takes nothing returns nothing
set gg_trg_InitMIDI = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_InitMIDI, 0.00 )
call TriggerAddAction( gg_trg_InitMIDI, function Trig_InitMIDI_Actions )
call StopSound(bj_nightAmbientSound,true,false)
call StopSound(bj_dayAmbientSound,true,false)
call ClearMapMusic()
call SetMusicVolume(100)
call VolumeGroupSetVolume(ConvertVolumeGroup(1),0.5)
call VolumeGroupSetVolume(ConvertVolumeGroup(2),0.5)
call VolumeGroupSetVolume(ConvertVolumeGroup(5),1)
endfunction
endlibrary
Here are some bugs:
1.It may cause war3 crash when reload the map(maybe)
2.Some times there will be no sound until sevel minutes.