Nokia's mobile phone does not seem to support sound playback.
This article summarizes the sound playback methods of the three Nokia models based on my experience in using j2m3.
1. Nokia S40 (7210,3300) and S60 (3650,7650)
/*
These four models do not support MIDP2.0 media.
I only describe the models I have done. Other models do not use real machine tests,
I wonder if media in MIDP2.0 is supported
*/
Import com. nokia. mid. sound .*;
Public class MyClass extends Canvas
{
......
Private Sound kSound = null;
Private byte [] dataKill = {
(Byte) 0x02, (byte) 0x4a, (byte) 0x3a, (byte) 0x40,
(Byte) 0x04, (byte) 0x00, (byte) 0x0b, (byte) 0x28,
(Byte) 0x83, (byte) 0x28, (byte) 0x28, (byte) 0xd2,
(Byte) 0x28, (byte) 0x00
};
Private Fun ()
{
If (kSound! = Null)
{
KSound. stop ();
KSound = null;
}
KSound = new Sound (dataKill, Sound. FORMAT_TONE );
KSound. setGain (255); // sets the volume.
KSound. play (1); // play, loop once
}
} // End MyClass.
/*
Note:
1. About how to obtain the dataKill data.
First, you must have a midi audio file;
Next, we need nokia's nokia_developers_suite_for_j2.
Use audio converter in this tool to convert the midi file into byte data.
Then copy the obtained data to your code.
2. About how WTK uses the lib of nokia.
Development Tool Directory in nokia
.. NokiaDevicesNokia_7210_MIDP_SDK_v1_0lib or
.. NokiaDevicesSeries_60_MIDP_Concept_SDK_Beta_0_3_Nokia_editionlib
Find class.zip. Open, find the Sound. class, decompress it, and you will be able to get comokiauiSoundsound. class,
Then, package the entire directory into a zip file and put it under the lib of your project. That's all.
Directly upload the class.zip file to the lib directory.
Compile the package with wtk, open your jar file, and put the com folder containing sound. class
Delete the file, and modify the jar-size in jad according to the actual situation.
OK.
This is what I did, and the trouble is very troublesome. But I really don't want to use JBuilder.
I don't know if there are any simpler methods.
*/
2. Nokia 7610
/* This model supports MIDP2.0 */
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.