Namespaces
Variants
Actions
(Difference between revisions)

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

Jump to: navigation, search
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
m (Hamishwillee - Update ArticleMetaData. Minor subedit)
Line 1: Line 1:
 +
[[Category:Symbian C++]][[Category:Code Examples]][[Category:Multimedia]][[Category:Audio]][[Category:Code Snippet]]
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
Line 6: Line 7:
 
|platform=S60 3rd Edition
 
|platform=S60 3rd Edition
 
|devices=Nokia N95
 
|devices=Nokia N95
|category=Symbian C++
 
|subcategory=Audio
 
 
|creationdate=October 9, 2008
 
|creationdate=October 9, 2008
 
|keywords=CSourceDoppler
 
|keywords=CSourceDoppler
 
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|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]) -->
 
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
+
|signing=Self-Signed
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)
+
|capabilities=None
 
|author=[[User:Technical writer 1]]
 
|author=[[User:Technical writer 1]]
 
}}
 
}}
 
  
 
==Overview==
 
==Overview==
Line 30: Line 27:
  
 
The audio player must be fully constructed before constructing the instance of the API. This can be done with the following lines of code:
 
The audio player must be fully constructed before constructing the instance of the API. This can be done with the following lines of code:
<code>
+
<code cpp>
 
  iMdaAudioPlayerUtility =
 
  iMdaAudioPlayerUtility =
 
   CMdaAudioPlayerUtility::NewFilePlayerL( aFileName,  
 
   CMdaAudioPlayerUtility::NewFilePlayerL( aFileName,  
Line 42: Line 39:
 
The following capabilities and libraries are required:
 
The following capabilities and libraries are required:
  
CAPABILITY NONE
+
CAPABILITY NONE
 
+
LIBRARY    DopplerBase.lib   
LIBRARY    DopplerBase.lib   
+
HEADER  SourceDopplerBase.h
 
+
HEADER  SourceDopplerBase.h
+
  
  
Line 52: Line 47:
  
 
First you need to construct the reverb utility instance:
 
First you need to construct the reverb utility instance:
<code>
+
<code cpp>
 
  iDopplerEffect = CSourceDoppler::NewL( *iMdaAudioPlayerUtility );
 
  iDopplerEffect = CSourceDoppler::NewL( *iMdaAudioPlayerUtility );
 
</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 <tt>FactorMax()</tt>. After this, you can enable and apply the effect to the player.
<code>
+
<code cpp>
 
   iDopplerEffect->SetFactorL(iDopplerEffect->FactorMax());
 
   iDopplerEffect->SetFactorL(iDopplerEffect->FactorMax());
 
      
 
      
Line 69: Line 64:
  
 
To set the source location effect off, just call the following line of code:
 
To set the source location effect off, just call the following line of code:
<code>
+
<code cpp>
 
  iDopplerEffect->DisableL();
 
  iDopplerEffect->DisableL();
 
</code>  
 
</code>  
Line 80: Line 75:
 
==See also==
 
==See also==
  
[[CS001131 - Adding source location effects to the audio player]]  
+
* [[CS001131 - Adding source location effects to the audio player]]  
 
+
* [[CS001132 - Adding listener's location effects to the audio player]]  
[[CS001132 - Adding listener's location effects to the audio player]]  
+
* [[CS001133 - Adding bass boost to the audio player]]  
 
+
* [[CS001134 - Adding stereo widening to the audio player]]
[[CS001133 - Adding bass boost to the audio player]]  
+
* [[CS001135 - Adding reverb to the audio player]]
 
+
* [[CS001136 - Adding equalizer to the audio player]]
[[CS001134 - Adding stereo widening to the audio player]]
+
 
+
[[CS001135 - Adding reverb to the audio player]]
+
 
+
[[CS001136 - Adding equalizer to the audio player]]
+
 
+
[[Category:Symbian C++]]
+
[[Category:Code Examples]]
+
[[Category:Multimedia]]
+
[[Category:Audio]]
+
[[Category:Code Snippet]]
+

Revision as of 04:08, 28 October 2011

Template:KBCS

MultiMediaTile.png
Article Metadata

Tested 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 (28 Oct 2011)

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

142 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved