Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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 1247 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: 10


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! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
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!
Legends of Yore - The Casual Retro Roguelike
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.

 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (53 views)
2014-04-15 18:08:23

BurntPizza (51 views)
2014-04-15 03:46:01

UprightPath (65 views)
2014-04-14 17:39:50

UprightPath (48 views)
2014-04-14 17:35:47

Porlus (65 views)
2014-04-14 15:48:38

tom_mai78101 (89 views)
2014-04-10 04:04:31

BurntPizza (149 views)
2014-04-08 23:06:04

tom_mai78101 (245 views)
2014-04-05 13:34:39

trollwarrior1 (203 views)
2014-04-04 12:06:45

CJLetsGame (210 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!