audio_channel_num

Set the number of available audio channels.

Syntax:

audio_channel_num(num);


Argument Description
num Number of available audio channels (default is 128).


Returns: N/A


Description

With this function you can set how many audio channels are available for playing audio in GameMaker: Studio. What this basically means is that you give the number of simultaneous sounds that can be played at any one time, and if the number exceeds the amount, those sounds with a lower priority are stopped to free up a channel for the sounds with a higher priority. You can use this function to optimise your game for devices as the lower the number of channels for audio the better the performance, but bear in mind that this may also cause noticeable cut off of certain sounds if many are played at once.


Example:

switch (os_browser)
   {
   case browser_not_a_browser:
      switch (os_type)
         {
         case os_windows:
         case os_macos:
            audio_channel_num(200);
            break;
         default:
            audio_channel_num(64);
            break;
         }
      break;
   default:
      audio_channel_num(16);
      break;
   }

The above code checks the platform that the game is running on and changes the number of available sound channels to increase performance.


Back: Sound
Next: audio_debug
© Copyright YoYo Games Ltd. 2018 All Rights Reserved