| Reply | « Previous Thread | Next Thread » |
|
Join Date: Aug 2005
Posts: 67
Location: Venice, California
davidmanpearl
Offline
Regular Contributor
|
|
I have a camera shutter sound, camera.wav. Copied to the Nokia 6682 it plays correctly when manually opened from the Gallery. I am trying to make it play within my MIDlet as installed in the root of the .jar.
First of all, Code:
System.getProperty("audio.encodings");
I have tried various unsuccessful methods of playing this sound, including: Code:
try {
InputStream is = getClass().getResourceAsStream("/camera.wav");
Player p = Manager.createPlayer(is, "audio/wav");
p.realize();
// get volume control for player and set volume to max
VolumeControl vc = (VolumeControl) p.getControl("VolumeControl");
if(vc != null) {
vc.setLevel(100);
vc.setMute(false);
}
// the player can start with the smallest latency
p.prefetch();
p.start();
} catch(IOException ioe) {
} catch(MediaException me) {
}
Code:
// Player p = Manager.createPlayer("/camera.wav");
Nokia 6682, J2ME. - Thanks, David Manpearl <dmanpearl_at_imatte_dot_com>
Last edited by davidmanpearl : 2006-02-28 at 10:26.
|
|
In case of Symbain C++ Z:\\system\\sounds\\digital\\Camcordercapture.wav is available for Snap Sound(For Nokia 6630).
May be similar sound file you have to get and play at the time of taking Snap. BR, SSS |
| S.S.Sudhakar |
| View Public Profile |
| Find all posts by S.S.Sudhakar |
|
Hi,
if u r playing a sound file from .jar,u have to specify the resource folder along with the sound file.that is the get resource as stream will have the parameters(res/camera.wav). Regards Soku |
|
Join Date: Aug 2005
Posts: 67
Location: Venice, California
davidmanpearl
Offline
Regular Contributor
|
|
Hello again Soku, thank you for your response.
I still cannot play this sound. To satisfy your suggestion, I created a new "res" folder at the root level in my Eclipse development project. I moved the sound file from the root level into the res folder. Accessing the file as "/res/camera.wav" instead of "/camera.wav" produces the same result... no sound. No exceptions are thrown and the 'InputStream is' is non-null. I now also verify that 'Player p' and 'VolumeControl vc' are non-null. I am certain that the file is found because a particular exception is thrown when I intentionally misspell the path. All of this testing is done with same results in the 6682 handset as well as with the emulator. - Sincerely, David |
|
Join Date: Aug 2005
Posts: 67
Location: Venice, California
davidmanpearl
Offline
Regular Contributor
|
|
Problem is resolved.
Scope of Player object must persist throughout duration of play and start() is not blocking. Fixed by declaring InputStream and Player at a higher level instead of within function. Added benefit is realize(),prefetch(), which shortens setup and allows quick start() before data capture without appreciable delay after user presses shutter button. - Regards, David |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Nokia N70 Camera Shutter & Media Key Problem!!! | joshua_dsouza86 | General Discussion | 0 | 2006-01-30 09:31 |
| Be carefull using camera sound! (Example in Nokia Known Issues is dangerous) | shaffex | General Symbian C++ | 0 | 2005-11-21 00:20 |
| Problem with Sound class getState() | creepymo | Mobile Java Media (Graphics & Sounds) | 1 | 2005-06-20 19:43 |
| MIDI Sound problem (J2ME / Series 60) | JPapke | Mobile Java Media (Graphics & Sounds) | 2 | 2004-10-29 09:17 |
| sound bug (possibly) on 6610 | alex_crowther | Mobile Java Media (Graphics & Sounds) | 2 | 2004-02-05 12:44 |