×
Namespaces

Variants
Actions
(Difference between revisions)

Adding doppler effects to the audio player in Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Merge KB into wiki)
Line 1: Line 1:
 
[[Category:Symbian C++]][[Category:Code Examples]][[Category:Multimedia]][[Category:Audio]][[Category:Code Snippet]]
 
[[Category:Symbian C++]][[Category:Code Examples]][[Category:Multimedia]][[Category:Audio]][[Category:Code Snippet]]
__NOTOC__
+
{{ArticleMetaData <!-- v1.2 -->
__NOEDITSECTION__
+
|sourcecode= [[Media:3D AudioEfects.zip]]  
{{KBCS}}
+
{{ArticleMetaData
+
|id=CS001130
+
|platform=S60 3rd Edition
+
|devices=Nokia N95
+
|creationdate=October 9, 2008
+
|keywords=CSourceDoppler
+
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
+
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= Nokia N95
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=Self-Signed
+
|platform= S60 3rd Edition
|capabilities=None
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Technical writer 1]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= Self-Signed
 +
|capabilities= None
 +
|keywords= CSourceDoppler
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20081009
 +
|author= [[User:Technical writer 1]]
 +
<!-- The following are not in current metadata -->
 +
|id= CS001130
 
}}
 
}}
  
Line 40: Line 47:
  
 
  CAPABILITY NONE
 
  CAPABILITY NONE
  LIBRARY   DopplerBase.lib   
+
  LIBRARY DopplerBase.lib   
  HEADER SourceDopplerBase.h
+
  HEADER SourceDopplerBase.h
  
  
Line 51: Line 58:
 
</code>  
 
</code>  
  
To set the doppler effect on, you need to set the doppler effect factor. The factor needs to be between 0 and <tt>FactorMax()</tt>. After this, you can enable and apply the effect to the player.
+
To set the doppler effect on, you need to set the doppler effect factor. The factor needs to be between 0 and {{Icode|FactorMax()}}. After this, you can enable and apply the effect to the player.
 
<code cpp>
 
<code cpp>
 
   iDopplerEffect->SetFactorL(iDopplerEffect->FactorMax());
 
   iDopplerEffect->SetFactorL(iDopplerEffect->FactorMax());
Line 71: Line 78:
 
==Test application ==
 
==Test application ==
  
[[Image:3D_AudioEfects.zip]]
+
[[File:3D AudioEfects.zip]]
  
 
==See also==
 
==See also==

Revision as of 04:54, 14 June 2012

Article Metadata
Code ExampleTested with
Devices(s): Nokia N95
Compatibility
Platform(s): S60 3rd Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Article
Keywords: CSourceDoppler
Created: User:Technical writer 1 (09 Oct 2008)
Last edited: hamishwillee (14 Jun 2012)

Contents

Overview

The S60 platform has several audio enhancement APIs that can be used to modify the audio experience. One of them is the CSourceDoppler API. This API makes the audio source appear to either move towards or away from the listener.

This snippet can be self-signed.

Preconditions

The audio player must be fully constructed before constructing the instance of the API. This can be done with the following lines of code:

 iMdaAudioPlayerUtility =
CMdaAudioPlayerUtility::NewFilePlayerL( aFileName,
*this,
EMdaPriorityNormal,
EMdaPriorityPreferenceTimeAndQuality);

MMP file

The following capabilities and libraries are required:

CAPABILITY NONE
LIBRARY DopplerBase.lib   
HEADER SourceDopplerBase.h


Source file

First you need to construct the reverb utility instance:

 iDopplerEffect = CSourceDoppler::NewL( *iMdaAudioPlayerUtility );

To set the doppler effect on, you need to set the doppler effect factor. The factor needs to be between 0 and FactorMax(). After this, you can enable and apply the effect to the player.

  iDopplerEffect->SetFactorL(iDopplerEffect->FactorMax());
 
if(!iDopplerEffect ->IsEnabled())
iDopplerEffect ->EnableL();
 
iDopplerEffect ->ApplyL();

You can also add a 3D effect by using a timer that periodically changes the effect factor of the effect.

To set the source location effect off, just call the following line of code:

 iDopplerEffect->DisableL();


Test application

File:3D AudioEfects.zip

See also

93 page views in the last 30 days.
×