AudioFileReader / SPI / unrecognized formats

Discussion in 'Java' started by Andrew Thompson, Jan 2, 2009.

  1. What should an AudioFileReader.getAudioInputStream(InputStream)*
    do/throw when it encounters an unrecognized stream?

    The JavaDocs declare that it throws an UnsupportedAudioFileException.

    * <http://java.sun.com/javase/6/docs/api/javax/sound/sampled/spi/
    AudioFileReader.html#getAudioInputStream(java.io.InputStream)>

    I am developing a new sound format. After some months of wrangling
    with the build tools to get an app. that correctly registers a new
    audio
    type via the ServiceProvider interface (fixed in the end, by upgrading
    to
    the latest version of Ant), I am now puzzling over what to do when
    the
    new class is handed an audio stream that is handled by one of the
    *pre-existing* formats.

    If I throw an UnsupportedAudioFileException when handed a format
    that is not the new one, the app. can no longer read existing formats.
    If I fail to throw an UAFE, my class is left trying to deal with data
    for which it was not designed, and cannot cope.

    Anybody encountered this before / have any tips on how to proceed?

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jan 2, 2009
    #1
    1. Advertising

  2. Hi Andrew,

    Andrew Thompson wrote:
    > What should an AudioFileReader.getAudioInputStream(InputStream)*
    > do/throw when it encounters an unrecognized stream?

    ....
    > the latest version of Ant), I am now puzzling over what to do when
    > the
    > new class is handed an audio stream that is handled by one of the
    > *pre-existing* formats.
    >
    > If I throw an UnsupportedAudioFileException when handed a format
    > that is not the new one, the app. can no longer read existing formats.


    I haven't tried it, but I'd expect AudioSystem to try-catch-iterate over
    the registered providers (at least, if a File, URL or InputStream is given).

    Bye
    Michael
    Michael Rauscher, Jan 3, 2009
    #2
    1. Advertising

  3. On Jan 3, 11:40 am, Michael Rauscher <> wrote:
    > > ...
    > > If I throw an UnsupportedAudioFileException when handed a format
    > > that is not the new one, the app. can no longer read existing formats.

    >
    > I haven't tried it, but I'd expect AudioSystem to try-catch-iterate over
    > the registered providers (at least, if a File, URL or InputStream is given).


    I'd have thought so as well, but throwing
    an UAFE within my own reader stops the
    process, whatever that process is.

    ...Now I look at the source for
    AudioSystem.getAudioInputStream(InputStream)
    it supports what you are saying, it iterates
    a list of the AudioFileReaders, try/catching
    on UAFE!

    I'll think some more on where /I/ am going
    wrong with that process..

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jan 3, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bob
    Replies:
    1
    Views:
    4,322
    Tim Hubberstey
    Feb 15, 2005
  2. Fizzy

    SPI Problem

    Fizzy, Apr 12, 2006, in forum: VHDL
    Replies:
    4
    Views:
    3,555
    Andrew FPGA
    Apr 12, 2006
  3. Replies:
    4
    Views:
    6,954
  4. bob
    Replies:
    3
    Views:
    5,104
    Victor Bazarov
    Mar 1, 2005
  5. Marcin Lewandowski

    Problem with Opera & OGG Vorbis SPI

    Marcin Lewandowski, Jun 24, 2006, in forum: Java
    Replies:
    0
    Views:
    381
    Marcin Lewandowski
    Jun 24, 2006
Loading...

Share This Page