New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Plays Repeatedly (unlike Gosu) #14

Open
ashes999 opened this Issue Apr 12, 2013 · 8 comments

Comments

Projects
None yet
2 participants
@ashes999
Contributor

ashes999 commented Apr 12, 2013

Hi,

I noticed two distinct differences between Gosu and android-gosu.

  1. If I load a huge sound (5MB+) in MainWindow.initialize, gosu freezes with the game not loaded or displaying anything, while gosu-android starts the game and the sound loads later.
  2. If in draw or update I call sound.play (I know, I know, it's crazy), gosu waits until the sound finishes before restarting it (normal looping). gosu-android stops and restarts, so it sounds like the first fractional second of the sound is stuck.

The first issue is not really a problem (where's my Ruboto loading screen?!), but I would like to resolve the second issue. I'll take a look at the code tonight if I can, and see if it's easy to do so. Please confirm if that change is okay with you :)

@neochuky

@ashes999 ashes999 closed this Apr 12, 2013

@Garoe

This comment has been minimized.

Show comment
Hide comment
@Garoe

Garoe Apr 12, 2013

Owner

About 1) that is intentional, since loading times on phones is significantly higher than on PCs I think that it is better not to wait for the song to be loaded and start the game as soon as possible. Does it makes sense to you?

About 2), that happens because I did not fully implemented all possible song combinations ( start, stop, start again, ..) taking into account android media player different states. But simply that you could at least load one song and start/stop it. I know it is not best coding practice sorry for that. I'll definitely fix that soon enough.

Owner

Garoe commented Apr 12, 2013

About 1) that is intentional, since loading times on phones is significantly higher than on PCs I think that it is better not to wait for the song to be loaded and start the game as soon as possible. Does it makes sense to you?

About 2), that happens because I did not fully implemented all possible song combinations ( start, stop, start again, ..) taking into account android media player different states. But simply that you could at least load one song and start/stop it. I know it is not best coding practice sorry for that. I'll definitely fix that soon enough.

@ashes999

This comment has been minimized.

Show comment
Hide comment
@ashes999

ashes999 Apr 12, 2013

Contributor

@neochuky it would be really useful to be able to tell when a sound sample ends. That would enable a lot of other behaviours (like not starting when it's playing) from a wrapper class. Would that be easier than what you have?

Don't worry about coding practices. Following the 80/20 rule, you did 20% of the work and got 80% of what people need. I'm just looking at what I, specifically, need, which may be different from what other people need.

Contributor

ashes999 commented Apr 12, 2013

@neochuky it would be really useful to be able to tell when a sound sample ends. That would enable a lot of other behaviours (like not starting when it's playing) from a wrapper class. Would that be easier than what you have?

Don't worry about coding practices. Following the 80/20 rule, you did 20% of the work and got 80% of what people need. I'm just looking at what I, specifically, need, which may be different from what other people need.

@Garoe

This comment has been minimized.

Show comment
Hide comment
@Garoe

Garoe Apr 13, 2013

Owner

Is this possible to do on the original Gosu gem? If so how?
By the way, why is the issue closed?

Owner

Garoe commented Apr 13, 2013

Is this possible to do on the original Gosu gem? If so how?
By the way, why is the issue closed?

@ashes999

This comment has been minimized.

Show comment
Hide comment
@ashes999

ashes999 Apr 13, 2013

Contributor

I'm not sure. I thought I was using the original Gosu for audio, but I remembered that Gosu uses OpenAL, which doesn't work on Windows XP. I was actually testing it against a different library (probably fmod), which is why the whole issue is invalid and unimportant.

So I closed it. Please feel free to disregard :)

I still thing the second point might be a bug, or something to improve in future releases, but it's not a problem for me right now, anyway.

Contributor

ashes999 commented Apr 13, 2013

I'm not sure. I thought I was using the original Gosu for audio, but I remembered that Gosu uses OpenAL, which doesn't work on Windows XP. I was actually testing it against a different library (probably fmod), which is why the whole issue is invalid and unimportant.

So I closed it. Please feel free to disregard :)

I still thing the second point might be a bug, or something to improve in future releases, but it's not a problem for me right now, anyway.

@ashes999

This comment has been minimized.

Show comment
Hide comment
@ashes999

ashes999 Apr 14, 2013

Contributor

So I finally got OpenAL (and by extension, Gosu) audio to work, after months of trying this and that. Now I've verified that the second issue (audio plays repeatedly) is an issue, so I'm reopening this.

I'm not in a hurry to get this closed, and I am pushing my own architectural direction (keep gosu_android as similar to gosu as possible so people can easily use both), but I would like some help fixing this. I looked through the code (Ruby side) and didn't find a solution.

Contributor

ashes999 commented Apr 14, 2013

So I finally got OpenAL (and by extension, Gosu) audio to work, after months of trying this and that. Now I've verified that the second issue (audio plays repeatedly) is an issue, so I'm reopening this.

I'm not in a hurry to get this closed, and I am pushing my own architectural direction (keep gosu_android as similar to gosu as possible so people can easily use both), but I would like some help fixing this. I looked through the code (Ruby side) and didn't find a solution.

@ashes999 ashes999 reopened this Apr 14, 2013

@Garoe

This comment has been minimized.

Show comment
Hide comment
@Garoe

Garoe Apr 15, 2013

Owner

I tried to solved this today, but I am having problems with android listeners that are never called.

For future reference commits are f382adf and 5161ce4.

I'll keep thinking about this, maybe I'll figure something out.

Owner

Garoe commented Apr 15, 2013

I tried to solved this today, but I am having problems with android listeners that are never called.

For future reference commits are f382adf and 5161ce4.

I'll keep thinking about this, maybe I'll figure something out.

@ashes999

This comment has been minimized.

Show comment
Hide comment
@ashes999

ashes999 May 22, 2014

Contributor

Ping :)

Contributor

ashes999 commented May 22, 2014

Ping :)

@Garoe

This comment has been minimized.

Show comment
Hide comment
@Garoe

Garoe May 28, 2014

Owner

I am so sorry, but I have got engaged in other projects so I am not going to develop gosu-android in the foreseeable future.
If you feel up to it I'd gladly accept pull requests, the solution to this could be to set up a listener to OnCompletion and have a pool of songs to be played next. Then whenever a song finishes, start playing the next one in the pool. In any case I think this will be easier to do in Java, so a first step would be to rewrite the audio file to Java.

Owner

Garoe commented May 28, 2014

I am so sorry, but I have got engaged in other projects so I am not going to develop gosu-android in the foreseeable future.
If you feel up to it I'd gladly accept pull requests, the solution to this could be to set up a listener to OnCompletion and have a pool of songs to be played next. Then whenever a song finishes, start playing the next one in the pool. In any case I think this will be easier to do in Java, so a first step would be to rewrite the audio file to Java.

@ashes999 ashes999 referenced this issue Jul 8, 2015

Closed

Proof of Concept: Android Target #3

34 of 37 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment