Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 12:06, 26 November 2007.

How to implement camera snap sound in s60 device?

From Forum Nokia Wiki

The most effective way to play the snap sound is to use the CAknKeySoundSystem class. The following code example explains how to implement the feature in your own application:

myapp.h

#include <aknsoundsystem.h>
 
const TInt KSnapSoundId = 2;
 
class MyClass
  {
  ...
 
private:
 
  CAknKeySoundSystem* iCameraSound;
 
  };

myapp.cpp

void MyClass::ConstructL()
 
  {
 
  ...
 
  iCameraSound =
 
   static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi())->KeySounds();
 
    if (iCameraSound)
 
        {
 
        TRAPD(error, iCameraSound->AddAppSoundInfoListL(
 
              R_CAMERA_SNAP_SOUND));
 
        if ((error != KErrAlreadyExists) && (error != KErrNone))
 
            {
 
            User::LeaveIfError(error);
 
            }
 
        }
 
  }
 
void MyClass::PlaySnapSound()
 
  {
 
  iCameraSound->PlaySound(KSnapSoundId);
 
  }

Also add the following code into your application's resource .rss

#define KcameraSoundFile
 
    "Z:\\system\\sounds\\digital\\Camera1a_2_8kHz.wav"
 
#define KSnapSoundId 2
 
RESOURCE AVKON_SOUND_INFO_LIST r_camera_snap_sound
 
    {
 
    list =
 
         {
 
        AVKON_SOUND_INFO
 
           {
 
            sid = KSnapSoundId;
 
            priority = 45;
 
            preference = EAknAudioPrefCamera; // defined in avkon.hrh
 
            file = KCameraSoundFile;
 
            }
 
        };
 
    }
Related Discussions
Thread Thread Starter Forum Replies Last Post
2.0 SDK documentation Correction: SNAP-Mobile-URLs JAD parameter staceyduke SNAP Mobile 0 2008-05-21 18:56
Help bo_shen Mobile Java General 3 2003-10-08 09:54
Remote Camera Manager - S60 3rd edition pspickett General Discussion 0 2006-12-18 07:02
previous camera autofocus lib can not work in S60 3.2 whitewinds Symbian Media (Graphics & Sounds) 1 2008-02-19 08:02
7600 cam sound nmscl General Discussion 0 2004-12-06 15:58
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZaudioQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX