no playback

Hi, I’m new here, trying to get my first test going, been following the examples here, and I have the code sorted with no errors, and it looks like it should be working, but the audio doesn’t play.

The fmod debug shows successful init and bank load:

my code so far, I expect the drum_test_01 event to start playing automatically, and the drumIntensity parameter to be modified on the fly based on the distance float (it’s clamped to 0 - 1 in another script).

I can play back the sound in the inspector of the event asset, and the slider controls the parameter, but there is no playback at runtime or in a build.
I followed the checklist from another thread too, the listener script is on the camera, an event emitter is in the scene…

Any help would be appreciated :slight_smile:

using UnityEngine;
using System.Collections;
using FMOD.Studio;

public class fmodTest : MonoBehaviour {

    FMOD.Studio.EventInstance drums;
    FMOD.Studio.ParameterInstance paramDrum;
    public distanceListener distanceMeter;

    void Start () {

        drums = FMOD_StudioSystem.instance.GetEvent("event:/drum_test_01");
        drums.start();
        drums.getParameter("drumIntensity", out paramDrum);
        
	}
	
	void Update () {
        
        float distance = distanceMeter.cubeRange;
        paramDrum.setValue(distance);
	}

    void OnDisable()
    {
        drums.stop();
        drums.release();
    }
}

Hi nomand,

The code you have looks mostly correct, except you’re not checking the FMOD.RESULT return codes, they can help to track down these kinds of issues. The other possibility is that perhaps distanceMeter.cubeRange is providing parameter values different to what the event is expecting. If neither of those provide any useful clues, please send through your unity project and the FMOD Studio project to support@fmod.org and I can take a look.

Thanks for the heads up, how do I utilize FMOD.RESULT? I’m not experienced enough to understand code in the API.

cheers

I just realized my stupid mistake. I ignored the fact that the listener is not omnipotent (I thought you need code to define how it gets affected by positioning) so the problem was simply my camera/listener was just too far away.
Is there a way to make the listener hear without falloff into the distance? (or maybe with really large initial area that it can hear)?
in a normal workflow, would I have just one listener for all the sounds (for example a top down game) or would there be separate ones for positional effects, music and what not?
Please still let me know how to use the FMOD.RESULT :slight_smile:

Thanks!

You can delete the 3D panner on the master bus to make the sound play without any panning or attenuation. If you want the panning but without any distance attenuation then you can select the (Off).