Pages: 1
Author Topic: Question about audio:none  (42,434 Views)
Offline (Unknown gender) sorlok_reaves

Contributor
Joined: Dec 2013
Posts: 260
View profile
Posted on: June 14, 2014, 12:20:20 AM
Good evening,

I've got a development-based question about the "None" audio backend. Would it make sense to add empty initializations of "sound_add", "sound_play", etc. to this backend? In other words, "sound_add()" would check for the file and return an id, sound_play would take that id and do nothing (no sound). Basically, this would allow developers to compile games that use audio functions without actually linking to an audio backend, which is useful for debugging, performance testing, and other things.

If this doesn't really belong in "None", what about a "Mute" backend that does what I described? I'm comfortable implementing such a system, but I thought I'd check first.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #1 Posted on: June 14, 2014, 12:45:30 PM
I think I'd go "Mute," between the two. The point of "None" was to remove all audio functions from the compilation process except the ones the system itself fundamentally depends on. It'd be better if we could find a way to remove all such dependencies, but that's usually a difficult problem.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #2 Posted on: June 14, 2014, 05:01:12 PM
I am in favor of adding a "Mute" audio system. For every system actually. Also would be nice to automate it somehow as Josh said. Perhaps we could make an "emulate" system option or something where JDI nulls all the function pointers.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #3 Posted on: June 14, 2014, 06:07:18 PM
If this is going to be an "every system" thing, we might just call it "Debug." It seems like a good idea to do this sort of logging globally.
Offline (Unknown gender) Darkstar2

Member
Joined: Jan 2014
Posts: 1,238
View profile
Reply #4 Posted on: June 14, 2014, 06:21:51 PM
What about doing it at the API level, you know where you select OpenAL, DirectSound and None, you could add a null option or whatever, which will work like the other APIs but not actually process sound and output it to your audio device, so you can easily switch back and forth APIs as you are testing your game.

Offline (Unknown gender) sorlok_reaves

Contributor
Joined: Dec 2013
Posts: 260
View profile
Reply #5 Posted on: June 15, 2014, 12:21:31 AM
Quote from: Darkstar2 on June 14, 2014, 06:21:51 PM
What about doing it at the API level, you know where you select OpenAL, DirectSound and None, you could add a null option or whatever, which will work like the other APIs but not actually process sound and output it to your audio device, so you can easily switch back and forth APIs as you are testing your game.

This makes the most sense to me. Since there seems to be some interest, I'll prepare a pull request so it can be properly evaluated.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #6 Posted on: June 15, 2014, 01:19:24 AM
But then this becomes an every system or every extension thing too. I think it would be much better to automate this.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #7 Posted on: June 15, 2014, 02:10:56 AM
Every system type, yes. It'd be hard to mock the collision and networking systems in a useful manner, and you'll find the same is true of most extensions. There are plenty of systems out there to automate mocking—Google maintains Mockito, as an example with which I've become very experienced. But this isn't what we need, here. Your instinct is correct, though; we can create a template function or macro whose only job is to take the place of a function that is supposed to load a file or stream and record that it was done.
Pages: 1