Access violation issue...I'm stumped.

As I continue my Unreal audio odyssey, I’m hitting an “access violation reading location” error when I use my custom soundcue in game play mode. It works fine when played within the Sound Cue Editor. I can’t see what could be causing the issue. I wonder if any of you guys might be able to spot the problem? I’ve attached my source, simply drop them into a project sound folder (change the project API name, and the project headers), create a new Sound Cue and add a SoundNodeTest object. When it crashes (on pressing Play), Visual Studio takes me to the line where I call Parse().


	if(SoundWaveIsInitialized)
	{
		if(SoundWave)
		{
			SoundWave->Parse(AudioDevice, NodeWaveInstanceHash, ActiveSound, ParseParams, WaveInstances);
		}
	}

It looks somehow like the address of SoundWave somehow changes when the game is started, it’s still a valid pointer, but the address seem to have changed. I don’t see how that could happen, nor am I confident enough in my debugging skills to confirm this! Any advice or suggestions are most welcome.

Hey rorywalsh,

If you are getting a crash when Playing, please create a bug report on the AnswerHub (https://answers.unrealengine.com/index.html) and provide as much information about your setup and what you’re doing when the crash occurs as possible. Also include the callstack and log files from the crash for additional information. If you respond here with the answerhub link we can assign the issue to our support staff for investigation

Cheers

Thanks . Here’s the link to the question on the AnswerHub. I get the awful feeling this is just something of my doing rather than a bug…

I suspect one of the parameters is nullptr. See if you can add a breakpoint on that line and debug the game in Visual Studio; you can then see the values of those parameters.

That was my first plan of action. All parameters passed to Parse() seem perfectly fine. No nullptr’s to be found.

I think it is because the SoundWave object is garbage collected by the engine.

You should make your SoundWave variable a UPROPERTY



    UPROPERTY()
    MyCustomSoundWave* SoundWave


or if you want to do it the hard way, you can add it to root when you create the object and then manually serialize the object, and remove it from root when you delete it. I would choose the UPROPERTY keyword, it’s easier.

This issue has been resolved :wink: