spell-cards.love/0034-record

18 lines
527 B
Plaintext
Raw Normal View History

2023-03-10 05:22:12 +00:00
record = function(word_idx)
if Recording_device then
Words[word_idx].recording = Recording_device:getData()
Recording_device:stop()
if Words[word_idx].recording then
save_wav(Words[word_idx].contents..'.wav', Words[word_idx].recording)
end
Recording_device = nil
Recording_word = nil
return
end
local devices = love.audio.getRecordingDevices()
if #devices == 0 then return end
Recording_device = devices[1]
Recording_device:start(10*8000, 8000)
Recording_word = Words[word_idx]
Playing_source = nil
end