Package javax.sound.sampled

Examples of javax.sound.sampled.AudioFileFormat$Type


        try {
            if (!inputStream.markSupported()) {
                inputStream = new BufferedInputStream(inputStream);
            }
            inputStream.mark(MARK_LIMIT);
            AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream, medialength, totalms);
            inputStream.reset();
            return new AudioInputStream(inputStream, audioFileFormat.getFormat(), audioFileFormat.getFrameLength());
        }
        catch (UnsupportedAudioFileException e) {
            inputStream.reset();
            throw e;
        }
View Full Code Here


            TDebug.out("getAudioFileFormat(File file)");
        }

        try (InputStream inputStream = new BufferedInputStream(new FileInputStream(file))) {
            inputStream.mark(MARK_LIMIT);
            AudioFileFormat aff = getAudioFileFormat(inputStream);
            inputStream.reset();
            // Get Vorbis file info such as length in seconds.
            VorbisFile vf = new VorbisFile(file.getAbsolutePath());
            return getAudioFileFormat(inputStream, (int) file.length(), (int) Math.round((vf.time_total(-1)) * 1000));
        } catch (SoundException e) {
View Full Code Here

        try {
            if (!inputStream.markSupported()) {
                inputStream = new BufferedInputStream(inputStream);
            }
            inputStream.mark(MARK_LIMIT);
            AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream, medialength, totalms);
            inputStream.reset();
            return new AudioInputStream(inputStream, audioFileFormat.getFormat(), audioFileFormat.getFrameLength());
        } catch (UnsupportedAudioFileException | IOException e) {
            inputStream.reset();
            throw e;
        }
    }
View Full Code Here

        line.open();

        StreamPlayer player = StreamPlayer.create(line, "Music-Thread");

        URL url = new URL("http://www.twelvepm.de/vorbis/Agogo.ogg");
        AudioFileFormat fmt = AudioSystem.getAudioFileFormat(url);
        if (fmt instanceof TAudioFileFormat) {
            TAudioFileFormat format = (TAudioFileFormat) fmt;
            Map<String, Object> props = format.properties();
            System.out.println("Title " + (String) props.get("title"));
        }
View Full Code Here

        if (TDebug.TraceAudioFileReader) {
            TDebug.out("TAudioFileReader.getAudioFileFormat(File): begin (class: " + getClass().getSimpleName() + ")");
        }
        long lFileLengthInBytes = file.length();
        InputStream inputStream = new FileInputStream(file);
        AudioFileFormat audioFileFormat = null;
        try {
            audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes);
        } finally {
            inputStream.close();
        }
View Full Code Here

        if (TDebug.TraceAudioFileReader) {
            TDebug.out("TAudioFileReader.getAudioFileFormat(URL): begin (class: " + getClass().getSimpleName() + ")");
        }
        long lFileLengthInBytes = getDataLength(url);
        InputStream inputStream = url.openStream();
        AudioFileFormat audioFileFormat = null;
        try {
            audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes);
        } finally {
            inputStream.close();
        }
View Full Code Here

        long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED;
        if (!inputStream.markSupported()) {
            inputStream = new BufferedInputStream(inputStream, getMarkLimit());
        }
        inputStream.mark(getMarkLimit());
        AudioFileFormat audioFileFormat = null;
        try {
            audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes);
        } finally {
            /* TODO: required semantics is unclear: should reset()
             be executed only when there is an exception or
View Full Code Here

        if (player.isPlaying()) {
            player.stop();
        }

        // get and AudioInputStream from the resource
        AudioFileFormat fmt = null;
        try {
            fmt = AudioSystem.getAudioFileFormat(list.get(index).getInputStream());
        } catch (UnsupportedAudioFileException | IOException ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
        AudioInputStream is = SoundSystem.getAudioInputStream(list.get(index));

        // if we have a listener, tell about it
        if (listener != null) {
            String title = (String) fmt.properties().get("title");
            listener.newEvent("Audio: \"" + title + "\" now playing.");
        }

        // start playing this piece
        player.play(is);
View Full Code Here

                inputStream = new BufferedInputStream(inputStream,
                        getMarkLimit());
            }
            inputStream.mark(getMarkLimit());
        }
        AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream,
                lFileLengthInBytes);
        if (isRereading()) {
            inputStream.reset();
        }
        AudioInputStream audioInputStream = new AudioInputStream(inputStream,
                audioFileFormat.getFormat(), audioFileFormat.getFrameLength());
        if (TDebug.TraceAudioFileReader) {
            TDebug.out("TAudioFileReader.getAudioInputStream(InputStream, long): end");
        }
        return audioInputStream;
    }
View Full Code Here

            "copyright", "ogg.bitrate.min", "ogg.bitrate.nominal", "ogg.bitrate.max"};
        String[] testPropsAF = {"vbr", "bitrate"};

        File file = new File(filename);
        try {
            AudioFileFormat baseFileFormat = AudioSystem.getAudioFileFormat(file);
            AudioFormat baseFormat = baseFileFormat.getFormat();
            System.out.println("-> Filename : " + filename + " <-");
            System.out.println(baseFileFormat);
            if (baseFileFormat instanceof TAudioFileFormat) {
                Map properties = ((TAudioFileFormat) baseFileFormat).properties();
                System.out.println(properties);
View Full Code Here

TOP

Related Classes of javax.sound.sampled.AudioFileFormat$Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.