Audio channel problem adjusting volume across rooms

Started by xBRANEx, Sat 01/10/2016 14:43:05

Previous topic - Next topic

xBRANEx

Hi everyone. I'm losing my mind over this. I've done this before and I have no idea what's the problem.

I made a global variable muzika of an audio channel. I start the music in the first room:

Code: ags
muzika = aThe_starry_sky_above_me.Play();
 muzika.Volume = 100;


Later in other rooms when I try muzika.volume=20 or anything like that it doesn't work, but if I do muzika.Stop() it works. I think I lost like an hour beating my head against the wall.


Jack

I had similar issues with the volume property when I was making the awards client. Eventually I used another solution. There may be a bug here.

Crimson Wizard

#2
First of all, silly question, but have you tried setting different volume at the start to see if different volume works at all?
Could you also tell which type (format) of music is that?


Regarding bugs,
Spoiler
I've noted couple of potential bugs with audio channels in the past (although never got to working on them). However, as far as I remember, troubles arise when you keep an audio channel for the short and/or non-looping playback. If the music is looping, and not interrupted by overriding clip on same channel, then it might be something else...

There is a steady (albeit kinda ugly) workaround when there is only one instance of clip played at a time:
Code: ags

AudioChannel *GetChannelForPlayingClip(AudioClip *clip)
{
  int i = 0;
  while (i < System.AudioChannelCount)
  {
    if (System.AudioChannels[i].PlayingClip == clip)
      return System.AudioChannels[i];
    i++;
  }
  return null;
}

This function returns the first channel that plays given clip. It can be used when you are wondering if your AudioChannel pointer variable actually references the correct channel.
[close]
Although from your description it is hard to tell whether all that is relevant...

xBRANEx

Just tried it. You are right. It does not work. I'm using WAV. Will try with mp3


xBRANEx



SMF spam blocked by CleanTalk