You Are Here:

Community: Developer Discussion Boards

#1 Old Play MIDI in Nokia 5140 - 2004-11-29, 11:53

Join Date: Nov 2004
Posts: 9
enxebreman
Offline
Registered User
Hi. I'm new in developing J2ME games and now I'm programming a game which has to play several MIDI sounds in Nokia 5140.
This is my code:

- I create the player in the constructor of a class named SoundManager (it also implements PlayerListener):

InputStream is = getClass().getResourceAsStream("/audio/disparar.mid");
firePlayer = Manager.createPlayer(is, "audio/midi");
firePlayer.addPlayerListener(this);

- And the code to play the sound is this:

if (currentPlayer != null) {
currentPlayer.stop();
currentPlayer.deallocate();
while (playing) {}
}
currentPlayer = firePlayer;
firePlayer.realize();
firePlayer.prefetch();
firePlayer.start();
playing = true;


public void playerUpdate(Player player, String str, Object obj) {
if (str == PlayerListener.END_OF_MEDIA) {
playing = false;
} else if (str == PlayerListener.STOPPED) {
playing = false;
}
}


It works for Nokia 6230 emulator, but when I take it to the Nokia 5140 it crashes and shows a java.lang.NullPointerException.

Does anyone knows what is wrong in my code?
or
Could anyone tell me how to do this?

Can Nokia 5140 play MIDI sounds or only wav ones?
Reply With Quote

#2 Old 2005-03-14, 11:35

Join Date: Mar 2005
Posts: 499
Location: Paris
njzk2
Offline
Regular Contributor
to know what are the supported media types, use the method getSupportedContentTypes(the protocol you are using (probably resource));
it will give you the types you can play with your phone
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

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: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X 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