[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kvm-interest
Subject:    o2 xm audio
From:       Steven O'Boyle <S.OBoyle () IFONE ! COM>
Date:       2005-08-16 13:24:13
[Download RAW message or body]

Hi guys just wondering if any of you have got audio to work, using
MIDP2's media package, on the O2 XM, and if so how?

I am using getResourceAsStream() to obtain an InputStream to a midi
file, I am then creating a Player using this stream and "audio/midi" as
my mime type.  After realizing, prefetching and starting the Player no
sound is produced by the device even though calling Player.getState()
returns Player.STARTED;

I have made sure that the filename is absolute, that no exceptions are
being thrown and still nothing.

Also, this code works on other phones including X3 and X4!

    public static void PlayeMusic(String filename) {
          musicPlayer = createPlayer(filename, "audio/midi");
          musicPlayer.setLoopCount(-1);
          musicPlayer.start();
    }

    private static Player createPlayer(String fileName, String mimeType) {
        Player p = null;
        try {
            InputStream in = new
Object().getClass().getResourceAsStream(fileName);
            p = Manager.createPlayer(in, mimeType);
            p.realize();
            p.prefetch();
            in.close();
        } catch (Exception e) {
        }
        return p;
    }

I have noticed that there are a couple of embedded games which have
working audio, these however use audio/aac and audio/x-wav.
Unfortunately both these formats produce file sizes that are just
impractical.

regards
steve

 ==========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic