RMF (sound) and J2ME

Hi,

I’m a mobile sound producer specialized in mobile sound production.
I would like to play a RMF file on targeted mobiles, using JAVA technology, but I
can’t find any example of a *.java file.

I’ m using a “PlayWav.java” source file and I have changed in the code, the “WAV
informations” by the “RMF ones” . I built the project and packaged the .jar file using the Wireless Toolkit and all seems ok.

Naturally the file didn’t paly in the phone emulator because it’s not linked to RMF
on PC. It would play on targeted phones but I have to test.

Could you tell me if the code below is ok or not:
From the code writen to play a WAV file I have only changed the file
name/extension and mime type and replaced it by the RMF’s ones ( at the end of code).

Could you tell me if it’s ok in theory or if I have to make more than change the name/exctension and mime type of WAV file by RMF’s ones ?

/*--------------------------------------------------

  • PlayWav.java
    -------------------------------------------------/
    import javax.microedition.midlet.;
    import javax.microedition.lcdui.
    ;
    import javax.microedition.media.;
    import java.io.
    ;
    public class PlayWav extends MIDlet implements CommandListener
    {
    private Display display; // Reference to display object
    private Form fmMain; // Main form
    private Command cmExit; // Command to exit the MIDlet
    private Command cmPlay; // Command to play wav file
    public PlayWav()
    {
    display = Display.getDisplay(this);
    // Create commands
    cmExit = new Command(“Exit”, Command.EXIT, 1);
    cmPlay = new Command(“Play”, Command.SCREEN, 2);
    // Create Form, add components, listen for events
    fmMain = new Form(“Play WAV file”);
    fmMain.addCommand(cmExit);
    fmMain.addCommand(cmPlay);
    fmMain.setCommandListener(this);
    }
    public void startApp()
    {
    display.setCurrent(fmMain);
    }
    public void pauseApp()
    { }
    public void destroyApp(boolean unconditional)
    { }
    /*--------------------------------------------------
  • Event handling
    -------------------------------------------------/
    public void commandAction(Command c, Displayable s)
    {
    if (c == cmExit)
    {
    destroyApp(false);
    notifyDestroyed();
    }
    else if (c == cmPlay)
    playwavfile();
    }
    /*--------------------------------------------------
  • Play a wav file
    -------------------------------------------------/
    public void playwavfile()
    {
    try
    {
    // Read wav file, packaged in the jar file
    InputStream in = getClass().getResourceAsStream("/sexmachine.rmf");
    Player p = Manager.createPlayer(in, “audio/rmf”);
    p.start();
    }
    catch (Exception e)
    {
    // Display an alert
    Alert alr = new Alert(“Error”, “Unable to play WAV file!”, null, AlertType.ERROR);
    alr.setTimeout(Alert.FOREVER);
    display.setCurrent(alr, fmMain);
    }
    }
    }

Thank you very much

Jean Luc Borla ???

The mime-type is correct - however, out of the 100s of different phones I have come into contact with I can think of none that will play rmf files.

The common file formats supported in the phones are midi, wav and amr.

Hi,

Thank you for answer .

I know some phones RMF compatible.
do I have to change other things than name file and extension and mimetype, in the code ?

Could you provide the same code used for playing a MIDI File ?

Jlb

What the phone supports RMF or other formats dont mean that Java MMAPI will support them…

Here u have a tutorial of MMAPI

http://www.awprofessional.com/articles/article.asp?p=375708&seqNum=1