HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sound wont play

09-05-2007, 03:52 AM#1
botanic
I am trying to trigger the playing of a set of sounds (like a midi) but none of the sounds play :/

I also attached a test map I have been using

Collapse JASS:
function Stoptimer1 takes nothing returns nothing
local timer T = GetExpiredTimer()
call PauseTimer(T)
call ReleaseTimer(T)
call StopSoundBJ( udg_Sound[1], false )
endfunction

function start takes integer track, sound S, real V, real time returns nothing

local timer T = NewTimer() 
call PlaySoundBJ(S)
call PlaySoundBJ( S )
set udg_Sound[track] = S
if track == 1 then
call TimerStart(T, time, true, function Stoptimer1)
endif
set T = null
endfunction

function Track_1 takes nothing returns nothing

local sound S

call start(1,gg_snd_A_3,100,1.00)
call start(1,gg_snd_A_3,100,1.00)
call start(1,gg_snd_FS4,100,1.00)
call start(1,gg_snd_E_4,100,1.00)
call start(1,gg_snd_D_4,100,1.00)
call start(1,gg_snd_CS4,100,1.00)
call start(1,gg_snd_B_3,100,1.00)
call start(1,gg_snd_A_3,100,1.00)
call start(1,gg_snd_B_3,100,1.00)
call start(1,gg_snd_CS4,100,1.00)
call start(1,gg_snd_D_4,100,1.00)
call start(1,gg_snd_CS4,100,1.00)
call start(1,gg_snd_B_3,100,1.00)
call start(1,gg_snd_A_3,100,1.00)
call start(1,gg_snd_G_3,100,1.00)
call start(1,gg_snd_FS3,100,1.00)
call start(1,gg_snd_G_3,100,1.00)
call start(1,gg_snd_E_3,100,1.00)

endfunction

function Track_2 takes nothing returns nothing
local sound S
endfunction
function Track_3 takes nothing returns nothing
local sound S
endfunction
function Track_4 takes nothing returns nothing
local sound S
endfunction
function Track_5 takes nothing returns nothing
local sound S
endfunction

function Trig_Song_001_Actions takes nothing returns nothing
    call ExecuteFunc("Track_1")
    call ExecuteFunc("Track_2")
    call ExecuteFunc("Track_3")
    call ExecuteFunc("Track_4")
    call ExecuteFunc("Track_5")
endfunction

//===========================================================================
function InitTrig_Song_001 takes nothing returns nothing
    set gg_trg_Song_001 = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Song_001, 5 )
   call TriggerAddAction( gg_trg_Song_001, function Trig_Song_001_Actions )

endfunction

//You will need to import the following notes for this song:
//
Attached Files
File type: w3xuntitled.w3x (63.6 KB)
09-05-2007, 09:42 AM#2
Anitarf
Do the sounds not play multiple times, or only the first time you try to play them? I've had this problem with sounds in my cinematic system, the first time a sound with a certain path was played it for some reason didn't work, all subsequent sounds with that path did, though, so I fiexed it by "preloading" all sounds by playing them once (at 0 volume, just in case they did work for some reason) shortly after map init.
09-05-2007, 10:14 AM#3
botanic
no sounds play not the first or any others :/

I knew about the first sound thing but even when I put 5 of the same in a row nothing happens :/
09-06-2007, 01:01 AM#4
Ammorth
When you declare a new soundhandle, it will not work in the trigger thread it was created in. Creating a sound and then playing it in a callback timer of 0. should work.