Jump to content

[WIP]Map view engine audio fix


Guest

Recommended Posts

I'd like to attempt to fix the audio problems I have in the map view. I really don't mind the problems with the music. It's the engine audio's problem of fading in and out that I want to tackle. It seems to me that the problem is associated with AudioListener :

http://docs.unity3d.com/ScriptReference/AudioListener.html

It seems like there is an error that occurs when switching to the map view. You can see this error manifest itself sometimes when switching from the map view back to the flight scene. The camera will be zoomed way out, forcing the player to scroll back in to see the rocket. So, I think it is this error that is screwing with the AudioListener in map view.

My idea for fixing this is simple. I'd like to make a plugin that first checks if the game is in the map view and if it is disable any 3-d effects associated with the position of the AudioListener. I think that maybe this ScriptReference could be used to do this :

http://docs.unity3d.com/ScriptReference/AudioSource-bypassListenerEffects.html

I have Microsoft Visual Studio Express 2013 for Desktop installed on my pc. I have started to learn C#, but, at this point, I am a super noob that has no clue where to even begin. It seems to me that the script needed for this plugin would be fairly simple, but I could use some help.

Any thoughts, help, or suggestions would be deeply appreciated.

Link to comment
Share on other sites

I have been thinking about how to go about testing out some possible solutions to the audio problem in the orbit scene. I have noticed some interesting things in the unity documentation, and I've got some questions. First, look at this page in the unity manual, in particular the part about each scene can have only one Audio Listener :

http://docs.unity3d.com/Manual/class-AudioListener.html

My memory is far from perfect, but it seems like I recall reading somewhere that the flight scene never really goes away. The map view(or orbit scene) simply displays on top of it. Is this true? And if so, is there more than one Audio Listener active in the map view? Any ideas on how to test this?

I guess what I really need, is some help with how to code a test. Maybe as a start, code that would maybe assign a hotkey to turn the unity 3-d audio effects on and off. Like i pointed out in my previous post, I think it may be possible to do this with AudioSource.bypassListenerEffects. I just don't have the experience with C# to create the necessary code. I will continue to work on it in my spare time, but if somebody has knowledge in this area, it would speed the process up considerably.

And last thing for now, I would be so thankful if someone would chime in and let me know if I'm even barking up the right tree or just chasing my tail.

Link to comment
Share on other sites

It seems likely that the map view is simply an overlay given the fact that there's really no delay in the simulation between the map view and the flight scene. The navball, while tucked away usually, is still accessible through the map view which means you could probably control your ship entirely from the map if that made you happy. I have experienced a few things when switching between the map and the regular flight scene such as the camera zooming in really fast between views. This is usually not so noticeable, but when the system you're running on is having problems keeping up with the simulation, it can be detected. This leads me to believe that the sounds are not actually being muted while the map is up, but rather the camera is being set far away from the action, which causes the game to lower the intensity of the sounds based on your vicinity to them. As you've experienced, this is not always very accurate. I also have no proof that this is how they handle it. It's all just observation and logical thinking here.

As for barking and tail-chasing... I won't say that this isn't a case of chasing your tail or barking up the wrong tree... all this means is that we're both barking up the wrong tree if indeed we are barking in a coherent fashion at all.

A thought: I remember having a problem with sound in the map view when using the atmospheric sound enhancement mod (a very long time ago) in where all sounds would be severely muted when the map was up except for the odd occasional sonic boom sound that would pierce through the veil at full volume. I suspect it has to do with whether or not the plugin doing the call for the sound effect is checking against an available volume setting within the game, or whether or not the sound call is using a standard unity/KSP method or if they're defining a new system-based method for playing it.

Stuff to chew on, I suppose.

Edited by Gaalidas
Link to comment
Share on other sites

Ok, thanks for the feedback Gaalidas. I'm going to keep trying to solve this thing. It would make things a bit easier for me if the engine sounds were working in the map view just like they do in the flight scene, mainly so I would know immediately that a stage has run out of fuel while watching the ap numbers. It doesn't seem to bother most folks, but it's like nails on a chalkboard for me. And I'd like to be able to obtain the same precision and efficiency with the stock game as I do with a game modded with KER or MJ.

I had been going through the Unity documentation when I basically stumbled into these audio script references and it give me new hope for a fix. I'm going to try to set up a new KSP install later with just a few basic parts for quicker load times to try and start testing some very simple plugins. I doubt I get anywhere very fast though, mainly because I just don't know what I'm doing. Hopefully one of the modders that have dealt with unity audio before will see this soon and give some advice on whether this can work or not. Or maybe even pick up the ball and roll with it. I may pm pizzaoverhead later on after I've given it a good try for myself too see if he has any advice.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...