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

项目: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    文件: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    文件: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();
}
项目:FEMultiPlayer-V2    文件:FEResources.java   
/**
 * Load resources.
 */
public static void loadResources() {
    try {
        //Load bitmap fonts
        loadBitmapFonts();

        // Textures
        textures.put("whoops", new AnimationData("res/whoops.png"));
        loadTextures(); 
        //load audio
        audio.put("miss", AudioLoader.getAudio("WAV",
                ResourceLoader.getResourceAsStream("res/sfx/miss.wav")));

    } catch (IOException e) {
        int max = GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE);
        System.out.println(max);
        e.printStackTrace();
    }
    System.gc();
}
项目:FEMultiPlayer-V2    文件:FEResources.java   
/**
     * Gets the audio.
     *
     * @param name the name
     * @return the audio
     */
    public static Audio getAudio(String name) {
        Audio a = audio.get(name);
        if(a == null) {
//          System.err.println("Warn: " + name + " not explicitly defined");
            try{
                Audio b = AudioLoader.getAudio("WAV",
                        ResourceLoader.getResourceAsStream("res/sfx/"+name+".wav"));
                audio.put(name, b);
                return b;
            } catch (Exception e){
                return null;
            }
        } else {
            return a;
        }
    }
项目:Mystic-Bastion    文件:Sounds.java   
public void loadSound(String fileName, String exe) {
    try {
        String withoutDot = exe.replace(".", "");
        if (exe == ".ogg") {
            audio = AudioLoader.getAudio(withoutDot.toUpperCase(),
                    ResourceLoader.getResourceAsStream("sound/" + fileName + exe));
        } else if (exe == ".xm") {
            audio = AudioLoader.getStreamingAudio("MOD",
                    ResourceLoader.getResource("sound/" + fileName + exe.toUpperCase()));
        } else if (exe == ".aif") {
            audio = AudioLoader.getAudio(withoutDot.toUpperCase(),
                    ResourceLoader.getResourceAsStream("sound/" + fileName + exe));
        } else if (exe == ".wav") {
            audio = AudioLoader.getAudio(withoutDot.toUpperCase(),
                    ResourceLoader.getResourceAsStream("sound/" + fileName + exe));
        } else {
            System.out.println("Only Support OGG MOD AIF or WAV");
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:GameCo    文件:Sounds.java   
public void Sounds(){
        try {
//          oggEffect = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("testdata/restart.ogg"));
//          oggStream = AudioLoader.getStreamingAudio("OGG", ResourceLoader.getResource("testdata/bongos.ogg"));
//          102.modStream = AudioLoader.getStreamingAudio("MOD", ResourceLoader.getResource("testdata/SMB-X.XM"));
            //modStream.playAsMusic(1.0f, 1.0f, true);
//          aifEffect = AudioLoader.getAudio("AIF", ResourceLoader.getResourceAsStream("testdata/burp.aif"));
//          wavEffect = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/cbrown01.wav"));

            wavHitTree = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("/res/sounds/hittree.wav"));
            oggHitTree = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("res/sounds/hittree.ogg"));

            } catch (IOException e) {
                e.printStackTrace();

        }
    }
项目:GPVM    文件: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();
}
项目:SpaceStationAlpha    文件: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();
}
项目: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();
}
项目:FEMultiplayer    文件:FEResources.java   
public static void loadResources() {
    try {
        //Load bitmap fonts
        loadBitmapFonts();

        // Textures
        textures.put("whoops", new AnimationData("res/whoops.png"));
        loadTextures(); 
        //load audio
        audio.put("miss", AudioLoader.getAudio("WAV",
                ResourceLoader.getResourceAsStream("res/sfx/miss.wav")));

    } catch (IOException e) {
        int max = GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE);
        System.out.println(max);
        e.printStackTrace();
    }
    System.gc();
}
项目:FEMultiplayer    文件:FEResources.java   
public static Audio getAudio(String name) {
        Audio a = audio.get(name);
        if(a == null) {
//          System.err.println("Warn: " + name + " not explicitly defined");
            try{
                Audio b = AudioLoader.getAudio("WAV",
                        ResourceLoader.getResourceAsStream("res/sfx/"+name+".wav"));
                audio.put(name, b);
                return b;
            } catch (Exception e){
                return null;
            }
        } else {
            return a;
        }
    }
