• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Audio Questions

  • Thread starter atxgamedesigner
  • Start date
A

atxgamedesigner

Guest
I have a handful of questions regarding working with audio files:

A) Is it be possible to allow the user to dynamically load audio files at runtime?
So instead of having a sound preloaded before game build, you allow the user to search their files for a specific audio file, then use it in your game?

B) Is it possible to control which channel the audio comes out of.
Like if a sound is setup as a "stereo" track - can you use GML to mix how much comes out of the left speaker vs how much comes out of the right speaker?

C) Is it possible to "timestamp" an audio file during playback?
Once stopped, the timestamp would be recorded, then when played again, it would pick back up where it left off.
I've tried capturing the position:
track_pos = audio_sound_get_track_position(snd_Main);
Then later setting the track position before playing:
audio_sound_set_track_position(snd_Main,track_pos);
audio_play_sound(snd_Main,1,true);

However this did not achieve the results I was looking for.
 

TsukaYuriko

☄️
Forum Staff
Moderator
A) Yes, audio buffers and audio streams can be used for this. I suggest reading up on them in the manual.

B) Audio emitters and listeners. The manual is equally informative about them.

C) audio_sound_get_track_position only works with audio instances, not audio resources. You guessed it - the manual tells you that.
Regarding resuming, you have to first play the audio and then set its position. Manual yadda yadda.
 
Top