spell-cards.love/0047-play

13 lines
505 B
Plaintext

play = function(word_idx)
if word_idx > #Words then return end
if Words[word_idx].recording then
Playing_source = love.audio.newSource(Words[word_idx].recording)
elseif file_exists(Words[word_idx].contents..'.wav') then
Words[word_idx].recording = love.sound.newSoundData(Words[word_idx].contents..'.wav')
Playing_source = love.audio.newSource(Words[word_idx].recording)
else
Playing_source = love.audio.newSource('sample.wav', 'static')
end
Playing_source:play()
Recording_device = nil
end