Java 类org.newdawn.slick.openal.SoundStore 实例源码

项目:trashjam2017    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}
项目:trashjam2017    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param url The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(URL url, boolean streamingHint) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(url);
            } else {
                sound = SoundStore.get().getOgg(url.openStream());
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+url);
    }
}
项目:trashjam2017    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param ref The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(String ref, boolean streamingHint) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(ref);
            } else {
                sound = SoundStore.get().getOgg(ref);
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:trashjam2017    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param in The location of the OGG or MOD/XM to load
 * @param ref The name to associate this stream
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:trashjam2017    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param url The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(URL url) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(url.openStream());
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:trashjam2017    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param ref The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(ref);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:trashjam2017    文件:SoundTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    SoundStore.get().setMaxSources(32);

    myContainer = container;
    sound = new Sound("testdata/restart.ogg");
    charlie = new Sound("testdata/cbrown01.wav");
    try {
        engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav"));
    } catch (IOException e) {
        throw new SlickException("Failed to load engine", e);
    }
    music = musica = new Music("testdata/SMB-X.XM");
    //music = musica = new Music("testdata/theme.ogg", true);
    musicb = new Music("testdata/kirby.ogg", true);
    burp = new Sound("testdata/burp.aif");

    music.play();
}
项目:Progetto-C    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}
项目:Progetto-C    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param url The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(URL url, boolean streamingHint) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(url);
            } else {
                sound = SoundStore.get().getOgg(url.openStream());
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+url);
    }
}
项目:Progetto-C    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param ref The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(String ref, boolean streamingHint) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(ref);
            } else {
                sound = SoundStore.get().getOgg(ref);
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:Progetto-C    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param in The location of the OGG or MOD/XM to load
 * @param ref The name to associate this stream
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:Progetto-C    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param url The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(URL url) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(url.openStream());
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:Progetto-C    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param ref The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(ref);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:Progetto-C    文件:SoundTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    SoundStore.get().setMaxSources(32);

    myContainer = container;
    sound = new Sound("testdata/restart.ogg");
    charlie = new Sound("testdata/cbrown01.wav");
    try {
        engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav"));
    } catch (IOException e) {
        throw new SlickException("Failed to load engine", e);
    }
    music = musica = new Music("testdata/SMB-X.XM");
    //music = musica = new Music("testdata/theme.ogg", true);
    musicb = new Music("testdata/kirby.ogg", true);
    burp = new Sound("testdata/burp.aif");

    music.play();
}
项目:BaseClient    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}
项目:BaseClient    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param url The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(URL url, boolean streamingHint) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(url);
            } else {
                sound = SoundStore.get().getOgg(url.openStream());
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+url);
    }
}
项目:BaseClient    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param ref The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(String ref, boolean streamingHint) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(ref);
            } else {
                sound = SoundStore.get().getOgg(ref);
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:BaseClient    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param in The location of the OGG or MOD/XM to load
 * @param ref The name to associate this stream
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:BaseClient    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param url The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(URL url) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(url.openStream());
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:BaseClient    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param ref The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(ref);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:BaseClient    文件:SoundTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    SoundStore.get().setMaxSources(32);

    myContainer = container;
    sound = new Sound("testdata/restart.ogg");
    charlie = new Sound("testdata/cbrown01.wav");
    try {
        engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav"));
    } catch (IOException e) {
        throw new SlickException("Failed to load engine", e);
    }
    music = musica = new Music("testdata/SMB-X.XM");
    //music = musica = new Music("testdata/theme.ogg", true);
    musicb = new Music("testdata/kirby.ogg", true);
    burp = new Sound("testdata/burp.aif");

    music.play();
}
项目:opsu-dance    文件:Music.java   
/**
 * Poll the state of the current music. This causes streaming music
 * to stream and checks listeners. Note that if you're using a game container
 * this will be auto-magically called for you.
 * 
 * @param delta The amount of time since last poll
 */
public static void poll(int delta) {
    synchronized (musicLock) {
        if (currentMusic != null) {
            SoundStore.get().poll(delta);
            if (!SoundStore.get().isMusicPlaying()) {
                if (!currentMusic.positioning) {
                    Music oldMusic = currentMusic;
                    currentMusic = null;
                    oldMusic.fireMusicEnded();
                }
            } else {
                currentMusic.update(delta);
            }
        }
    }
}
项目:opsu-dance    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}
项目:code404    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param url The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(URL url, boolean streamingHint) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(url);
            } else {
                sound = SoundStore.get().getOgg(url.openStream());
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+url);
    }
}
项目:code404    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param ref The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(String ref, boolean streamingHint) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            if (streamingHint) {
                sound = SoundStore.get().getOggStream(ref);
            } else {
                sound = SoundStore.get().getOgg(ref);
            }
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:code404    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param url The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(URL url) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(url.openStream());
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:code404    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param ref The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(ref);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:cretion    文件:SoundTest.java   
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
    SoundStore.get().setMaxSources(32);

    myContainer = container;
    sound = new Sound("testdata/restart.ogg");
    charlie = new Sound("testdata/cbrown01.wav");
    try {
        engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav"));
    } catch (IOException e) {
        throw new SlickException("Failed to load engine", e);
    }
    music = musica = new Music("testdata/SMB-X.XM");
    //music = musica = new Music("testdata/theme.ogg", true);
    musicb = new Music("testdata/kirby.ogg", true);
    burp = new Sound("testdata/burp.aif");

    music.play();
}
项目:opsu    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}
项目:JavaRA    文件:Soundly.java   
public static AudioData loadSound(URL url) throws SlickException {
SoundStore.get().init();
String ref = url.getFile();
Audio audio = null;
try {
    if (ref.toLowerCase().endsWith(".ogg")) {
    audio = SoundStore.get().getOgg(url.openStream());
    } else if (ref.toLowerCase().endsWith(".wav")) {
    audio = SoundStore.get().getWAV(url.openStream());
    } else if (ref.toLowerCase().endsWith(".aif")) {
    audio = SoundStore.get().getAIF(url.openStream());
    } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
    throw new SlickException("Use XStream for streaming .xm and .mod sounds");
    } else {
    throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
    }
} catch (Exception e) {
    Log.error(e);
    throw new SlickException("Failed to load sound: " + ref, e);
}
return new AudioData(audio.getBufferID());
   }
