Pages: 1
  Print  
Author Topic: Question about audio:none  (Read 8364 times)
Offline (Unknown gender) sorlok_reaves
Posted on: June 13, 2014, 07:20:20 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
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.
Logged
Offline (Male) Josh @ Dreamland
Reply #1 Posted on: June 14, 2014, 07:45:30 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Goombert
Reply #2 Posted on: June 14, 2014, 12:01:12 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
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.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Josh @ Dreamland
Reply #3 Posted on: June 14, 2014, 01:07:18 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) Darkstar2
Reply #4 Posted on: June 14, 2014, 01:21:51 pm
Member
Joined: Jan 2014
Posts: 1238

View Profile Email
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.

Logged
Offline (Unknown gender) sorlok_reaves
Reply #5 Posted on: June 14, 2014, 07:21:31 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
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.
Logged
Offline (Male) Goombert
Reply #6 Posted on: June 14, 2014, 08:19:24 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
But then this becomes an every system or every extension thing too. I think it would be much better to automate this.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Josh @ Dreamland
Reply #7 Posted on: June 14, 2014, 09:10:56 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: 1
  Print