You Are Here:

Community: Developer Discussion Boards

#1 Old Question Camera Shutter Sound - 2006-02-28, 08:09

Join Date: Aug 2005
Posts: 67
Location: Venice, California
Send a message via Yahoo to davidmanpearl
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");
returns a number of formats, including "audio/wav".

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) {
}
Note: the following code works in Prototype_2_0_S60_MIDP_Emulator, but not in the 6682 handset.

Code:
	// Player p = Manager.createPlayer("/camera.wav");
Or, is there a way to cause the camera's shutter sound to play?

Nokia 6682, J2ME.

- Thanks, David Manpearl <dmanpearl_at_imatte_dot_com>
Last edited by davidmanpearl : 2006-02-28 at 10:26.
Reply With Quote

#2 Old Re: Camera Shutter Sound - 2006-02-28, 08:33

Join Date: Aug 2004
Posts: 802
Location: Hyderabad,India
S.S.Sudhakar's Avatar
S.S.Sudhakar
Offline
Super Contributor
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
Reply With Quote

#3 Old Re: Camera Shutter Sound - 2006-02-28, 13:09

Join Date: Feb 2006
Posts: 689
soku123
Offline
Super Contributor
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
Reply With Quote

#4 Old Re: Camera Shutter Sound - 2006-02-28, 18:10

Join Date: Aug 2005
Posts: 67
Location: Venice, California
Send a message via Yahoo to davidmanpearl
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
Reply With Quote

#5 Old Smile Re: Camera Shutter Sound - 2006-03-01, 00:15

Join Date: Aug 2005
Posts: 67
Location: Venice, California
Send a message via Yahoo to davidmanpearl
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 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
Similar Threads
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

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