I’m using the code below to forward to Audio to FMOD and it works as espected.
My issue is that I’m unable to reset fmod correctly and being it able to reproduce another video after the first. (The audio is muted the second time)
How do I reset everything?
For every video I repeat the init process, but it doesn’t seem to work.
What version of FMOD Integration are you using?
When you mention
reset are you shutting down the FMOD system (FMOD Engine | White Papers - Getting Started) or would it be possible to see the code you are using to reset your system?
Would you be able to expand on the init process you are using as well?
Player.audioOutputMode = VideoAudioOutputMode.APIOnly;
Player.prepareCompleted += onVideoPrepared;
fmod_mSampleRate = (int)(Player.GetAudioSampleRate(0) * Player.playbackSpeed);
fmod_mDriftThreshold = (uint)(fmod_mSampleRate * FMOD_DRIFT_MS) / 1000;
fmod_mTargetLatency = (uint)(fmod_mSampleRate * FMOD_LATENCY_MS) / 1000;
fmod_mAdjustedLatency = fmod_mTargetLatency;
fmod_mActualLatency = (int)fmod_mTargetLatency;
fmod_mExinfo.cbsize = Marshal.SizeOf(typeof(FMOD.CREATESOUNDEXINFO));
fmod_mExinfo.numchannels = Player.GetAudioChannelCount(0);
fmod_mExinfo.defaultfrequency = fmod_mSampleRate;
fmod_mExinfo.length = fmod_mTargetLatency * (uint)fmod_mExinfo.numchannels * sizeof(float);
fmod_mExinfo.format = FMOD.SOUND_FORMAT.PCMFLOAT;
FMODUnity.RuntimeManager.CoreSystem.createSound("", FMOD.MODE.LOOP_NORMAL | FMOD.MODE.OPENUSER, ref fmod_mExinfo, out fmod_mSound);
fmod_mProvider = Player.GetAudioSampleProvider(0);
fmod_mProvider.sampleFramesAvailable += fmod_sampleFramesAvailable;
fmod_mProvider.enableSampleFramesAvailableEvents = true;
fmod_mProvider.freeSampleFrameCountLowThreshold = fmod_mProvider.maxSampleFrameCount - fmod_mTargetLatency;
//on stop (loop reached)
Thank you for that.
When you are trying to play the second time are you seeing any FMOD errors in the console with the FMOD Integration logging level set to
It may be an issue with the sound or channel.
If you have followed our scripting example I would suggest adding some
FMOD.RESULT checks (FMOD Engine | Core API Reference - Common) which will also provide some more information where it is failing. Most FMOD functions will return an