Mihara / RasterPropMonitor

Plugin for Kerbal Space Program. This repository is out of date and is primarily of historic interest. See https://github.com/JonnyOThan/RasterPropMonitor
http://forum.kerbalspaceprogram.com/threads/57603
Other
116 stars 67 forks source link

Request. The ability to play a sounds in the "JSICallbackAnimator" module #552

Closed Alexustas closed 8 years ago

Alexustas commented 8 years ago

it will be just great if we get a sound options that we already have in the "JSIVariableAnimator" module

Alexustas commented 8 years ago

I decided to completely remake "TabloIndicator" prop using "JSICallbackAnimator" and "JSILabel", but because of the inability to play the sounds have to add another "JSIVariableAnimator" module, just for sound

MOARdV commented 8 years ago

Okay.

Alexustas commented 8 years ago

and one more addition)) Is it difficult to add a flashing indicator option?

MOARdV commented 8 years ago

Flashing is hard by itself. JSICallbackAnimator does not use Update or FixedUpdate. which is where I implement flashing. But CUSTOM_ can do that (use AND with variable and PERIOD_xHZ).

Alexustas commented 8 years ago

Yes, I thought about it. but in this case every time the indicator is triggered will also play the sound

MOARdV commented 8 years ago

That is true. Let me figure it out. Audio might also be tricky if it also needs updates.

Alexustas commented 8 years ago

as a variant, I can make two CUSTOM variables. in one variable I add " PERIOD" so that it will create a flashing, and the second only beeps (another callback module). but how much it can affect performance?

MOARdV commented 8 years ago

I made some very big changes for performance. Two variables will be a tiny amount more expensive.

Let me do some research first to see if I can find a way to make flashing work. There has to be some way without using Update (and if there is, maybe I can use it for regular JSIVariableAnimator, too).

Alexustas commented 8 years ago

OK. I have no doubt that you will find the solution )

MOARdV commented 8 years ago

I will find the solution. The question is what feature will I break by accident with the solution? )

MOARdV commented 8 years ago

Flashing was easy, but you can only have one flash rate for each JSICallbackAnimator (not one per variable set). Each variable set can choose to flash or not flash, so you can have some variable set that flash, and some that do not, in the same callback animator.

Now to work on audio.

MOARdV commented 8 years ago

DropBox

Same as JSIVariableAnimator, but:

flashRate is part of JSICallbackAnimator:

    MODULE
    {
        name = JSICallbackAnimator
        variableName = CUSTOM_ALCOR_BACKLIGHT_ON
        flashRate = 1.0

and each VARIABLESET has to have flash = true for it to flash, or else it ignores the flashRate:

        VARIABLESET
        {
            coloredObject = LabelObj
            passiveColor = 0,0,0,255
            activeColor = COLOR_MOARdV_BacklightColor
            scale = 0.5,1.1
                        flash = true

Audio works the same as JSIVariableAnimator, and I think I have it working correctly even when changing camera from IVA to Flight without using OnUpdate.

Alexustas commented 8 years ago

OU! it's amazing! thank you very much!!

MOARdV commented 8 years ago

You're welcome! I'm glad it's working (so far). It was not as hard as I thought.

Now I need to go change a lot of props from JSIVariableAnimator to JSICallbackAnimator. ))

Alexustas commented 8 years ago

I redid almost all of my props, and most of them two or three times.))) but it's worth it

Alexustas commented 8 years ago

I'm glad it's working (so far)

"flash" working, I've test it already.

but I can not yet verify the audio, because I do not get what kind of syntax I need to use

MOARdV commented 8 years ago

Example syntax (I tested it on a backlight of a prop I already had):

        VARIABLESET
        {
            coloredObject = LabelObj
            passiveColor = 0,0,0,255
            activeColor = COLOR_MOARdV_BacklightColor
            scale = 0.5,1.1
            alarmSound = ASET/ASET_Props/Sounds/beep-04
            alarmSoundVolume = 0.5
        }

Other options, same as JSIVariableAnimator - untested, but the code is the same as JSIVariableAnimator, so it should work:

I will update the wiki, probably tomorrow. since this evening will be busy for me.

EDIT: And yes, multiple sounds can be on the same prop using different VARIABLESET.

Alexustas commented 8 years ago

so it should work:

and it works fine! once again thank you very much!