| Reply | « Previous Thread | Next Thread » |
|
Hi, can anyone please help me on this?
I have a MIDlet (cldc1.1/midp2) which is using javax.microedition.media.Player to play .midi files. it works perfectly in all the devices that I've tried it out, except for the Nokia N95 8gb (Nokia S60); on this particular device I can only heard a few notes of the midi file (less than a second) and it stops working. I've attached the code I'm using just in case; I appreciate any help given. thanks in advance. public class SoundManager implements PlayerListener { private Player player; private int volumen=100; public void playMidi(String archivo) { try { InputStream in =this.getClass().getResourceAsStream("/"+archivo); player = Manager.createPlayer(in,"audio/midi"); player.addPlayerListener(this); player.realize(); VolumeControl vc = (VolumeControl) player.getControl("VolumeControl"); if(vc != null) { vc.setLevel(this.getVolumen()); } player.start(); }catch (Exception e){ e.printStackTrace(); if (player !=null){ player.deallocate(); player.close(); } } } public int getVolumen() { return volumen; } public void setVolumen(int volumen) { if (volumen>100 ) this.volumen=100; if (volumen <0) this.volumen=0; if (volumen>=0 && volumen <=100)this.volumen = volumen; } //Interface PlayerListener public void playerUpdate(Player arg0, String arg1, Object arg2) { if (arg1.equals(PlayerListener.END_OF_MEDIA)){ player.deallocate(); player.close(); } } } |
|
Hi,
code seems all right. Any exception ? can u check the other midi with the same code and device. thanks, jitu_goldie.. KEEP TRYING.. |
| jitu_goldie |
| View Public Profile |
| Find all posts by jitu_goldie |
|
yep, I've tried a dozen of midi files all with the same result.
I've also tried them on two different S60 phones, N95 and E65 all with the same result. The weirdest thing that I've noticed during my tests is this: if I restart the phone and execute the apps right away, the sound works fine most of the time. As soon as an event is produced, like an income call or SMS, it stops working fine and behaves as described above, no matter how many times I restart the apps or attempt to cleanup the memory. More tips from the tests: 1. on the emulator (any Nokia S40/S60) it works always fine. 2. I've tested the apps on S40 real devices (low and high end) and it always works fine. In general, it seems that the faster and better the device's hardware is, the more trouble I get. BTW: No exceptions raised at all.
Last edited by javalis : 2009-06-22 at 16:49.
Reason: miss to add some info.
|
|
Quote:
try once more. thanks, jitu_goldie.. KEEP TRYING.. |
| jitu_goldie |
| View Public Profile |
| Find all posts by jitu_goldie |
|
Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
raj_J2ME
Offline
Forum Nokia Champion
|
|
|
Hi,
Yup,this is very much painful if the code seem to be fine but it does not work. I would recommend you that just make a plain and simple demo and try to play the file and check whether you have a success or not.There are a lots of demo,one is this, Quote:
Thanks R a j - The K e r n e l |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Python S60 Emulator | NAYSAMBO | Python | 25 | 2009-04-08 11:22 |
| Infra-red capability | Symbian_Challenge_0412 | General Discussion | 1 | 2005-08-16 19:24 |