- x.love
- (64.14 KiB) Downloaded 178 times
play 1 sound 2 times?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: play 1 sound 2 times?
I am attaching a fixed version.
I had to do more work than anticipated (clone each source before playing it, and storing it in a "current" var). This is because LÖVE seems to be doing something strange with the sources: when a source has finished playing, and you play it again (with :play), it sometimes returns false on :isPlaying - as a result, some words were being skipped if you used them twice on the same phrase, a bit randomly.
By cloning the source before playing it I sidestep this issue (at the price of consuming a bit more memory).
I seem to remember there was a detected problem with sources on 0.9.1 which was fixed on 0.9.2, maybe that was it.
I had to do more work than anticipated (clone each source before playing it, and storing it in a "current" var). This is because LÖVE seems to be doing something strange with the sources: when a source has finished playing, and you play it again (with :play), it sometimes returns false on :isPlaying - as a result, some words were being skipped if you used them twice on the same phrase, a bit randomly.
By cloning the source before playing it I sidestep this issue (at the price of consuming a bit more memory).
I seem to remember there was a detected problem with sources on 0.9.1 which was fixed on 0.9.2, maybe that was it.
- Attachments
-
- x.love
- (65.2 KiB) Downloaded 79 times
When I write def I mean function.
Re: play 1 sound 2 times?
ok, thank you for this fixkikito wrote:I am attaching a fixed version.
I had to do more work than anticipated (clone each source before playing it, and storing it in a "current" var). This is because LÖVE seems to be doing something strange with the sources: when a source has finished playing, and you play it again (with :play), it sometimes returns false on :isPlaying - as a result, some words were being skipped if you used them twice on the same phrase, a bit randomly.
By cloning the source before playing it I sidestep this issue (at the price of consuming a bit more memory).
I seem to remember there was a detected problem with sources on 0.9.1 which was fixed on 0.9.2, maybe that was it.
[edit:] the memory is not going to be filled with duplicates after a few sentences right?
i really hope this is fixed in 0.9.2.
is it possible to download version 0.9.2 anywhere that you know of or did you just noticed somewhere it maybe be fixed in 0.9.2?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: play 1 sound 2 times?
Some memory will get filled with those extra sources, and when they are finished playing and are de-referenced from the phrase, they will be garbage-collected.
On the particular example I gave you the "last clone" keeps being referenced by words.current so it will never be garbage collected. You can change this by making current = nil when the phrase is finished (when phrase.index > #phrase)
On the particular example I gave you the "last clone" keeps being referenced by words.current so it will never be garbage collected. You can change this by making current = nil when the phrase is finished (when phrase.index > #phrase)
When I write def I mean function.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 7 guests