3rd Audio Effect Api

Login to reply to this topic.
Tue, 2007-07-03 13:51
Joined: 2007-07-03
Forum posts: 5

Can you explain me, 3rd ed. audioeffect api. Example Loudness effect.
How can i use this effect?
Thanks.


Fri, 2007-09-21 09:39
Joined: 2007-09-20
Forum posts: 95
Re: 3rd Audio Effect Api

Hi,

You can create the instance of the desired effect with appropriate call of NewL().

CMdaAudioPlayerUtility* iPlayer = CMdaAudioPlayer::NewFilePlayer(<parameters>);
//Creating the effect
TRAPD(err,CLoudness* iLoudness =  CLoudness::NewL(iPlayer,ETrue /*Enable this effect*/ ));
if(err != KErrNone)
{
//Handle error
}
iLoudness->RegisterObserver(*iMAudioEffectObserver);// Observer inherits "MAudioEffectObserver".
iLoudness->EnforceL(ETrue);  //This is required only if the effect is mandatory.
//Applying the effect settings. Enable before applying...
TRAP(err,iLoudness->EnableL());
//Handle error

TRAP(err,iLoudness->ApplyL());
//Handle error


//When done Disable the effect
TRAP(err,iLoudness->DisableL());
iLoudness->UnregisterObserver(iMAudioEffectObserver);
delete iLoudness;

For more information you can refer to Effects API Specification Document.
Hope it helps Smiling

Chao,
Ravi


Chao,
Raghav

Fri, 2007-11-02 19:55
Joined: 2007-07-03
Forum posts: 5
Re: 3rd Audio Effect Api

Thank you very much. I will try as soon as possible.
Best Regards.

Tue, 2007-11-06 10:03
Joined: 2007-07-03
Forum posts: 5
Re: 3rd Audio Effect Api

I did my effect engine, build succesfull but effect doesn't run. I am sending you my program can you examine my mistake? Thank you very much.
I can post my project completely if you want.
Best Regards.

AttachmentSize
AudioPlayerEngine.cpp4.65 KB
AudioPlayerContainerView.cpp13.41 KB
AudioPlayerEngine.h3.89 KB
AudioPlayerContainerView.h3.35 KB
Tue, 2007-11-06 18:45
Joined: 2007-09-20
Forum posts: 95
Re: 3rd Audio Effect Api

Hi Cevy,

There are a few points that are not clear to me after going through the code.
The pointer iMAudioEffectObserver and iAudioEffect are not initialized and used in the code.

The effects have to be created by calling their "NewL()" methods and not by inheriting them.

Now the effects are instantiated by passing to them an instance of CMdaAudioPlayerUtility.

The modified files are attached here with.

Best of luck and let us know about the result.

Chao,
Ravi

AttachmentSize
AudioPlayerEngine.h4.55 KB
AudioPlayerEngine.cpp5.6 KB

Chao,
Raghav

Wed, 2007-11-07 15:04
Joined: 2007-07-03
Forum posts: 5
Re: 3rd Audio Effect Api

Very very Thanks.
You are genius.
At least effects were worked. I guess N73 is not support BassBoost effect,because when i activate bassboost effect, it seem a notification "Feature Not supported" ,
but loudness and stereowidening effects are OKEY.

Very Very Thanks You for BIG HELPING.

Best Regards.

Fri, 2007-11-23 10:34
Joined: 2007-11-23
Forum posts: 3
Re: 3rd Audio Effect Api

Did you try CAudioEqulization effect in N73?

I tried it in my N80 phone. I scceeded calling CAudioEqulizatoin::NewL(), CAudioEqulization::NumberOfBands() and CAudioEqulization::DbLevelLimits(). However, when I called CAudioEqulization::BandLevel() or CAudioEqulization::SetBandLevelL(), it leaved and my app exit.

Could you please help me check the following code:

void CEQController::ConstructL(CMdaAudioPlayerUtility* aPlayer)
{
iAudioEqualizer = CAudioEqualizer::NewL(*aPlayer, EFalse);
TRACEF(CMyLog::VA(_L("ConstructL iAudioEqualizer: %x"), iAudioEqualizer));

iAudioEqualizer->RegisterObserverL(*this);
TRACEF(CMyLog::VA(_L("RegisterObserverL")));

iAudioEqualizer->EnableL();

TInt bandNum;
TInt32 levelMin, levelMax;

bandNum = iAudioEqualizer->NumberOfBands();
iAudioEqualizer->DbLevelLimits(levelMin, levelMax);
TRACEF(CMyLog::VA(_L("bandNum: %i, levelMin: %i, levelMax, %i"), bandNum, levelMin, levelMax));

for (TInt i = 0; i < bandNum; i++)
{
iAudioEqualizer->SetBandLevelL(i, levelMin + (levelMax-levelMin)/2);
iAudioEqualizer->ApplyL();
TRACEF(CMyLog::VA(_L("SetBandLevel: %i"), iAudioEqualizer->BandLevel(i)));
}
}

