Audio files problem

Find quick help here to get you started with Hollywood
Post Reply
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Audio files problem

Post by amyren »

I have this LCD game that uses 8 different wav files for sound effects.
I have compiled it for both amiga, windows and android and it was working normally on all platforms.

Now I have got the permission to use some wav files from an italian website, that are more accurate to the original sounds. So I replaced my sounds with these.
And they all play well on all platforms I tested, execpt on android.

On android some of the sounds almost never play, while others can be heared part of the time. Also on android I did get no audio channel available error after playing a while. I did try to set the different sounds to play in dedicated sound channels, and that fixed the audio channel error, but the sounds still dont play as they should.
I did make a few sounds using the bfxr (windows tool) to replace the most troublesome italian sound files, and when using my own wav files everything plays fine in android.

I did put the files here. https://drive.google.com/open?id=1dnN0z ... jcG3kj3iva
The ones starting with it_xxx are the ones causing trouble, and the others beginning with new_xxx are working fine.
The most used sound is it_Barrel.wav that will sound aprox. one time per second or faster, that sound does work most of the time, but not allways. The it_Step.wav only sounds sometimes, and the it_Bonus.wav is hardly heard at all.

Some of the audio files are very short. Could it be the android audio system is to slow to initialize, so that Hollywood have finished playing them before they can be heard? But that does not explain why I got the audio channel error.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Audio files problem

Post by airsoftsoftwair »

Could be a problem in Hollywood's Android backend because those sounds are really extremely short. In my defense, WinAmp doesn't play them either here because they are apparently too short... Nevertheless, I'll see if it can be fixed.

Concerning the audio channel problem, Hollywood uses a fixed number of audio channels, namely 8. You can increase this number using the NUMCHANNELS argument. However, it's not really recommended to do that because badly written code could still run out of audio channels if you increase them. Instead, you should adapt your code and specify a playback channel for each sound you play. You have to use the "Channel" tag of commands like PlaySample() for this. If you specify a specific channel, you'll never run the risk of getting a channel allocation error. This entry from the Hollywood history for version 6.0 might give you some more hints:

Code: Select all

- New: Introducing the new sound channel API: These functions allow you to deal with sound channels directly
which solves the problem of running out of channels; previously, it wasn't really possible to detect
whether there were free channels or not because a single sample or music could be playing on multiple
channels, thus making IsSamplePlaying() and IsMusicPlaying() not precise enough; using the new APIs
it is now possible to check the individual channels directly; the following commands have been added:
GetChannels(), IsChannelPlaying(), HaveFreeChannel(), SetChannelVolume() and StopChannel(); additionally,
PlaySample(), PlayMusic(), and PlayVideo() support an optional "Channel" tag now which allows you to
specify the channel that should be used for playback
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Audio files problem

Post by airsoftsoftwair »

Code: Select all

- Fix [Android]: Extremely short samples weren't played correctly
Post Reply