Audio Node has no method play() (12 posts)

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

    Hello,

    I’m trying to add audio to my game, but it claims that AudioNode has no method play(). Here is the relevant code:

    import com.jme3.audio.*;
    
    background_music = new AudioNode(RenderData.getAssetManager(), "Sound/schumann.ogg",true);
    RenderData.getRootNode().attachChild(background_music);
            background_music.setDirectional(false);
            background_music.setPositional(false);
            background_music.setLooping(true);
            background_music.play();
  • Profile picture of lubobul lubobul said 7 months, 3 weeks ago:

    Hi there!

    I just wanted to ask about the same problem when i saw this post. Today i was playing around with the AudioNode class. At a point when i wanted to use play() and playInstance() methods, it appeared that these methods don’t exist. No matter where I’ve looked for solution to this problem it turned out that nobody had had any problems like these. The IDE just kept telling me: “No such methods in class AudioNode”.

    I hope you guys know something about the problem..

    Thanks in advance!

  • Profile picture of xieu90 xieu9012p said 7 months, 3 weeks ago:

    I havent checked it yet
    but in my code I just saw audioRenderer.playSource(an AudioNode);
    I dont know where I found my code, try to look at wiki/document or in testaudio
    I think my code was born from both them

    here is a small example
    AudioNode abc= new AudioNode(assetManager,”/pathofyourfile/audio.ogg”);
    audioRenderer.playSource(abc);

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

    It seems that xieu90 is right; you have to use the AudioRenderer.playSource() to play a sound. Although it does not appear in the online docs, after checking my local docs, they include an AudioRenderer class and no play() method on AudioNode.

    Apparently, Application creates a default AudioRenderer for you, called audioRenderer.

    Thanks everyone.

  • Profile picture of lubobul lubobul said 7 months, 3 weeks ago:

    Then if it’s like that, why Tutorial (11) teaches us to play sounds calling either play() or playInstace() methods. Moreover in the online documentation of AudioNode class there is such methods:

     void	play() 

    - Start playing the audio and

    void	playInstance() 

    - Start playing an instance of this audio. (thinking). If there is some changes with the way sounds are played in JME3, perhaps the online docs and tutorials should be fixed.

    Does anybody know anything ?

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

    As stated in a big fat hint, the wiki is for the svn/nightly version and the manual inside the SDK is for the version that you actually have installed. The nightly version does in fact play the audio via the node and not via the audioRenderer.

  • Profile picture of lubobul lubobul said 7 months, 3 weeks ago:

    Ah, ok thanks for the answers : ) Now i got it.

  • Profile picture of kamran kamran10p said 6 months, 2 weeks ago:

    thanks all. I had this problem as well now its solved.

    K Out!

  • Profile picture of disanto disanto said 1 month, 2 weeks ago:

    Thanks to all who posted. I just encountered this same problem and could not figure out for the life of me how something so straightforward was so messed up.

  • Profile picture of Tumaini Tumaini79p said 1 month, 2 weeks ago:

    Actually, jME3 beta now has the play() and playInstance() methods.
    The beta version is more stable than the nightly version, so you’d be better off using that if you don’t need the very latest updates.

  • Profile picture of pspeed pspeed821p said 1 month, 2 weeks ago:

    AudioNode has had play() for a very long time now. Almost a year now, I guess.

    How old of a version are you using?

  • Profile picture of pspeed pspeed821p said 1 month, 2 weeks ago:

    Looked it up… AudioNode got play and playInstance last April:

    http://code.google.com/p/jmonkeyengine/source/detail?r=7334&path=/trunk/engine/src/core/com/jme3/audio/AudioNode.java

    Just after alpha4, I guess. So yeah, almost a year.