Load
This function loads a sound from a sound (*.wav) file.
Syntax
- Sound Load(string path, number flags=0)
Parameters
- path: the file path to load the font from.
- flags: asset load parameters.
Returns
Returns the loaded sound. If the sound cannot be loaded, NULL is returned.
Remarks
Only sounds in mono format can be played with 3D spatialization. Stereo sounds will not be affected by position.
Example
window = Window:Create()
context = Context:Create(window)
sound = Sound:Load("Sound/Music/menutheme.wav")
sound:Play()
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
context:SetColor(0,0,0)
context:Clear()
context:SetColor(1,1,1)
context:SetBlendMode(Blend.Alpha)
context:DrawText("Sound length: " .. sound:GetLength() .. " seconds",2,2)
context:SetBlendMode(Blend.Solid)
context:Sync()
end