Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


How do I prevent clicking at the end of each sound play in OpenAL?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 CdrTomalak   Members   -  Reputation: 272

Like
0Likes
Like

Posted 08 March 2014 - 01:32 PM

I have put together a basic sound handler class for use in my game. It uses OpenAL.

It's a simple method at the moment to play sounds - here's an extract from a switch block:

case "EATEN_PILL":
    wavPath = "D:\\Programming\\SFX\\EATEN_PILL\\Hit_43.wav";
    ALfilename = Path.Combine(Path.Combine("Data", "Audio"), wavPath);
    sound_data = LoadWave(File.Open(ALfilename, FileMode.Open), out channels, out bits_per_sample, out sample_rate);
    buffer_EATEN_PILL = AL.GenBuffer();
    AL.BufferData(buffer_EATEN_PILL, GetSoundFormat(channels, bits_per_sample), sound_data, sound_data.Length, sample_rate);
    AL.Source(source, ALSourcei.Buffer, buffer_EATEN_PILL);
    AL.SourcePlay(source);
    break;

Problems:

1. An annoying click at the end of each sound.

2. Eventually sound stops playing completely. This is after perhaps playing 100 sounds.

 

Has anyone hit this problem before?

 



Sponsor:

#2 slicer4ever   Crossbones+   -  Reputation: 3986

Like
0Likes
Like

Posted 08 March 2014 - 01:42 PM

first of all, it's likely stopping to play sound because you run out of buffers, don't load and generate buffers each time a pill is eaten.

 

load it once, and store it, then re-use it when the pill is eaten.

 

i woudn't be surprised if after fixing this issue, the clicking noise goes away as well, but i don't make that guarantee.


Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#3 tanzanite7   Members   -  Reputation: 1378

Like
0Likes
Like

Posted 11 March 2014 - 08:27 AM

1. An annoying click at the end of each sound.

Are you sure your wav is not just badly cut? The wave form should end on a neutral level.

Edited by tanzanite7, 11 March 2014 - 08:30 AM.


#4 tanzanite7   Members   -  Reputation: 1378

Like
0Likes
Like

Posted 11 March 2014 - 08:29 AM

(accidental double post - apparently can not be deleted)


Edited by tanzanite7, 11 March 2014 - 08:32 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS