Ambient sound problems.

Started by RetroJay, Tue 13/11/2012 03:46:03

Previous topic - Next topic

RetroJay

Hi Good Peeps.

I have started the second part of my game, The Lost Prince Of Lorden - Part 2, using AGS 3.2.1. (I did it, I finaly went with 3).

I need your help, though, already.
When I play my game the Sound FX, Music and Ambient sounds, all play as they should.
However... If I save a game and then load that saved game the Sound FX and Music all play as they did before, but the Ambient Sound stops playing after a few seconds.
Why is this?

Please help me, as I had no trouble with this before with 2.72.

I have searched for this problem, but have found nothing that relates to it.

Thanks.
Jay.

RetroJay

Hi All.

NickyNyce had the same problem, with Ambient sound as I do, when he made 'The Visitor 2'.
I have been in contact with him to ask him about this and he, also, couldn't fix it.

With 'The Visitor 2' If you turned off the stereo, the Ambient sound of the ship would play (beebs and blonks).
If you then saved your game and loaded your game, at a later point, you would return to where you were but after a few seconds the Ambient sound stops.

I ask again... why?

The only thing that NickyNyce could suggest was this code:
Code: AGS
function room_RepExec(){
  while (Game.IsAudioPlaying(eAudioTypeAmbientSound)==false){
    aForest.Play();
  }
}


Is this correct. It feels... Clunky, for want of a better word.

Please help.

Yours.
Jay.

Volcan

I'm working on a game too.

With the last code, the sound plays once after the game is loaded.

Code: AGS

function room_RepExec(){
 while (Game.IsAudioPlaying(eAudioTypeAmbientSound)==false){
  aQuetaine2.Play(eAudioPriorityNormal, eRepeat);
 }
}


Even with my code, the sound plays once after the game is loaded.

Volcan

Forget IsAudioPlaying or anything else.

Unstead create a new view, either make it invisible or hide it. Set a frame an ambiant sound. Set the delay long enough the sound could play without playing again when the sound is not finised playing yet.

It works for me, even after the game is loaded.

I experimenting slowdown using this technique. Maybe because my computer is not fast enough.

RetroJay

Hi Volcan.

Thank you for your suggestion, but there has to be an easier way to solve this.

This really is an annoying problem.
For the life of me, I can't figure out why this happens.

Where on Earth is Khris or Monkey.
They could solve this in seconds, without mental damage. :-D

Many Thanks.
Jay.

RetroJay

OK.

So no one else has had this problem then, apart from Me, Nicky and Volcan?
The only way that works for me is to put this into every room that has the 'Forest' ambient sound.
Code: AGS

function room_RepExec(){
  while (Game.IsAudioPlaying(eAudioTypeAmbientSound)==false){
  aForest.Play();
  }
}


For other rooms that have a different ambient sound I put the same code into them but just change the sound to play.
This seems to work...But.

Is this the correct way to solve this problem?

Many Thanks.
Jay.

Khris

It's the correct way in theory, but you can use the global function instead of putting almost identical code in every room:

Code: ags
// GlobalScript.asc / repeatedly_execute

  if (player.Room >= 3 && player.Room <= 10) {            // forest rooms: 3-10
    if (!Game.IsAudioPlaying(eAudioTypeAmbientSound)) aForest.Play();
  }

RetroJay

Hi Khris.

I hope you are well?
Where the hell have you been, Yoda. ;)

Thanks for your help...again...again...and again...infinite.

I assume that this code reads like this:
If player is in room 3 to 10 then play Ambient Sound 'aForest'.

For other rooms, with different ambient sounds, I just add the same script underneath your script but just change it to:
Code: AGS

if (player.Room >= 11 && player.Room <= 22) {            // Swamp rooms: 11-22.    
  if (!Game.IsAudioPlaying(eAudioTypeAmbientSound)) aSwamp.Play();
}


Don't blame me. You wanted me to go to AGS 3. :-D

Many Thanks.
Jay.

SMF spam blocked by CleanTalk