You Are Here:

Community: Developer Discussion Boards

#1 Old Red face problem palaying midi on Nokia N95 - 2009-04-06, 23:34

Join Date: Apr 2008
Posts: 3
javalis
Offline
Registered User
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();
}
}

}
Reply With Quote

#2 Old Thumbs up Re: problem palaying midi on Nokia N95 - 2009-04-08, 13:07

Join Date: Sep 2008
Posts: 1,195
Location: DELHI
Send a message via Yahoo to jitu_goldie
jitu_goldie's Avatar
jitu_goldie
Offline
Forum Nokia Champion
Hi,
code seems all right. Any exception ? can u check the other midi with the same code and device.


thanks,
jitu_goldie..

KEEP TRYING..
Reply With Quote

#3 Old Re: problem palaying midi on Nokia N95 - 2009-06-22, 16:47

Join Date: Apr 2008
Posts: 3
javalis
Offline
Registered User
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.
Reply With Quote

#4 Old Thumbs up Re: problem palaying midi on Nokia N95 - 2009-06-22, 19:13

Join Date: Sep 2008
Posts: 1,195
Location: DELHI
Send a message via Yahoo to jitu_goldie
jitu_goldie's Avatar
jitu_goldie
Offline
Forum Nokia Champion
Quote:
Originally Posted by javalis View Post
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.
strange! code is running perfectly on emulators but not running on real devices and also there is no any exception. Really head burning situation. May be there will be some exceptions. Had u handle the exceptions well with proper alerts?

try once more.


thanks,
jitu_goldie..

KEEP TRYING..
Reply With Quote

#5 Old Re: problem palaying midi on Nokia N95 - 2009-06-23, 06:59

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
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:
import javax.microedition.media.Manager;
import javax.microedition.media.Player;
import javax.microedition.midlet.MIDlet;

public class PlayMIDIMIDlet extends MIDlet {

Player midiPlayer = null;

public PlayMIDIMIDlet() {
try {
midiPlayer = Manager.createPlayer(getClass().getResourceAsStream("/a.mid"), "audio/midi");
} catch (Exception e) {
System.err.println(e);
}
}

public void startApp() {
try {
if (midiPlayer != null) {
midiPlayer.start();
}
} catch (Exception e) {
System.err.println(e);
}
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}
}
Try to play on the same device.


Thanks

R a j - The K e r n e l
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d134434X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