I set the UE API manual to the dark theme, and it still makes no sense to me
Csound wrapper/plugin for Unreal Engine
Do you have any intel on using a USoundWave class in BP?
absolutely no idea was trying to figure it out the other day, but only realised i should be upsing bp based projects yesterday hahahah
I might be on to something hereā¦create an AudioComponent
class, and then pass the USoundWave
to itā¦
Ooh keep me posted, where are you making the AudioComponent?
As a C++ class, but itās not working out as I had expectedā¦
I can create an AudioComponent
class for BP, but I canāt seem to assign it a Csound USoundWaveProcedural
object. Hmmm, there has to be a way. The AudioComponent class has a method for setting aUSoundWave, which my Csound class now is.
After going around in circles over this, I think it might be best to try to start a single instance of the synth, but instead of just playing it for a few second, play it indefinitely. We can then send score events to it. The only thing is I donāt know how to set an on event to run indefinitely. Right now itās being triggered from the projectile object. We just need to trigger it a different way, and donāt turn it off.
What if we actually connected it to the player spawn node if thats possible?
I would do this differently. Instead of spawning an instance of Csound each time the bullet firing event is triggered you could instead create a Blueprint callable C++ function inside your Csound component that calls Csound->ReadScore to call the instrument that makes the sound effect (if thatās what you are trying to do). USynthComponent is an Actor component so you could add it to any Blueprint Actor in the components section, then access it to trigger notes. Also USynthComponent inherits from USoundWave already. Once added as a component it can be routed or spatialized as any other audio source.
No Iām sorry never opened it!
But I can ask around
I think @virtualHC already cleared this up :thumbsup. I will try this a little. Itās taking a while to get my head around the BP system.
Do you have to call Start on this synth for it to sound once you send a score event? How are you triggering the OnGenerateAudio(float* OutAudio, int32 NumSamples)
method? In my remedial tests Iāve had to use Start, or else the generate audio method is not called?
Iām just up and also about to try virtualHcās way of it, will let yous know what happens!!
@rorywalsh have you had any luck getting BlueprintCallables to show up in the UE Blueprint editor? Iāve got this and its just NOT showing :((
EDIT: worked after restarting the UE editor, that is NOT ideal hahahhaa
So something along these lines you mean right?
Edit: Okay I moved AddCsoundWrapper
to be connected to Event BeginPlay
node in FirstPersonCharacter
, that assigns it to a variable called CsoundInstance
then calls Start
, then when the projectile gets spawned, itās calling the playNote()
function, but when I try and copy from Spout to OutAudio
in OnGenerateAudio()
it crashes, god its TANGIBLE, any ideas? Edit edit: spout is a nullptr, even after calling GetSpout()ā¦
Yes, USynthComponents need their Start method to be called so OnGenerateAudio starts looping. This is an example of my Event Begin Play. The Set Mic Positions is a BP function for a virtual speaker ambisonic decode, but the rest are calls to C++ functions inside my Csound component. Note On then can be called from any other BP or within the same via event calls (see example in screenshot).
Is there any chance you could send on your SynthComponent class source code? Feel like Iām missing something really obvious here
Okay I got this working, always on csd setting channels, only thing is once the note event finishes I get horrible noise from the SPOUT buffer, is there a way to like, clear the SPOUT?