public AudioData loadAudio(String name){ return loadAudio(new AudioKey(name, false)); }
/** * Creates a new <code>AudioNode</code> with the given audio file. * * @param assetManager The asset manager to use to load the audio file * @param name The filename of the audio file * @param stream If true, the audio will be streamed gradually from disk, * otherwise, it will be buffered. * @param streamCache If stream is also true, then this specifies if * the stream cache is used. When enabled, the audio stream will * be read entirely but not decoded, allowing features such as * seeking, looping and determining duration. * * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String, com.jme3.audio.AudioData.DataType)} instead */ public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) { this.audioKey = new AudioKey(name, stream, streamCache); this.data = (AudioData) assetManager.loadAsset(audioKey); }
AudioKey key = new AudioKey(selected.getName(), true, true); try{ musicData = (AudioData) loader.load(new AssetInfo(null, key) {
public AudioData loadAudio(String name){ return loadAudio(new AudioKey(name, false)); }
public AudioData loadAudio(String name){ return loadAudio(new AudioKey(name, false)); }
/** * Creates a new <code>AudioNode</code> with the given audio file. * * @param assetManager The asset manager to use to load the audio file * @param name The filename of the audio file * @param stream If true, the audio will be streamed gradually from disk, * otherwise, it will be buffered. * @param streamCache If stream is also true, then this specifies if * the stream cache is used. When enabled, the audio stream will * be read entirely but not decoded, allowing features such as * seeking, looping and determining duration. */ public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) { this.audioKey = new AudioKey(name, stream, streamCache); this.data = (AudioData) assetManager.loadAsset(audioKey); }
/** * Creates a new <code>AudioNode</code> with the given audio file. * * @param audioRenderer The audio renderer to use for playing. Cannot be null. * @param assetManager The asset manager to use to load the audio file * @param name The filename of the audio file * @param stream If true, the audio will be streamed gradually from disk, * otherwise, it will be buffered. * @param streamCache If stream is also true, then this specifies if * the stream cache is used. When enabled, the audio stream will * be read entirely but not decoded, allowing features such as * seeking, looping and determining duration. * * @deprecated AudioRenderer parameter is ignored. */ public AudioNode(AudioRenderer audioRenderer, AssetManager assetManager, String name, boolean stream, boolean streamCache) { this.audioKey = new AudioKey(name, stream, streamCache); this.data = (AudioData) assetManager.loadAsset(audioKey); }
/** * Creates a new <code>AudioNode</code> with the given audio file. * * @param assetManager The asset manager to use to load the audio file * @param name The filename of the audio file * @param stream If true, the audio will be streamed gradually from disk, * otherwise, it will be buffered. * @param streamCache If stream is also true, then this specifies if * the stream cache is used. When enabled, the audio stream will * be read entirely but not decoded, allowing features such as * seeking, looping and determining duration. * * @deprecated Use {@link AudioNode#AudioNode(com.jme3.asset.AssetManager, java.lang.String, com.jme3.audio.AudioData.DataType)} instead */ public AudioNode(AssetManager assetManager, String name, boolean stream, boolean streamCache) { this.audioKey = new AudioKey(name, stream, streamCache); this.data = (AudioData) assetManager.loadAsset(audioKey); }
if (audioNode == null) { audioBuffer = new AudioBuffer(); audioNode = new AudioNode(audioBuffer, new AudioKey("Speaker-" + device.getName(), true, true)); audioNode.setName("Speaker-" + device.getName()); } else {
@Override public void simpleInitApp() { Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); rootNode.attachChild(geom); //audioStream = new AudioStream(); //audioStream.setupFormat(1, 16, 16000); audioBuffer = new AudioBuffer(); audioBuffer.setupFormat(1, 16, 16000); // might return -1 if unknown float streamDuration = 1f;//computeStreamDuration(); AudioInputStream audioInputStream; try { audioInputStream = AudioSystem.getAudioInputStream(new File("/home/pablo/tts_file.wav")); audioBuffer.updateData(readToBuffer(audioInputStream)); } catch (UnsupportedAudioFileException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } audioSource = new AudioNode(audioBuffer, new AudioKey("Speaker", true, true)); }