Cannot Create AudioNode (2 posts)

  • Profile picture of sauer sauer said 7 months, 2 weeks ago:

    Hello,

    I’m trying to play some background music. Here is my code:

    AudioNode m = new AudioNode(RenderData.getAssetManager(), "assets/Sounds/schumann.ogg",false);
            RenderData.getRootNode().attachChild(m);
            m.setDirectional(false);
            m.setPositional(false);
            m.setLooping(true);
            System.out.println(m);
            RenderData.getAudioRenderer().playSource(m);

    When I go to create the AudioNode, I get a NullPointerException pointing to here, which is the constructor for AudioNode:

    public AudioNode(AssetManager manager, String name, boolean stream) {
            this();
            this.key = new AudioKey(name, stream);
            this.data = (AudioData) manager.loadAsset(key); //This line
        }

    What am I doing wrong?

    Thanks,
    Sauer

  • Profile picture of normen normen1291p said 7 months, 2 weeks ago:

    Your RenderData.getAssetManager() method returns null