Mon, 2007-11-26 10:38
Joined: 2007-09-20
Forum posts: 95
Re: 3rd Audio Effect Api

Hi,

The band number starts from "1" to "max_bands" (normal people's counting).
Just change the counting method i.e; from developer's counting to normal counting.

for (TInt i = 1; i <= bandNum; i++)
{
iAudioEqualizer->SetBandLevelL(i, levelMin + (levelMax-levelMin)/2);
iAudioEqualizer->ApplyL();
TRACEF(CMyLog::VA(_L("SetBandLevel: %i"), iAudioEqualizer->BandLevel(i)));
}

Please do update us about the result.


Chao,
Raghav

Mon, 2007-11-26 15:25
Joined: 2007-11-23
Forum posts: 3
Re: 3rd Audio Effect Api

Raghav,

Thank you very much. Your hint really avoid the leave which has been puzzling me for several weeks.

Code snippet:

TInt CEQEffector::ApplyEQ(TInt aIdx)
{
        TInt8 i;
        TInt Level, bandNum = NumberOfBands();
        TInt32 LevelMax, LevelMin;
        DbLevelLimits(LevelMin, LevelMax);       
        TRACEF(CMyLog::VA(_L("EQ band: %i level: %i, %i"), bandNum, LevelMin, LevelMax));

                     iAudioEqualizer->EnableL();

        for(i = 1; i <= bandNum; i++)
        {
                iAudioEqualizer->SetBandLevelL(i, 0);
                TRACEF(CMyLog::VA(_L("EQ set level: %i, %i"), i, LevelMin + i*(LevelMax-LevelMin)/bandNum));
                iAudioEqualizer->ApplyL();
                Level = iAudioEqualizer->BandLevel(i);
                TRACEF(CMyLog::VA(_L("EQ band level: %i, %i"), i, Level));
        }
}

Log:
22:11:33 EQ band: 5 level: -600, 600
22:21:33 EQ set level: 1, -360
22:21:33 EQ band level: 1, -360
22:21:33 EQ set level: 2, -120
22:21:33 EQ band level: 2, -120
22:21:33 EQ set level: 3, 120
22:21:33 EQ band level: 3, 120
22:21:33 EQ set level: 4, 360
22:21:33 EQ band level: 4, 360
22:21:33 EQ set level: 5, 600
22:21:33 EQ band level: 5, 600

Thu, 2008-02-07 17:31
Joined: 2006-08-25
Forum posts: 2
Re: 3rd Audio Effect Api

Hi,

I also try to use CAudioEqualizer in my code.
Some different is that I use function
"static IMPORT_C CAudioEqualizer * NewL (CMdaAudioOutputStream &aUtility)"
to create it, instead of
"static IMPORT_C CAudioEqualizer * NewL (CMdaAudioPlayerUtility &aUtility) ".
But I failed to created it on real phone E60 and N73, and the error code is -5, "KErrNotSupported".

Please help.
Thanks in advance.

Code snippet:

In class CAudioEngine:

void CAudioEngine::PlayL()
{
        iAudioStreamPlayer = CMdaAudioOutputStream::NewL(*this);
        iAudioStreamPlayer -> Open(&iSettings);
        iEQController = CEQController::NewL(*iAudioStreamPlayer);
        ......
}

(I also try to create iEQController in function "void CAudioEngine::MaoscOpenComplete" and other places, but all failed)

in Class CEQController:

class CEQController : public CBase, MAudioEqualizerObserver
{
public: // Constructors and destructor
        ~CEQController();
        static CEQController* NewL(CMdaAudioOutputStream &aUtility);
        static CEQController* NewLC(CMdaAudioOutputStream &aUtility);

public: //
        // Set Audio Equalizer
        TBool SetEqualizer(TUint8 aMode);

protected:
        // From base class: MAudioEqualizerObserver
        void EffectChanged (const CAudioEffect *aObservedEffect, TUint8 aEvent);

private:
        CEQController();
        void ConstructL(CMdaAudioOutputStream &aUtility);
private: // Data
        CAudioEqualizer*                iAudioEQ;

......
};

void CEQController::ConstructL(CMdaAudioOutputStream &aUtility)
{
        TRAPD( err, iAudioEQ = CAudioEqualizer::NewL(aUtility) );
        if (err != KErrNone)
        {
                // On E60 and N73, Here reported err = -5, KErrNotSupported
        }
        else
        {
                iAudioEQ->RegisterObserverL(*this);
                //TRAP( err, iAudioEQ->EnableL() );
                iNumOfBands = iAudioEQ->NumberOfBands();
                iAudioEQ->DbLevelLimits(iDbLevelMin, iDbLevelMax);
        }
}

  • Login to reply to this topic.