How to convert USoundWave to USoundCue use C++?

I want to construct USoundCue with programming, because I have too many Sound Wave resource and I can’t stand to create Sound Cue in Editor one by one, so is there any way to construct USoundCue with USoundWave use C++?

No, because they’re completely different things.

You can just play a sound wave though…

ok, I see, thx very much!

But they share the same base class, last time I checked. And since that base class already has a ‘Play’ function you can even use a random mix of sound waves and sound cues.
Also I’m pretty sure you can just tell the importer to automatically generate a cue for each imported wave (similar to meshes and their materials). If that option isn’t there it should not be too difficult to implement.

Yeah, USoundBase has all functionality for playing etc. and the like, so you can just use that and use Cues / Waves as you like.

but SoundWave would play in whole scene, SoundCue can play in a limited spherical space, so they are different usage.

When you play either a SoundWave or SoundCue, it creates a UAudioComponent - that is the object that determines where it is in space. If you pass in some attenutation settings it’ll play exactly the same way as a cue or wave.

Could you give me an exact example of source?

Just look at UGameplayStatics::PlaySoundAtLocation or PlaySoundAttached. It may have been renamed to ‘Spawn’ instead of ‘Play’ in 4.12, you’ll have to check.

Sorry, you didn’t understand my question. And I had checked these functions before.