You Are Here:

Community: Developer Discussion Boards

#1 Old Nokia Smart Expert - solve this sound problem - 2003-10-30, 05:36

Join Date: Mar 2003
Posts: 12
tsoh_tan
Offline
Registered User
hi,

I tried to cut a long byte array into few blocks. Because of the device limitation so i have to do so.

Now i have 2 blocks of byte arrays with the duration each is 20 seconds.

So i intend to play one by one after the one block is finished. If i implements the SoundListener to catch the sound state change to play the next block, it took about 2 seconds to play the second block of the byte array.

So i schedule every 19 seconds force to stop the playing byte array and play the second block of byte array.

Now i having another problem which is weird thing and not able to know why is play so

Base on the code and log below, did anyone know how to solve it.

Here is my code
byte[] data1 = {.............};
byte[] data 2 = {.....};

queue.addElement(data1);
queue.addElement(data2);

private void PlaySong(boolean bStart)
{
try
{
if (sound == null)
{
sound = new Sound(data1, 1);
sound.setSoundListener(this);
timerAnim = new Timer();
timerAnim.schedule(new StopPlay(),0, 19000);
}

sound.play(1);
}catch (Exception e)
{}

}


public void soundStateChanged(Sound sound, int event)
{
System.out.println("Sound Event " + event);
System.out.println("Empty Q " + queue.isEmpty());
if ((event ==Sound.SOUND_STOPPED) && !queue.isEmpty())
{ System.out.println("Play 1");
byte[] adata = (byte[])(queue.elementAt(0));
queue.removeElementAt(0);
System.out.println("Play 2");
sound.init(adata,Sound.FORMAT_TONE);
System.out.println("Play 3");
sound.play(1);
System.out.println("Play 4");

}
}


public class StopPlay extends TimerTask
{

public void run()
{
System.out.println("Im on fire");
if (sound != null)
sound.stop();
}
}


My Log

Im on fire
Sound Event 0
Empty Q false
Im on fire
Sound Event 1
Empty Q false
Play 1
Play 2
Sound Event 3
Empty Q false
Sound Event 1
Empty Q false
Play 1
Play 2
Sound Event 1
Empty Q true
Play 3
Sound Event 0
Empty Q true
Play 4
Play 3
Sound Event 0
Empty Q true
Play 4
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