From 51e8617ef767f5a1ff2a4e439933dc4e041211d1 Mon Sep 17 00:00:00 2001 From: nucular Date: Mon, 26 May 2014 20:25:10 +0200 Subject: [PATCH] Added Sound.play --- sfxr.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sfxr.lua b/sfxr.lua index d2f21c5..78accb5 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -457,6 +457,16 @@ function sfxr.Sound:generateSoundData(freq, bits) return data end +function sfxr.Sound:play(freq, bits) + local data = self:generateSoundData(freq, bits) + + if data then + local source = love.audio.newSource(data) + source:play() + return source + end +end + function sfxr.Sound:randomize(seed) if seed then setseed(seed) end