• 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.

Windows Store streamed audio files in different location for ZIP build

angelwire

Member
I'm building a game for Windows and I'm using "Compressed - Streamed" audio files. They're working great, but when I build the project, all the audio files are saved in the same folder as the .exe file. It's really ugly to have so many .ogg files and it makes it hard to find the executable. Is there any way to change this? Is it a bug?
1611328986445.png
 

renex

Member
if you really need your build folder to be clean, you'll have to abandon the builtin audio resources and put all of them as included files on a sub folder, and manage the whole loading process yourself.

it's very boring to set up and ultimately a lot more work than just putting up with the messy build folder, unfortunately.
 

kburkhart84

Firehammer Games
IMO, I think you are dealing with two kinds of people.

1. People who are not all that computer literate...the truth is that those people are much better off with an installer instead of a zip file. And if you do an installer, it typically creates a shortcut in one or more places, so the OGGs being in the same folder is no longer relevant(and this user is not likely to be going there anyway.

2. People who are more computer literate...if these people are going to get only a zip file(that they have to extract anyway), then they are also likely literate enough to not have an issue finding the executable, especially if you let them know the name of the file.

As the above person mentioned, considering the above thoughts I have on the subject, it is my belief as well that you are better off either opting for the installer, or not worrying about the executable being found, depending on which user you are targeting. It likely isn't going to be worth messing with putting the audio in the included files as that will take extra time that likely isn't worth the outcome.

All that said...I did see at some point a program that modifies the executable to point to a different folder for the music, and then moves the music into that folder. I'm not sure of any more details and don't remember where I found it, but it does exist IIRC.
 

angelwire

Member
Thanks for the replies. I was hoping there would be something simple I could do to clean up the build folder but I guess there isn't. I may see about filing a feature request.

I can't select a sound group after setting a sound to streamed, and changing the sounds to included files will probably be more trouble than it's worth. I'll probably end up going with an installer.
 

FoxyOfJungle

Kazan Games
You don't need to do that, you just have to include the sounds in audiogroups, in which case, you will create two audio groups in Tools > Audio Groups. One for music and one for sound effects. Therefore, you must obey this configuration:



For Music:


(Note that this means that the sounds will be loaded into the RAM of the device (Disk -> RAM), I recommend this, in all the cases I used, there were no problems).
Note that the audio file is associated with the audiogroup.


For SFX:




This is not enough, you must load audio groups when entering the game. For this:


Create Event:

GML:
audio_group_load(AG_Music);
audio_group_load(AG_SFX);
audio_groups_loaded = false;

Async Save/Load:

GML:
if (audio_group_is_loaded(AG_Music) && audio_group_is_loaded(AG_SFX))
{
    audio_groups_loaded = true;
}
Then, you will use the audio_groups_loaded variable to find out if it loaded.

Use audio_group_load_progress(AG_Music) to get the loading progress, it returns from 1 to 100.

All of this will be summarized in two files:
audiogroup1.dat and
audiogroup2.dat
 
Last edited:

angelwire

Member
I have a lot of sound files that are longer than standard game sound effects, so I don't want them to all be loaded into memory when the game starts. I could use sound groups and load them in as needed, but streamed audio is working great for me now (other than the issue with the folder) so I'll stick with it. Thanks though.
 

FoxyOfJungle

Kazan Games
In that case, you can look at one of these options:

From the manual:

his section is for setting the sound attributes. These are the attributes that will be set when you export your game and will affect how the sound id played back at run-time. For sound effects (WAV format) you will want them to be uncompressed so that they play quickly and don't require decoding, however for OGG and MP3 you'd generally want one of the other three options available.

Compressed audio will force all your sound files (irrespective of whether they are *.wav or *.mp3 or *.ogg) to be compressed down to Ogg Vorbis *.ogg format files for all platforms. These sounds are smaller on disc, but will have a slight CPU overhead due to the need to be uncompressed and loaded into memory before being played, so you should keep that in mind if you wish to use compression in an already CPU intensive game.


You can mitigate this CPU overhead somewhat by choosing to uncompress on load, which will place all the sounds into the device memory for faster playback, at the expense of increased memory use.

If you have chosen compressed audio, you can then also choose to have your sound streamed from disk too. A streamed sound will be one that is uncompressed and played in real time, streamed from the disc rather than loaded into memory. Streaming is ideal for music as it reduces the one-off overhead of uncompressing the whole file, which may cause a pause in the game, but is not recommended for simple sound effects where the hit on the CPU is much less.

It is important to note that when targeting the HTML5 platform. streamed audio will not play on iOS when the play request does not directly originate from a user interaction (i.e: a touch event, etc.). However, since GameMaker Studio 2 queues up click events and only handles them on the next frame, it is impossible to play streamed audio without the browser blocking it. To get around this, any HTML5 game run on an iOS browser will treat all streamed audio as unstreamed in the engine, with the exception of streamed audio not being preloaded.

What this means is that if your game is running on an iOS browser, and - for example - you have 10 music tracks that are all set as streamed mp3 files. All 10 will be initialised like unstreamed audio would, but they won't be decoded immediately before the game loads, unlike normal streamed audio which would get preloaded/decoded immediately during the load screen phase.

While this bypasses the iOS issue and prevents any huge increase in initial load times, it does mean that it may result in a state where your game has loaded, but certain streamed sounds may still be downloading or decoding. To deal with this you can use the GML function audio_sound_is_playable(), which checks to see if a given sound can actually be played. On HTML5 this will return false if the sound is not fully loaded or decoded yet, and true if it is and can be played (on all other platforms it will always return true).
 

kburkhart84

Firehammer Games
Thank you @TsukaYuriko I've already submitted a feature request but that looks like it'll do the trick.
That's the thing I mentioned earlier, I knew it existed but I couldn't remember where I had seen it.

That said, you may be better off with an installer instead of messing with that. It's your choice though. I'd wager for a final game build you most often are better with a proper installer. I think most people expect such of their games, along with the shortcuts being created.
 
Top