项目:slick2d-maven    文件: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();
}
项目:BeatBitBeat    文件:CharacterSelectionState.java   
private void initializeAudioAndMusic() throws SlickException {
    try {
        // TODO Replace with correct files
        soundPressArrows = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("Assets/Sound Effects/pressArrowMainMenu.ogg"));
        soundPressEnter = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("Assets/Sound Effects/pressEnterMainMenu.ogg"));

        // TODO Replace with correct files and names
        // Audio array to songs. Order must be in sync with song art Image array
        musicSongChoices = new Music[]{
                new Music("Songs/Rage Against The Machine/Killing In The Name/Song.ogg"),
                new Music("Songs/Metallica/Master Of Puppets/Song.ogg"),

                new Music("Songs/Sandwich/Sugod/Song.ogg"),
                new Music("Songs/Nirvana/Smells Like Teen Spirit/Song.ogg"),
                new Music("Songs/Animals As Leaders/The Brain Dance/Song.ogg"),
                new Music("Songs/Motorhead/Enter Sandman/Song.ogg"),
        };

        fileSongBeatMaps = new File[]{
                new File("Songs/Rage Against The Machine/Killing In The Name/Beat Map.txt"),
                new File("Songs/Metallica/Master Of Puppets/Beat Map.txt"),

                new File("Songs/Sandwich/Sugod/Beat Map.txt"),
                new File("Songs/Nirvana/Smells Like Teen Spirit/Beat Map.txt"),
                new File("Songs/Animals As Leaders/The Brain Dance/Beat Map.txt"),
                new File("Songs/Motorhead/Enter Sandman/Beat Map.txt"),
        };

    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:BeatBitBeat    文件:GameOverState.java   
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {

        Image imagesBG[] = new Image[]{
                new Image("Assets/Graphics/Game Over/Frames/GO0000.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0001.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0002.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0003.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0004.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0005.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0006.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0007.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0008.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0009.png"),
        };

        coordsIndicator = new Coordinate[]{
                new Coordinate(537, 595),
                new Coordinate(537, 680),
        };

        animateBG = new Animation(imagesBG, 200);

        fontStats = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 24, false, false);
        fontStats.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontStats.addAsciiGlyphs();
        fontStats.loadGlyphs();

        fontWinningPlayer = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 32, false, false);
        fontWinningPlayer.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontWinningPlayer.addAsciiGlyphs();
        fontWinningPlayer.loadGlyphs();


        try {
            scoreTallySFX = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("Assets/Sound Effects/Score Tally SFX.ogg"));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
项目:BeatBitBeat    文件:MainMenuState.java   
private void initializeAudioAndMusic() throws SlickException {
    try {
        // TODO: Replace correct music and filename
        audioMusicMainMenu = new Music("Assets/State Music/Killing In The Name - Main Menu.ogg");
        audioMusicMainMenu.loop();  // play in loop the bg music

        // TODO: Replace correct sound effects and filename
        BeatBitBeatMain.setSoundPressArrows(AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("Assets/Sound Effects/pressArrowMainMenu.ogg")));
        BeatBitBeatMain.setSoundPressEnter(AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("Assets/Sound Effects/pressEnterMainMenu.ogg")));

    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:FEMultiPlayer-V2    文件:SoundTrack.java   
/**
 * Loops the given audio according to settings.
 * 
 * @param name the music category
 */
