×
Namespaces

Variants
Actions

我怎样可以在使用摄像头拍照的时候添加一个快门的

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
User:Jiangbaolan 在 02 Apr 2009 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

使用CAknKeySoundSystem类将会在摄像头捕捉籣面的 时候播放声音方面是一个很有效的方法。下面的代码 演示了如何在你的应用程序中实现这个特性:

Code: // myapp.h

  1. include <aknsoundsystem.h>

const TInt KSnapSoundId = 2;

class MyClass

 {
 ...

private:

 CAknKeySoundSystem* iCameraSound;
 };

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);
 }在你的.RSS资源文件中添加下面的代码

Code:

  1. define KcameraSoundFile
   "Z:\\system\\sounds\\digital\\Camera1a_2_8kHz.wav"
  1. 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;
           }
       };
   }
This page was last modified on 15 December 2011, at 09:36.
23 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×