Monday, May 13, 2013

[TUT] Using NAudio to play sounds - Very good, play more than one sound at same time :)

Hohoho, that's nice, thx to my friend TheVideoVolcano and to NAudio developers now i can play simultaneous sounds in my scripts, and you too :)

What we need is this beautiful DLL: NAudio

The code it's very simple:


We need to add Naudio.dll as reference in the project and paste one copy of this file in the GTAIV.exe folder

Other interesting features is:

Control Volume:

original volume is 1.0, we can reduce or increase it:
wc.Volume = 0.1
Wait(500)
wc.Volume = 2
Wait(500)
wc.Volume = 1
Skip seconds of audio:
wc2.Skip(1)
Seek to determine playback start in audio data
wc2.Seek(100000, SeekOrigin.Begin)

Download the sample project here, remember to put NAudio.dll inside gtaiv.exe folder, or you will obtain error when calling the methods :)
//propaganda YT float style='display:none;'