Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this .
opatut
Prole
Posts: 7 Joined: Mon Feb 20, 2012 2:34 pm
Post
by opatut » Sun Aug 26, 2012 12:36 pm
Hey guys,
I am making a
framework where people can build custom audio visualizers in Löve. I want them to be able to load up their own audio file, i.e. run
Code: Select all
love visualove.love /path/to/audio/file.mp3
and have it played. It seems like love.filesystem does not support absolute paths, neither did I find a way to wrap a userdata object (from io.open) into a Love File Object, which I need to decode the audio. Is there any workaround for this, or do I have to request something similar to be implemented in Löve? I just want to bypass the PhysFS.
Thanks
- opatut
Boolsheet
Inner party member
Posts: 780 Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland
Post
by Boolsheet » Sun Aug 26, 2012 2:13 pm
opatut wrote: It seems like love.filesystem does not support absolute paths
That is correct.
opatut wrote: neither did I find a way to wrap a userdata object (from io.open) into a Love File Object
You can do that with
love.filesystem.newFileData .
Code: Select all
love.filesystem.newFileData(myData, "myAudio.mp3", "file")
The mp3 extension in the file name is important in this case.
Shallow indentations.
opatut
Prole
Posts: 7 Joined: Mon Feb 20, 2012 2:34 pm
Post
by opatut » Sun Aug 26, 2012 4:44 pm
Thanks. Problem is, who do I get that FileData through the Decoder and SoundData into the SoundSource? The Decoder won't accept userdata, only filenames or Löve files. And love's FileData is not a 'File' object.
I thought I could do this:
io.open -> love.FileData -> love.File -> love.audio.Decoder -> love.audio.SoundData -> love.sound.Source
but apparently I cannot create a love.File from memory.
opatut
Prole
Posts: 7 Joined: Mon Feb 20, 2012 2:34 pm
Post
by opatut » Sun Aug 26, 2012 4:54 pm
I even tried copying the metatable from a love.File to my file userdata - but well, that is not allowed from Lua:
http://lua-users.org/lists/lua-l/2004-06/msg00647.html
I will try to solve it by copying the file to my ~/.local/share/love/ directory via io, then loading it via PhysFS... hope that works.
Boolsheet
Inner party member
Posts: 780 Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland
Post
by Boolsheet » Sun Aug 26, 2012 4:57 pm
Ah. I thought one of the functions takes Data objects. It looks like they don't, sorry.
Shallow indentations.
Users browsing this forum: Amazon [Bot] , Bing [Bot] and 9 guests