The method above isn’t a constructor. It’s a static method. The gameplay statics class has a lot of decent static calls do do things quickly in it but honestly, you could write a course on audio in unreal with topics such as meta sounds and audio queues. In fact, looking through the UGameplayStatics, you could argue the methods are factory methods for generating objects, varying the parameters to get what you need.
Documentation is lacking, yes, which is why there are so many courses.
As for C++, using for audio, I can’t even find any projects I have where I used C++ for music going back over 6 years. I know it can be done.
If you want the music to restart during levels, you either use the game mode or the level blueprint (ideal if you want different music for each level)
If you want the audio to play continuously between levels, you use the GameInstance (not really covered in this course - more advanced really, think of it like a class for holding global data like high score and settings to be used elsewhere)
So if you really want to learn how to do it, you’d get a USoundBase* for the sound file reference (Think UPROPERTY and assign your audio file) and use a UGameplayStatics::SpawnSound2D to play, and capture the return value so you can control it or change properties. Alternatively, in the class you wish to play sound, you create a UAudioComponent and you can use that to play the sound.
SpawnSound is good because you can let it play and it will finish and destroy. A UAudioComponent requires the component to persist while the audio plays. This can be added to any class using CreateDefaultSubobject and then attach to the root using SetupAttachment. This is covered in the course.
Playing audio in C++ is covered in the Crusty Pirates section of the course and music, while a little different, shares the same principles.
I wanted to take the time to write a more complete description but have been AFK for a most of the day and the phone is not good for this.
Still, playing Audio is little more involved but the absolute simplest form from that link I shared is:
in the .h
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class USoundBase* CollectionSound;
in the cpp method call
if (CollectionSound)
{
UGameplayStatics::SpawnSound2D(GetWorld(), CollectionSound);
}