#Audio Sliders

48 messages · Page 1 of 1 (latest)

ember spruce
#

This is how I'm trying to implement my audio sliders so far, It doesn't seem to change anything but I'm pretty sure i've connected them to the correct bus index. Where have i gone wrong? I looked up some solutions on the internet but i can't wrap my head around it 😦

copper fox
#

I think bus indexes arent 0123 theyre some random number so you have to get them by code
Create bus_index and bus_name variable for each audioserver and in ready function set each bus index by the bus name and finally instead of putting 0 1 2 you put the matching bus index

ember spruce
#

Hmmm I tried it and it still doesn't work

#

These are the error output when i changed the slider values while debugging

#

And this is my bus channels

last ingot
#

You definitely have the bus_name variable set properly on the nodes?

#

I believe it would be case sensitive, so it's worth checking

ember spruce
#

Omg I did not

#

TT

#

Okay it works now but my question is that i essentially have to have 1 script for 1 slider?

last ingot
last ingot
#

You can just use this script but change the bus_name variable for each slider

ember spruce
#

But the script has to extend HSlider?

#

Because I would prefer to put them in my settings_menu.gd instead of a seperate script that contains the audio code

last ingot
#

It only needs the value_changed signal, right?

ember spruce
#

Like in here

ember spruce
last ingot
#

Maybe because you weren't using linear_to_db?

ember spruce
#

hmmm Okay i'll try that again and hopefully it works

#

It is not safe to assume that my bus channels will have index 0, 1 and 2?

last ingot
#

I don't know where the other person got the idea that it wasn't from

#

The indexes start at 0

ember spruce
#

Okay i will try my prev method again if not i'll just make it a seperate script for now

#

thanks alot for the explaination!

last ingot
ember spruce
#

I did some print statements in my code and it showed 0, 1 and 2

#

so i was just wondering if there was actually a case where what the other person said was true

last ingot
#

It shouldn't ever be true

#

I did some testing to confirm

#

Buses are stored in an array, I would assume

#

If you try to add a bus at a position beyond the size of that array, it just gets added to the end instead

ember spruce
#

Okay understood

#

I tried this again in my settings_menu.gd

But it still doesn't work

#

And i can't really call this

    print(bus_index);
    value_changed.connect(_on_value_changed)
    value = db_to_linear(
        AudioServer.get_bus_volume_db(bus_index)
    )```
In my settings_menu.gd because apparently value_changed is not declared
last ingot
last ingot
last ingot
#

Since this script isn't being attached to arbitrary nodes, you can just connect the signals in the editor, and normally that would show up as a little green arrow symbol next to the functions

ember spruce
last ingot
#

Oh, huh, guess they didn't show up in the screenshot?

ember spruce
last ingot
ember spruce
#

Okay it did!

#

Now it should be save to just remove my other script then