Hi,
I’m trying to pass a float variable from a slider in my widget to a metasound and I’m having some trouble getting it to work, I don’t have very much experience within Unreal so please bear with me.
I have created my widget and added a slider to it, this widget is shown in the world as part of an actor so that it can be displayed like a wall with controls.
I would like the metasound to spawn attached to an actor also, so I have created a blueprint and added a static mesh to it so I can see a speaker. Inside the graph I have added an audio component and set this to be the meta sound I want to use and dynamically change.
But when I load into the game and move the slider nothing changes in the sound.
If someone could let me know what I’m doing wrong that would be a massive help.
Hopefully this will help but it may not be the only issue.
My take on the problem was that in your widget, you have the Target set to self in the Call Pitch Changed. I tried to recreate that and found it wouldn’t even compile that way. Here is what I did:
In the widget, I pulled off from Target on Call Pitch Change and selected Promote to variable. Then compile and save. This will have created a variable called Target that needs to be a reference to the actor with the Pitch Change event. If you don’t compile and save, the next step won’t work.
In the actor, I set the value of the Target in the Widget by after creating the widget, adding it to viewport, then pulling off the pin and doing a Set Target. The value to set the target to is “Get Reference to Self”. From there, my Pitch Change event called correctly and the value was passed from the widget to the Actor who could then call a Set for the MetaSoundSource.
I’m thinking there could be other problems. Are you certain the MS is actually running when you do the Set Float Parameter. If it’s not actually playing, even if you get the Pitch Change to fire, the value still won’t be set in the MS. I’m not familiar with using Add Audio Component as you are, I would usually do a Play 2D Sound or a Spawn and Play to start the MS.
I’d suggest putting a print string after your Set Float Parameter so you know for sure the widget and the actor are talking.
Thank you for the help, it is now setting correctly and that is reflected in the metasound while it’s playing.
Finally I can control my little synthesiser!