satui/satapp/src/satappplaytoneprovider.cpp
changeset 27 7eb70891911c
parent 15 d7fc66ccd6fb
equal deleted inserted replaced
23:427125ac6cb8 27:7eb70891911c
    19 // PlayStandardTone
    19 // PlayStandardTone
    20 #include    <MProfile.h>
    20 #include    <MProfile.h>
    21 #include    <MProfileEngine.h>
    21 #include    <MProfileEngine.h>
    22 #include    <MProfileTones.h>
    22 #include    <MProfileTones.h>
    23 #include    <TProfileToneSettings.h>
    23 #include    <TProfileToneSettings.h>
    24 #include    <audiopreference.h>//KAudioPriorityLowLevel
    24 #include    <AudioPreference.h> //KAudioPriorityLowLevel
    25 #include    <Mda/Common/Resource.h>//KMdaRepeatForever
    25 #include    <mda/common/resource.h>//KMdaRepeatForever
    26 #include    <QTimer> // timeout callback
    26 #include    <QTimer> // timeout callback
    27 #include    <hbmessagebox.h>//playtone note
    27 #include    <hbmessagebox.h>//playtone note
    28 #include    <mdaaudiotoneplayer.h>// for CMdaAudioToneUtility&CMdaAudioPlayerUtility
    28 #include    <mdaaudiotoneplayer.h>// for CMdaAudioToneUtility&CMdaAudioPlayerUtility
    29 #include    <e32std.h>//TTimeIntervalMicroSeconds
    29 #include    <e32std.h>//TTimeIntervalMicroSeconds
    30 
    30 
    37 const TInt KMaxSoundFileLength = 256;
    37 const TInt KMaxSoundFileLength = 256;
    38 // Used when dividing some values. Used only for preventing the use of magic 
    38 // Used when dividing some values. Used only for preventing the use of magic 
    39 // numbers
    39 // numbers
    40 // Audio sample is repeated indefinitely.
    40 // Audio sample is repeated indefinitely.
    41 const TInt KSoundPlayerRepeatForever = KMdaRepeatForever;
    41 const TInt KSoundPlayerRepeatForever = KMdaRepeatForever;
       
    42 
       
    43 // The max volume value from settings.
       
    44 // From TProfileToneSettings.h
       
    45 const TInt KMaxVolumeFromProfile( 10 );
       
    46 
    42 
    47 
    43 // ----------------------------------------------------------------------------
    48 // ----------------------------------------------------------------------------
    44 // SatAppPlayToneProvider::SatAppPlayToneProvider
    49 // SatAppPlayToneProvider::SatAppPlayToneProvider
    45 // (other items were commented in a header).
    50 // (other items were commented in a header).
    46 // ----------------------------------------------------------------------------
    51 // ----------------------------------------------------------------------------
   218 
   223 
   219     // Takes a current warning and gametones setting.
   224     // Takes a current warning and gametones setting.
   220     const TProfileToneSettings& ts = tones.ToneSettings();
   225     const TProfileToneSettings& ts = tones.ToneSettings();
   221     mWarningAndPlayTones = ts.iWarningAndGameTones;
   226     mWarningAndPlayTones = ts.iWarningAndGameTones;
   222     mVolume = ts.iRingingVolume;
   227     mVolume = ts.iRingingVolume;
       
   228     
       
   229     TFLOGSTRING2( "SatAppCommandHandler::GetProfileParamsL \
       
   230         mVolume before mapping %d", mVolume )
       
   231     
       
   232     // Max volume from profile is KMaxVolumeFromProfile, Max volume from 
       
   233     // CMdaAudioToneUtility is different, maybe 10,000. So, 
       
   234     // rate = maxVolumeFromPlayer / KMaxVolumeFromProfile
       
   235     // User may never hear the TONE, because volume is too small.
       
   236     // iVolume times the rate make it can be heard.
       
   237     
       
   238     CMdaAudioToneUtility* toneUtl = CMdaAudioToneUtility::NewL( *this );
       
   239     TInt maxVolumeFromPlayer( toneUtl->MaxVolume() );
       
   240     mVolume *= maxVolumeFromPlayer / KMaxVolumeFromProfile;
       
   241     delete toneUtl;
       
   242     toneUtl = NULL;
       
   243     TFLOGSTRING2( "CSatUiViewAppUi::GetProfileParamsL \
       
   244         mVolume after mapping %d", mVolume )
       
   245     
   223     if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) )
   246     if ( ( ESatUserSelectedToneIncomingSms == aTone ) && ( aToneName ) )
   224         {
   247         {
   225         TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL message tone")
   248         TFLOGSTRING("SatAppCommandHandler::GetProfileParamsL message tone")
   226         aToneName->Copy( tones.MessageAlertTone() );
   249         aToneName->Copy( tones.MessageAlertTone() );
   227     } else if( aToneName ) {
   250     } else if( aToneName ) {