love-loader: load resources in a separate thread, easily

Showcase your libraries, tools and other projects that help your fellow love users.
Kmz8160
Prole
Posts: 1
Joined: Sun Jan 29, 2012 8:32 am

Re: love-loader: load resources in a separate thread, easily

Post by Kmz8160 »

Maybe your problem is:
In the .love, the file and
directory path names are case
sensitive. This can be puzzling
for Windows and Mac OS X lovers , whose filesystem is case insensitive, and whose
games may work when
unzipped but not when
packaged.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by kikito »

Hi there! Good morning!

So many replies! I'll answer 1 by 1.
MarekkPie wrote:I'm sure there is one, but what would be the point of this?
I should have explained it a bit better, but I was just too tired last night.

I've edited the OP and added an explanation there, so people can read it more easily.
Boolsheet wrote:I think the 'if' statement in killThreadIfDone is the culprit. It probably should also check if resourceBeingLoaded is nil.

Code: Select all

if #pending == 0 and not resourceBeingLoaded then
I'll give that a try, thanks!
Kmz8160 wrote:Maybe your problem is:
etc...
I'm pretty sure that's not the problem. I'm using linux, which is case-sensitive on the files. But thanks, and welcome to the forum!

Taehl, Tentus: Thanks for your kind words!
slime wrote:I think you could make this forward-compatible with 0.8.0 pretty easily by either defining the send and receive methods as set and get if they don't exist, or doing if-checks in the places where you send and receive (like: if mythread.get then mythread:get("blah") else mythread:receive("blah") end, or whatever)
I will do so when it gets released. Another thing that will change (I think) is the way fonts are handled. I want to include font loading options on the loader, too. I will wait until 0.8.x is released before preparing it at all. I take note of your changes, though (didn't know the thread interface also changed). Thanks.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by Robin »

Boolsheet's thing works for me, both uncompressed and as a .love. Very nice, btw.

What's "media/ocremix.org"?
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by Jasoco »

Robin wrote:Boolsheet's thing works for me, both uncompressed and as a .love. Very nice, btw.

What's "media/ocremix.org"?
It appears to be a license for usage of the music file in that folder which is an MP3 (Converted to OGG) of a remix from Mega Man 9 called "Astro Fusion" from the Galaxy Man stage.
OverClocked ReMix grants all parties a limited, non-exclusive, non-transferable, universal license to use, redistribute, incorporate into other works, and publicly perform OverClocked ReMixes as long as the following criteria are met:

A.) No profit is made from the exercise of this license. This includes but is not limited to incorporation of OverClocked ReMixes into commercial works, charging or accepting more than the cost of the delivery means or medium(s) for redistributing OverClocked ReMixes, accepting donations and/or offering "Name Your Own Price" options for OverClocked ReMixes, or redistributing OverClocked ReMixes in the context of commercial advertisements. Live performance or playback of OverClocked ReMixes may occur in commercial, for-profit spaces such as stores, private clubs, or other gatherings, so long as no cost is explicitly associated with listening to them and no endorsement of the commercial entity by OverClocked ReMix can be inferred.
B.) If OverClocked ReMixes are being redistributed, performed, or incorporated into other works, materials used must be clearly attributed both to the ReMixer(s) who created them and to OverClocked ReMix. This accreditation must be in the form of the ReMixer name(s) followed by "OverClocked ReMix (http://www.ocremix.org)". In applicable contexts where user interactivity is possible, such as websites, the site name and URL must be linked to http://www.ocremix.org. Accreditation must be presented as close to the utilized material as possible; if OverClocked ReMixes are used in a video, accreditation must be included in credits at the end, but if displayed on a website, accreditation must be prominently displayed in context with the utilized material. In the case of public or semi-public performances where accreditation is not reasonable, responding to audience inquiries with this information will suffice.
C.) If OverClocked ReMixes are being redistributed, they may not be modified in any way from the MP3 versions made available on http://www.ocremix.org. This includes but is not limited to any modifications to ID3 tagging. Modifications for personal use not involving redistribution, such as burning personal mix CDs or reformatting files for other devices, is acceptable.
OverClocked ReMix reserves the right to terminate this license at any time. In such instances where OverClocked ReMixes have been incorporated into other works or are being redistributed or performed, the original artist must be contacted to obtain a separate license for the material in question, and all references and attribution to OverClocked ReMix must be removed. OverClocked ReMix maintains sole control of the distribution of materials under its name, as designated by "OC ReMix" in track titles, the "OC_ReMix" file suffix, or other indicators clearly establishing attribution of works to OverClocked ReMix. OverClocked ReMix in no way indemnifies those utilizing OverClocked ReMixes from legal action on the part of third party copyright holders.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by kikito »

Jasoco is right on the money. Maybe I should have called it ocremix.org.txt or something.

I had to convert it to .ogg because the .mp3 didn't reproduce well, at least on my machine. I think this is acceptable according to that license, because I'm not really "distributing it".

Rest: Boolsheet's patch worked like a charm. I have fixed the demo in the OP, and released version 1.0.0 !
When I write def I mean function.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: love-loader: load resources in a separate thread, easily

Post by thelinx »

Could you add support for newSoundData?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by kikito »

thelinx wrote:Could you add support for newSoundData?
I'm sorry, but I don't think I can. I don't understand LÖVE's models well enough to do it. The wiki is very sparse on this. I don't know what a Decoder is. Or what do the parameters "samples, rate, bits, channels" in love.sound.newSoundData mean.

This is not the first time I encounter this problem. The *Data objects are very poorly explained, if at all, on the wiki. If I was able to implement the lib as it is now, it was because I found some some working code in Ninja vs Samuray and I could learn from it.

I've tried to make the source code as easy to understand as I could. If you are more versed on these matters, you can send me a pull request. Or, you can explain to me what is the deal with the soundDatas, decoders, etc. so I can understand the logic behind it and implement it myself.
When I write def I mean function.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: love-loader: load resources in a separate thread, easily

Post by thelinx »

Just use newSoundData(...) and pass whatever is passed to your loader function. The arguments themselves don't matter.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by tentus »

Kikito: you've got a typo on the Github page, I don't think you mean "0.8.2".
Kurosuke needs beta testers
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: love-loader: load resources in a separate thread, easily

Post by kikito »

thelinx wrote:Just use newSoundData(...) and pass whatever is passed to your loader function. The arguments themselves don't matter.
I'm afraid it's not as simple as that. The parameters have to be sent to a thread, so it can do its work. Threads however only admit strings, numbers, booleans and userdata on their parameters. Right now I only had one paramter of those types. So it kindof worked fine. Now I would have to "encode" and "decode" the numbers in a string, and also have a way to tell the thread "hey, this string isn't a path - It's a group of encoded numbers".

I guess it's doable, but it is quite strange. What do those parameters mean? How is a soundData used, when created with those four values? What does it represent? The code at the end of the love.sound.newSoundData page doesn't explain it, and it doesn't look right.
tentus wrote:Kikito: you've got a typo on the Github page, I don't think you mean "0.8.2"
Thanks! Fixed.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest