Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  RMF (sound) and J2ME  (Read 1072 times)
0 Members and 1 Guest are viewing this topic.
Offline jlb

Junior Newbie





« Posted 2005-09-19 08:48:28 »



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 Huh
Offline Abuse

JGO Coder


Medals: 2


falling into the abyss of reality


« Reply #1 - Posted 2005-09-19 11:03:34 »

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.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Offline caraiz

Senior Newbie




Java games rock!


« Reply #2 - Posted 2005-09-19 11:11:25 »

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

Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline jlb

Junior Newbie





« Reply #3 - Posted 2005-09-19 20:15:29 »

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
Offline caraiz

Senior Newbie




Java games rock!


« Reply #4 - Posted 2005-09-20 10:36:34 »

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

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (133 views)
2013-05-17 23:29:12

alaslipknot (142 views)
2013-05-16 23:24:48

gouessej (171 views)
2013-05-16 02:53:38

gouessej (166 views)
2013-05-16 02:17:58

theagentd (175 views)
2013-05-15 17:01:13

theagentd (160 views)
2013-05-15 17:00:54

StreetDoggy (204 views)
2013-05-14 17:56:26

kutucuk (228 views)
2013-05-12 19:10:36

kutucuk (228 views)
2013-05-12 17:36:09

UnluckyDevil (231 views)
2013-05-12 07:09:57
Complex number cookbook
by Roquen
2013-04-24 14:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 18:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 18:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 18:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 19:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 18:17:38

Java Data structures
by Roquen
2013-03-29 15:21:12

Topic Request
by kutucuk
2013-03-22 23:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.097 seconds with 22 queries.