项目:javaleagueframework    文件:VisorOpenGl.java   
/**
 * Inicia el Visor OpenGL indicando la instancia de partido, las dimensiones
 * de la pantalla (sx,sy), si Se ejecuta en pantalla completa(fullscreen), e
 * indicando la instancia del jframe Principal(dejar nulo)
 * 
 * @param partido
 * @param sx
 * @param sy
 * @param fullscreen
 * @param principal
 * @throws SlickException
 */
public VisorOpenGl(Partido partido, int sx, int sy, boolean fullscreen,
        PrincipalFrame principal) throws SlickException {
    this.partido = partido;
    this.sx = sx;
    this.sy = sy;
    this.dxsaque = (sx + 300 * 2) / 75;
    sx2 = sx / 2;
    sy2 = sy / 2;
    this.principal = principal;
    AppGameContainer container = new AppGameContainer(this);
    container.setForceExit(false);
    container.setDisplayMode(sx, sy, fullscreen);
    container.start();
    SoundStore.get().clear();
    InternalTextureLoader.get().clear();
}
项目:javaleagueframework    文件:VisorOpenGl.java   
/**
 * Inicia el Visor OpenGL indicando la instancia de partido guardado, las
 * dimensiones de la pantalla (sx,sy), si Se ejecuta en pantalla
 * completa(fullscreen), e indicando la instancia del jframe Principal(dejar
 * nulo)
 * */
public VisorOpenGl(PartidoGuardado partido, int sx, int sy,
        boolean fullscreen, PrincipalFrame principal) throws SlickException {
    pg = (PartidoGuardado) partido;
    guardado = true;
    progreso = true;
    inicio = 0;
    fin = pg.getIterciones() - 1;
    // System.out.println("Reproduciendo partido guardado...");
    this.partido = partido;
    this.sx = sx;
    this.sy = sy;
    this.dxsaque = (sx + 300 * 2) / 75;
    sx2 = sx / 2;
    sy2 = sy / 2;
    this.principal = principal;
    AppGameContainer container = new AppGameContainer(this);
    container.setForceExit(false);
    container.setDisplayMode(sx, sy, fullscreen);
    container.start();
    SoundStore.get().clear();
    InternalTextureLoader.get().clear();
}
项目:GPVM    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}
项目:JavaRA    文件:Soundly.java   
/** 
    * Clears the sound engine (stopping all managed sounds, clearing all 
    * sources) and clears Slick's SoundStore. Both SoundManager and SoundStore
    * will expect an init() call after this.
    * 
    * 
    */
   public void clear() {
//stop the sources
for (int i=0; i<sources.length; i++) {
    if (sources[i]!=null) {
    sources[i].stop();
    sources[i].clearSource();
    }
}
//clear the sound store
SoundStore.get().clear();
//delete the sources array
queue = null;
sources = null;
inited = false;
   }
项目:cretion    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param in The location of the OGG or MOD/XM to load
 * @param ref The name to associate this stream
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:JavaRA    文件:XStreamingSound.java   
/** Only OGG streams and MOD sounds are currently accepted. */
public XStreamingSound(String ref, String description) throws SlickException {
    super(new AudioData(), description);
    SoundStore.get().init();
    this.ref = ref;
    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            streamPlayer = new XOpenALStreamPlayer(source, ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            if (SoundStore.get().isDeferredLoading())
                Log.warn("Deferred loading for MOD is not supported; loading immediately");
            modPlayer = new OpenALMODPlayer();
            module = OpenALMODPlayer.loadModule(ResourceLoader.getResourceAsStream(ref));
        } else {
            throw new SlickException("not a valid stream format, must be: .xm, .mod or .ogg");
        }
    } catch (IOException e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: " + ref, e);
    }
}
项目:GPVM    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param in The location of the OGG or MOD/XM to load
 * @param ref The name to associate this stream
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:GPVM    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param url The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(URL url) throws SlickException {
    SoundStore.get().init();
    String ref = url.getFile();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(url.openStream());
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(url.openStream());
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(url.openStream());
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(url.openStream());
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:GPVM    文件:Sound.java   
/**
 * Create a new Sound 
 * 
 * @param ref The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(ref);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(ref);
        } else if (ref.toLowerCase().endsWith(".aif")) {
            sound = SoundStore.get().getAIF(ref);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(ref);
        } else {
            throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load sound: "+ref);
    }
}
项目:GPVM    文件:Music.java   
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(InputStream in, String ref) throws SlickException {
    SoundStore.get().init();

    try {
        if (ref.toLowerCase().endsWith(".ogg")) {
            sound = SoundStore.get().getOgg(in);
        } else if (ref.toLowerCase().endsWith(".wav")) {
            sound = SoundStore.get().getWAV(in);
        } else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
            sound = SoundStore.get().getMOD(in);
        } else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
            sound = SoundStore.get().getAIF(in);
        } else {
            throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
        }
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to load music: "+ref);
    }
}