Adding doppler effects to the audio player in Symbian C++
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData) |
hamishwillee
(Talk | contribs) 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 | ||
| − | |||
| − | |||
|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= | + | |signing=Self-Signed |
| − | |capabilities= | + | |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 | + | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
Revision as of 04:08, 28 October 2011
Article Metadata
Tested with
Compatibility
Platform Security
Article
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
See also
- CS001131 - Adding source 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
- CS001135 - Adding reverb to the audio player
- CS001136 - Adding equalizer to the audio player