public static void loop(String name){
    if (FEResources.getAudioVolume() <= 0) return;
    if (name.equals(currentName) && current.isPlaying()) return;

    current.stop();
    currentName = name;
    Map<String, ArrayList<String>> songs = loadAudioNames();

    try{
        String setting = FEResources.getAudioSetting(name.toUpperCase());
        if(setting.equals("random")){
            Random r = new Random();
            setting = name + "_" + songs.get(name).get(r.nextInt(songs.get(name).size()));
            if(setting.split("_").length<2)
                setting = name;
        }
        current = AudioLoader.getAudio("WAV",
                ResourceLoader.getResourceAsStream("res/music/"+setting+".wav"));
        current.playAsMusic(1.0f, FEResources.getAudioVolume(), true);
    } catch (Exception e){
        e.printStackTrace();
        System.err.println("Warn: Bad sound configuration: "+name);
        try{
            Audio b = AudioLoader.getAudio("WAV",
                    ResourceLoader.getResourceAsStream("res/music/"+name+".wav"));
            b.playAsMusic(1.0f, FEResources.getAudioVolume(), true);
        }catch(Exception f){}
    }
}
项目:java-danmaku-engine    文件:Audible.java   
/**
 * Loads the audio file into OpenAL, ready to play
 * 
 * @throws IOException
 * @throws LWJGLException
 */
public void load() throws IOException, LWJGLException {
    if (filename.endsWith(".ogg"))
        audio = AudioLoader.getAudio("OGG",
                ResourceLoader.getResourceAsStream(filename));

    else if (filename.endsWith(".wav"))
        audio = AudioLoader.getAudio("WAV",
                ResourceLoader.getResourceAsStream(filename));

    else
        throw new LWJGLException("Audio files MUST be .ogg or .wav");
}
项目:9-Gates    文件:AudioHandler.java   
AudioPiece(String path) {
    try {
        SoundEffect = AudioLoader.getAudio("WAV",
                ResourceLoader.getResourceAsStream(path));
    } catch (IOException e) {
        e.printStackTrace();
    }

}
项目:NeoBM    文件:NBMLoader.java   
public static void loadSound(NBMData data) throws IOException {
    Map<Integer, String> soundMap = data.getSoundMap();
    Map<Integer, Audio> soundDataMap = data.getSoundDataMap();

    for (Map.Entry<Integer, String> entry : soundMap.entrySet()){
        int key = entry.getKey();
        String path = entry.getValue();

        Audio audio = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream(data.getParentPath() + "/" + path));
        soundDataMap.put(key, audio);
    }
}
项目:FEMultiplayer    文件:SoundTrack.java   
public static void loop(String name){
    if(!enabled) return;
    if(name.equals(current)) return;
    try {
        current = name;
        Audio a = AudioLoader.getStreamingAudio("OGG", 
                ResourceLoader.getResource("res/music/"+name+".ogg"));
        a.playAsMusic(1, 1, true);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:FEMultiplayer    文件:SoundTrack.java   
public static void restart(){
    if(!enabled) return;
    try {
        Audio a = AudioLoader.getStreamingAudio("OGG", 
                ResourceLoader.getResource("res/music/"+current+".ogg"));
        a.playAsMusic(1, 1, true);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
项目:voxels    文件:LWJGLPlatform.java   
@Override
public Audio loadAudio(final InputStream in) throws IOException
{
    if(in == null)
        return null;
    org.newdawn.slick.openal.Audio retval = AudioLoader.getAudio("OGG", in);
    if(retval == null)
        return null;
    return new LWJGLAudioAdapter(retval);
}
项目:Sharktron    文件:SoundLibrary.java   
/**
 * Loads a sound effect or music track with the given file name.
 */
private static void loadSound(String fileName)
{
    try
    {
        sound = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream(PATH_TO_SFX + fileName + ".ogg"));
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
项目:voxels    文件:LWJGLPlatform.java   
@Override
public void update()
{
    Display.update();
    AudioLoader.update();
}
项目:TuxBounce    文件:Sounds.java   
private final Audio loadAudio(final String file) throws IOException {
    return AudioLoader.getAudio("WAV",
            ResourceLoader.getResourceAsStream(file));
}