Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

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   

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?

 



#2 slicer4ever   GDNet+   

6660
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   

1410
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   

1410
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.