You Are Here:

Community: Developer Discussion Boards

#1 Old Jumping in MIDI files - 2004-11-25, 11:26

Join Date: Oct 2004
Posts: 4
fortikur
Offline
Registered User
As I found out, that the Nokia6230 can handle only 1 player (only the first loaded midi will be played, the others will be ignored), I tried to create one midi containing all the effects and music for the game.
If I want to play a given effect, I just jump to a given position in the midi. A least I try to...
What I do is:


//Init for my midi player
public void init(){
try
{
InputStream in = getClass().getResourceAsStream("/sound.mid");
p = Manager.createPlayer(in, "audio/midi");
p.prefetch();
p.stop();
p.deallocate();
p.setMediaTime(0L);
}
catch (Exception e)
{ }
}

//this is what plays the sound
public void play(long fromwhere){
try
{
p.stop();
p.setMediaTime((long)fromwhere);
p.start();
}
catch (MediaException e)
{e.printStackTrace(); }
}

Even if i jump with "fromwhere" to the end of the midi, it starts to play it from the beginning.

Does anyone know how I can jump to any place in the midi correctly? - and play it from the given position

Thank you in advance
Reply With Quote

#2 Old Re: Jumping in MIDI files - 2004-12-24, 12:54

Join Date: Mar 2003
Posts: 10
jerkolino
Offline
Registered User
Yea it seems that setMediaTime doesn't work with midi files.
Reply With Quote

#3 Old 2005-01-03, 21:29

Join Date: Mar 2003
Posts: 87
dmford
Offline
Regular Contributor
I'm certain that setMediaTime(long) does work on Nokias, the only MMAPI phone we found not to support this is the Motorola Triplets which actually throws an exception.

Try performing a rewind() on the midi before setting the media time, I think that should do it, if not consult Nokia documentation.
Reply With Quote

#4 Old 2005-01-17, 10:46

Join Date: Nov 2004
Posts: 16
pipicao
Offline
Registered User
why you do the deallocate()???
the player will back to UNREALIZED State!!!
Please read the MIDP2.0 Doucment
The following methods must not be used when the Player is in the UNREALIZED state.

getContentType
setMediaTime
getControls
getControl
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