java类javax.sound.sampled.UnsupportedAudioFileException的实例源码

SoundStuff.java 文件源码 项目:What-Happened-to-Station-7 阅读 21 收藏 0 点赞 0 评论 0
public void swnat() throws UnsupportedAudioFileException, IOException, LineUnavailableException
{
    try
    {
        audioClip.open(audioStream);
        audioClip.start();
    }
    catch (MalformedURLException murle)
    {
        System.out.println(murle);
    }
}
AiffFileReader.java 文件源码 项目:jdk8u-jdk 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Obtains the audio file format of the File provided.  The File must
 * point to valid audio file data.
 * @param file the File from which file format information should be
 * extracted
 * @return an <code>AudioFileFormat</code> object describing the audio file format
 * @throws UnsupportedAudioFileException if the File does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
    AudioFileFormat fileFormat = null;
    FileInputStream fis = new FileInputStream(file);       // throws IOException
    // part of fix for 4325421
    try {
        fileFormat = getCOMM(fis, false);
    } finally {
        fis.close();
    }

    return fileFormat;
}
SunFileReader.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
@Override
public final AudioInputStream getAudioInputStream(final URL url)
        throws UnsupportedAudioFileException, IOException {
    final InputStream urlStream = url.openStream();
    try {
        return getAudioInputStream(new BufferedInputStream(urlStream));
    } catch (final Throwable e) {
        closeSilently(urlStream);
        throw e;
    }
}
SoundStuff.java 文件源码 项目:What-Happened-to-Station-7 阅读 22 收藏 0 点赞 0 评论 0
public void dbo() throws UnsupportedAudioFileException, IOException, LineUnavailableException
{
    try
    {
        audioClip.close();
        audioStream.close();
        aC.open(aS);
        aC.start();
    }
    catch (MalformedURLException murle)
    {
        System.out.println(murle);
    }
}
SoundStuff.java 文件源码 项目:What-Happened-to-Station-7 阅读 20 收藏 0 点赞 0 评论 0
public void dbol() throws UnsupportedAudioFileException, IOException, LineUnavailableException
{
    try
    {
        audioClip.close();
        audioStream.close();
        aC.open(aS);
        aC.start();
        aC.loop(10);
    }
    catch (MalformedURLException murle)
    {
        System.out.println(murle);
    }
}
SoundStuff.java 文件源码 项目:What-Happened-to-Station-7 阅读 19 收藏 0 点赞 0 评论 0
public void flame() throws UnsupportedAudioFileException, IOException, LineUnavailableException
{
    try
    {
        insane.open(flames);
        insane.start();
    }
    catch (MalformedURLException murle)
    {
        System.out.println(murle);
    }
}
WaveFileReader.java 文件源码 项目:jdk8u-jdk 阅读 46 收藏 0 点赞 0 评论 0
/**
 * Obtains an audio stream from the File provided.  The File must
 * point to valid audio file data.
 * @param file the File for which the <code>AudioInputStream</code> should be
 * constructed
 * @return an <code>AudioInputStream</code> object based on the audio file data pointed
 * to by the File
 * @throws UnsupportedAudioFileException if the File does not point to valid audio
 * file data recognized by the system
 * @throws IOException if an I/O exception occurs
 */
public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
    FileInputStream fis = new FileInputStream(file); // throws IOException
    AudioFileFormat fileFormat = null;
    // part of fix for 4325421
    try {
        fileFormat = getFMT(fis, false);
    } finally {
        if (fileFormat == null) {
            fis.close();
        }
    }
    return new AudioInputStream(fis, fileFormat.getFormat(), fileFormat.getFrameLength());
}
SoundStuff.java 文件源码 项目:What-Happened-to-Station-7 阅读 17 收藏 0 点赞 0 评论 0
public void AWP() throws UnsupportedAudioFileException, IOException, LineUnavailableException
{
    try
    {
        snope.open(csgo);
        snope.start();
    }
    catch (MalformedURLException murle)
    {
        System.out.println(murle);
    }
}
PlayerSniper.java 文件源码 项目:What-Happened-to-Station-7 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Attack the enemy from a distance
 */
@Override
@UIEventHandle(value = "Key_P", turn = "Player")
public void attack(Entity target)
{
    if (target == null) { return; }
    if (!(target instanceof Damageable)) { return; }
    if (!target.isActive()) { return; }
    if (getLevel().isThroughWall(getLocation(), target.getLocation())) { return; }

    final int d = getLocation().dist(target.getLocation());
    if (d > 15) { return; }

    if (shots_taken + 1 > total_shots || move + 2 > speed)
    {
        getLevel().getUIInterface().selectTile(null);
        return;
    }

    move += 2;
    shots_taken += 1;

    try
    {
        SoundStuff cam = new SoundStuff();
        cam.AWP();
    }
    catch (IOException | LineUnavailableException | UnsupportedAudioFileException e)
    {
        e.printStackTrace();
    }

        ((Damageable) target).takeDamage(40);

    getLevel().getUIInterface().startAnimation(new CompoundAnimation.Sequential(new Laser(getLocation(), target.getLocation()), new TileDamage(target.getLocation())));
    if (move >= speed && shots_taken >= total_shots)
        getLevel().getUIInterface().selectTile(null);
}
JavaSoundAudioClip.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
public JavaSoundAudioClip(InputStream in) throws IOException {
    if (DEBUG || Printer.debug)Printer.debug("JavaSoundAudioClip.<init>");

    BufferedInputStream bis = new BufferedInputStream(in, STREAM_BUFFER_SIZE);
    bis.mark(STREAM_BUFFER_SIZE);
    boolean success = false;
    try {
        AudioInputStream as = AudioSystem.getAudioInputStream(bis);
        // load the stream data into memory
        success = loadAudioData(as);

        if (success) {
            success = false;
            if (loadedAudioByteLength < CLIP_THRESHOLD) {
                success = createClip();
            }
            if (!success) {
                success = createSourceDataLine();
            }
        }
    } catch (UnsupportedAudioFileException e) {
        // not an audio file
        try {
            MidiFileFormat mff = MidiSystem.getMidiFileFormat(bis);
            success = createSequencer(bis);
        } catch (InvalidMidiDataException e1) {
            success = false;
        }
    }
    if (!success) {
        throw new IOException("Unable to create AudioClip from input stream");
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号