mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp
changeset 12 5a06f39ad45b
child 16 43d09473c595
equal deleted inserted replaced
0:71ca22bcf22a 12:5a06f39ad45b
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 //  INCLUDE FILES
       
    19 
       
    20 #include <tms.h>
       
    21 #include <AudioPreference.h>
       
    22 #include <barsc.h>
       
    23 #include <barsread.h>
       
    24 #include <data_caging_path_literals.hrh>
       
    25 #include <defaultbeep.rsg>
       
    26 #include "tmsutility.h"
       
    27 #include "tmsaudioinbandtoneplayer.h"
       
    28 #include "tmsaudiotoneutilityimpl.h"
       
    29 
       
    30 using namespace TMS;
       
    31 
       
    32 // CONSTANTS
       
    33 const TInt KPhoneInbandVolumeMax = 10;
       
    34 const TInt KPhoneInbandVolumeMin = 0;
       
    35 const TInt KPhoneInbandToneZero = 0;
       
    36 
       
    37 // Resourcefile destination.
       
    38 _LIT( KSystemDefaultbeepRscDrive, "Z:" );
       
    39 _LIT( KSystemDefaultbeepRscFile, "DEFAULTBEEP.rSC" );
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // TMSAudioInbandTonePlayer::NewL
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 TMSAudioInbandTonePlayer* TMSAudioInbandTonePlayer::NewL()
       
    47     {
       
    48     TMSAudioInbandTonePlayer* self =
       
    49             new (ELeave) TMSAudioInbandTonePlayer();
       
    50     CleanupStack::PushL(self);
       
    51     self->ConstructL( /*aAudioFactory*/);
       
    52     CleanupStack::Pop(self);
       
    53     return self;
       
    54     }
       
    55 
       
    56 //Destructor
       
    57 TMSAudioInbandTonePlayer::~TMSAudioInbandTonePlayer()
       
    58     {
       
    59     TRACE_PRN_FN_ENT;
       
    60     iFsSession.Close();
       
    61     delete iPlayBeepSequence;
       
    62     delete iPlayNoSoundSequence;
       
    63     delete iPlayDataSequence;
       
    64     delete iResourceCallWaitingSeq;
       
    65     delete iResourceRingGoingSeq;
       
    66     delete iResourceRadioPathSeq;
       
    67     delete iResourceSpecialSeq;
       
    68     delete iResourceCongestionSeq;
       
    69     delete iResourceReorderSeq;
       
    70     delete iResourceBusySeq;
       
    71     delete iCurrent;
       
    72     TRACE_PRN_FN_EXT;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer
       
    77 // C++ default constructor can NOT contain any code, that
       
    78 // might leave.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 TMSAudioInbandTonePlayer::TMSAudioInbandTonePlayer()
       
    82     {
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // TMSAudioInbandTonePlayer::ConstructL
       
    87 // Symbian 2nd phase constructor can leave.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 void TMSAudioInbandTonePlayer::ConstructL()
       
    91     {
       
    92     // iCurrent = aFactory.CreateAudioToneUtilityL( *this );
       
    93     TRACE_PRN_FN_ENT;
       
    94     iCurrent = TMSAudioToneUtilityImpl::NewL(*this);
       
    95 
       
    96     //Get the inband tone sequences from resource and and store to member
       
    97     //variables
       
    98     RResourceFile resourceFile;
       
    99 
       
   100     TFileName fileName(KSystemDefaultbeepRscDrive);
       
   101     fileName.Append(KDC_RESOURCE_FILES_DIR);
       
   102     fileName.Append(KSystemDefaultbeepRscFile);
       
   103 
       
   104     iFsSession.Connect();
       
   105     resourceFile.OpenL(iFsSession, fileName);
       
   106     CleanupClosePushL(resourceFile);
       
   107 
       
   108     HBufC8* resourceBusy = resourceFile.AllocReadL(R_NET_BUSY);
       
   109     HBufC8* resourceReorder = resourceFile.AllocReadL(R_NET_REORDER);
       
   110     HBufC8* resourceCongestion = resourceFile.AllocReadL(R_NET_CONGESTION);
       
   111     HBufC8* resourceSpecial = resourceFile.AllocReadL(
       
   112             R_NET_SPECIAL_INFORMATION);
       
   113     HBufC8* resourceRadioPath = resourceFile.AllocReadL(
       
   114             R_NET_RADIO_NOT_AVAILABLE);
       
   115     HBufC8* resourceRingGoing = resourceFile.AllocReadL(R_NET_RING_GOING);
       
   116     HBufC8* resourceCallWaiting = resourceFile.AllocReadL(R_NET_CALL_WAITING);
       
   117     HBufC8* dataCallTone = resourceFile.AllocReadL(R_DATA_CALL_TONE);
       
   118     HBufC8* noSoundSequence = resourceFile.AllocReadL(R_NO_SOUND_SEQUENCE);
       
   119     HBufC8* beepSequence = resourceFile.AllocReadL(R_BEEP_SEQUENCE);
       
   120 
       
   121     CleanupStack::PopAndDestroy(&resourceFile);
       
   122 
       
   123     TResourceReader reader;
       
   124     TInt i(0);
       
   125     TInt length(0);
       
   126 
       
   127     //SubscriberBusy
       
   128     reader.SetBuffer(resourceBusy);
       
   129     length = reader.ReadInt16();
       
   130     iResourceBusySeq = HBufC8::NewL(length);
       
   131     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   132     //edited by Append()
       
   133     TPtr8 appendBusy(iResourceBusySeq->Des());
       
   134 
       
   135     for (i = 0; i < length; i++)
       
   136         {
       
   137         appendBusy.Append(reader.ReadUint16());
       
   138         }
       
   139 
       
   140     //Reorder
       
   141     reader.SetBuffer(resourceReorder);
       
   142     length = reader.ReadInt16();
       
   143     iResourceReorderSeq = HBufC8::NewL(length);
       
   144     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   145     //edited by Append()
       
   146     TPtr8 appendReorder(iResourceReorderSeq->Des());
       
   147 
       
   148     for (i = 0; i < length; i++)
       
   149         {
       
   150         appendReorder.Append(reader.ReadUint16());
       
   151         }
       
   152 
       
   153     //Congestion
       
   154     reader.SetBuffer(resourceCongestion);
       
   155     length = reader.ReadInt16();
       
   156     iResourceCongestionSeq = HBufC8::NewL(length);
       
   157     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   158     //edited by Append()
       
   159     TPtr8 appendCongestion(iResourceCongestionSeq->Des());
       
   160 
       
   161     for (i = 0; i < length; i++)
       
   162         {
       
   163         appendCongestion.Append(reader.ReadUint16());
       
   164         }
       
   165 
       
   166     //Special Information
       
   167     reader.SetBuffer(resourceSpecial);
       
   168     length = reader.ReadInt16();
       
   169     iResourceSpecialSeq = HBufC8::NewL(length);
       
   170     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   171     //edited by Append()
       
   172     TPtr8 appendSpecial(iResourceSpecialSeq->Des());
       
   173 
       
   174     for (i = 0; i < length; i++)
       
   175         {
       
   176         appendSpecial.Append(reader.ReadUint16());
       
   177         }
       
   178 
       
   179     //RadioPathNotAvailable
       
   180     reader.SetBuffer(resourceRadioPath);
       
   181     length = reader.ReadInt16();
       
   182     iResourceRadioPathSeq = HBufC8::NewL(length);
       
   183     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   184     //edited by Append()
       
   185     TPtr8 appendRadio(iResourceRadioPathSeq->Des());
       
   186 
       
   187     for (i = 0; i < length; i++)
       
   188         {
       
   189         appendRadio.Append(reader.ReadUint16());
       
   190         }
       
   191 
       
   192     //RemoteAlertingTone
       
   193     reader.SetBuffer(resourceRingGoing);
       
   194     length = reader.ReadInt16();
       
   195     iResourceRingGoingSeq = HBufC8::NewL(length);
       
   196     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   197     //edited by Append()
       
   198     TPtr8 appendRingGoing(iResourceRingGoingSeq->Des());
       
   199 
       
   200     for (i = 0; i < length; i++)
       
   201         {
       
   202         appendRingGoing.Append(reader.ReadUint16());
       
   203         }
       
   204     //CallWaitingTone
       
   205     reader.SetBuffer(resourceCallWaiting);
       
   206     length = reader.ReadInt16();
       
   207     iResourceCallWaitingSeq = HBufC8::NewL(length);
       
   208     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   209     //edited by Append()
       
   210     TPtr8 appendCallWaiting(iResourceCallWaitingSeq->Des());
       
   211 
       
   212     for (i = 0; i < length; i++)
       
   213         {
       
   214         appendCallWaiting.Append(reader.ReadUint16());
       
   215         }
       
   216 
       
   217     //DataCalTone
       
   218     reader.SetBuffer(dataCallTone);
       
   219     length = reader.ReadInt16();
       
   220     iPlayDataSequence = HBufC8::NewL(length);
       
   221     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   222     //edited by Append()
       
   223     TPtr8 appendDataCallTone(iPlayDataSequence->Des());
       
   224 
       
   225     for (i = 0; i < length; i++)
       
   226         {
       
   227         appendDataCallTone.Append(reader.ReadUint16());
       
   228         }
       
   229 
       
   230     //NoSoundSequence
       
   231     reader.SetBuffer(noSoundSequence);
       
   232     length = reader.ReadInt16();
       
   233     iPlayNoSoundSequence = HBufC8::NewL(length);
       
   234     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   235     //edited by Append()
       
   236     TPtr8 appendNoSoundSequence(iPlayNoSoundSequence->Des());
       
   237 
       
   238     for (i = 0; i < length; i++)
       
   239         {
       
   240         appendNoSoundSequence.Append(reader.ReadUint16());
       
   241         }
       
   242 
       
   243     //BeepSequence
       
   244     reader.SetBuffer(beepSequence);
       
   245     length = reader.ReadInt16();
       
   246     iPlayBeepSequence = HBufC8::NewL(length);
       
   247     //Tptr modifies member variables (HBufC8) length so it includes the memory
       
   248     //edited by Append()
       
   249     TPtr8 appendBeepSequence(iPlayBeepSequence->Des());
       
   250 
       
   251     for (i = 0; i < length; i++)
       
   252         {
       
   253         appendBeepSequence.Append(reader.ReadUint16());
       
   254         }
       
   255 
       
   256     delete dataCallTone;
       
   257     delete noSoundSequence;
       
   258     delete beepSequence;
       
   259     delete resourceBusy;
       
   260     delete resourceReorder;
       
   261     delete resourceCongestion;
       
   262     delete resourceSpecial;
       
   263     delete resourceRadioPath;
       
   264     delete resourceRingGoing;
       
   265     delete resourceCallWaiting;
       
   266     TRACE_PRN_FN_EXT;
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // TMSAudioInbandTonePlayer::PlayInbandTone
       
   271 // Searches the given Inband tone from iToneArray and calls PlayCurrentTone.
       
   272 // -----------------------------------------------------------------------------
       
   273 //
       
   274 void TMSAudioInbandTonePlayer::PlayInbandTone(
       
   275 /*TCCPTone*/TMSInbandToneType aTone)
       
   276     {
       
   277     TRACE_PRN_FN_ENT;
       
   278     //Stop playing if there is something playing
       
   279     Cancel();
       
   280 
       
   281     UpdateTonePlayerVolume();
       
   282 
       
   283     iToneName = aTone;
       
   284 
       
   285     TPtr8 resourceBusySeq = iResourceBusySeq -> Des();
       
   286     TPtr8 resourceRadioPathSeq = iResourceRadioPathSeq -> Des();
       
   287     TPtr8 resourceCongestionSeq = iResourceCongestionSeq -> Des();
       
   288     TPtr8 resourceSpecialSeq = iResourceSpecialSeq -> Des();
       
   289     TPtr8 resourceReorderSeq = iResourceReorderSeq->Des();
       
   290     TPtr8 resourceRingGoingSeq = iResourceRingGoingSeq -> Des();
       
   291     TPtr8 resourceCallWaitingSeq = iResourceCallWaitingSeq -> Des();
       
   292 
       
   293     switch (aTone)
       
   294         {
       
   295         case TMS_INBAND_USER_BUSY://ECCPToneUserBusy:
       
   296             iCurrent->PrepareToPlayDesSequence(resourceBusySeq);
       
   297             break;
       
   298         case TMS_INBAND_RADIO_PATH_NOT_AVAIL://ECCPToneRadioPathNotAvailable:
       
   299             iCurrent->PrepareToPlayDesSequence(resourceRadioPathSeq);
       
   300             break;
       
   301         case TMS_INBAND_CONGESTION://ECCPToneCongestion:
       
   302             iCurrent->PrepareToPlayDesSequence(resourceCongestionSeq);
       
   303             break;
       
   304         case TMS_INBAND_SPECIAL_INFO://ECCPToneSpecialInformation:
       
   305             iCurrent->PrepareToPlayDesSequence(resourceSpecialSeq);
       
   306             break;
       
   307         case TMS_INBAND_REORDER://ECCPReorder:
       
   308             iCurrent->PrepareToPlayDesSequence(resourceReorderSeq);
       
   309             break;
       
   310         case TMS_INBAND_REMOTE_ALEARTING://ECCPRemoteAlerting:
       
   311             iCurrent->PrepareToPlayDesSequence(resourceRingGoingSeq);
       
   312             break;
       
   313         case TMS_INBAND_CALL_WAITING://ECCPCallWaiting:
       
   314             iCurrent->PrepareToPlayDesSequence(resourceCallWaitingSeq);
       
   315             break;
       
   316         case TMS_INBAND_NO_SEQUENCE://ECCPNoSoundSequence:
       
   317             break;
       
   318         default:
       
   319             break;
       
   320         }
       
   321     TRACE_PRN_FN_EXT;
       
   322     }
       
   323 
       
   324 // -----------------------------------------------------------------------------
       
   325 // TMSAudioInbandTonePlayer::Cancel
       
   326 // Cancels the currently playing tone.
       
   327 // (other items were commented in a header).
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 void TMSAudioInbandTonePlayer::Cancel()
       
   331     {
       
   332     TRACE_PRN_FN_ENT;
       
   333 
       
   334     if (iCurrent)
       
   335         {
       
   336         if (iCurrent->State() == EMdaAudioToneUtilityNotReady)
       
   337             {
       
   338             // Prepare is called, but toneplayer's state is not yet prepare,
       
   339             // then cancel to prepare is needed.
       
   340             iCurrent->CancelPrepare();
       
   341             }
       
   342         else
       
   343             {
       
   344             iCurrent->CancelPlay();
       
   345             }
       
   346         }
       
   347     TRACE_PRN_FN_EXT;
       
   348     }
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // TMSAudioInbandTonePlayer::PlayCurrentTone
       
   352 // Cancels the currently playing tone.
       
   353 // (other items were commented in a header).
       
   354 // -----------------------------------------------------------------------------
       
   355 //
       
   356 void TMSAudioInbandTonePlayer::PlayCurrentTone()
       
   357     {
       
   358     TRACE_PRN_FN_ENT;
       
   359     if (iCurrent)
       
   360         {
       
   361         if (iCurrent->State() == EMdaAudioToneUtilityPrepared)
       
   362             {
       
   363             UpdateTonePlayerVolume();
       
   364 
       
   365             switch (iToneName)
       
   366                 {
       
   367                 case TMS_INBAND_USER_BUSY://ECCPToneUserBusy:
       
   368                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   369                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   370                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   371                             static_cast<TMdaPriorityPreference> (
       
   372                                     KAudioPrefBusy));
       
   373                     break;
       
   374                 case TMS_INBAND_RADIO_PATH_NOT_AVAIL://ECCPToneRadioPathNotAvailable:
       
   375                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   376                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   377                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   378                             static_cast<TMdaPriorityPreference> (
       
   379                                     KAudioPrefRadioNotAvailable));
       
   380                     break;
       
   381                 case TMS_INBAND_CONGESTION://ECCPToneCongestion:
       
   382                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   383                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   384                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   385                             static_cast<TMdaPriorityPreference> (
       
   386                                     KAudioPrefCongestion));
       
   387                     break;
       
   388                 case TMS_INBAND_SPECIAL_INFO://ECCPToneSpecialInformation:
       
   389                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   390                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   391                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   392                             static_cast<TMdaPriorityPreference> (
       
   393                                     KAudioPrefSpecialInformation));
       
   394                     break;
       
   395                 case TMS_INBAND_REORDER://ECCPReorder:
       
   396                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   397                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   398                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   399                             static_cast<TMdaPriorityPreference> (
       
   400                                     KAudioPrefReorder));
       
   401                     break;
       
   402                 case TMS_INBAND_REMOTE_ALEARTING://ECCPRemoteAlerting:
       
   403                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   404                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   405                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   406                             static_cast<TMdaPriorityPreference> (
       
   407                                     KAudioPrefRingGoing));
       
   408                     break;
       
   409                 case TMS_INBAND_CALL_WAITING://ECCPCallWaiting:
       
   410                     iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds(
       
   411                             KPhoneInbandToneZero));
       
   412                     iCurrent->SetPriority(KAudioPriorityNetMsg,
       
   413                             static_cast<TMdaPriorityPreference> (
       
   414                                     KAudioPrefCallWaiting));
       
   415                     break;
       
   416                 case TMS_INBAND_DATA_CALL://ECCPDataCallTone: //EProfileRingingTypeRinging, EProfileRingingTypeAscending, EProfileRingingTypeRingingOnce
       
   417                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   418                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   419                     iCurrent->SetPriority(KAudioPriorityPhoneCall,
       
   420                             static_cast<TMdaPriorityPreference> (
       
   421                                     KAudioPrefIncomingDataCall));
       
   422 
       
   423                     //      if ( iRingingType == EProfileRingingTypeAscending )
       
   424                     //           {
       
   425                     //           iCurrent->SetVolumeRamp(
       
   426                     //               TTimeIntervalMicroSeconds( KPERingingToneRampDuration ) );
       
   427                     //           }
       
   428                     //       else
       
   429                     //          {
       
   430                     //EProfileRingingTypeRinging, EProfileRingingTypeRingingOnce
       
   431                     iCurrent->SetVolumeRamp(TTimeIntervalMicroSeconds(
       
   432                             KPhoneInbandToneZero));
       
   433                     //           }
       
   434                     //      if ( iRingingType == EProfileRingingTypeRingingOnce )
       
   435                     //          {
       
   436                     iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds(
       
   437                             KPhoneInbandToneZero));
       
   438                     //          }
       
   439                     break;
       
   440                 case TMS_INBAND_NO_SEQUENCE://ECCPNoSoundSequence:
       
   441                 case TMS_INBAND_BEEP_SEQUENCE://ECCPBeepSequence:
       
   442                     iCurrent->SetRepeats(KMdaAudioToneRepeatForever,
       
   443                             TTimeIntervalMicroSeconds(KPhoneInbandToneZero));
       
   444                     iCurrent->SetPriority(
       
   445                             KAudioPriorityPhoneCall,
       
   446                             static_cast<TMdaPriorityPreference> (
       
   447                                     KAudioPrefIncomingCall));
       
   448                     iCurrent->SetRepeats(0, TTimeIntervalMicroSeconds(
       
   449                             KPhoneInbandToneZero));
       
   450                     iCurrent->SetVolumeRamp(TTimeIntervalMicroSeconds(
       
   451                             KPhoneInbandToneZero));
       
   452                     break;
       
   453                 default:
       
   454                     break;
       
   455                 }
       
   456 
       
   457 #ifdef __WINS__
       
   458 
       
   459 #else
       
   460             //Play the tone
       
   461             iCurrent->Play();
       
   462 #endif
       
   463 
       
   464             } // State()
       
   465         } //iCurrent
       
   466     TRACE_PRN_FN_EXT;
       
   467     }
       
   468 
       
   469 // -----------------------------------------------------------------------------
       
   470 // TMSAudioInbandTonePlayer::MatoPrepareComplete
       
   471 // Updates flag values and plays current inbandtone.
       
   472 // (other items were commented in a header).
       
   473 // -----------------------------------------------------------------------------
       
   474 //
       
   475 void TMSAudioInbandTonePlayer::MatoPrepareComplete(TInt aError)
       
   476     {
       
   477     TRACE_PRN_FN_ENT;
       
   478     if (aError == KErrNone)
       
   479         {
       
   480         PlayCurrentTone();
       
   481         }
       
   482     TRACE_PRN_FN_EXT;
       
   483     }
       
   484 
       
   485 // -----------------------------------------------------------------------------
       
   486 // TMSAudioInbandTonePlayer::SetVolume
       
   487 // -----------------------------------------------------------------------------
       
   488 //
       
   489 void TMSAudioInbandTonePlayer::SetVolume(TInt aVolume)
       
   490     {
       
   491     TRACE_PRN_FN_ENT;
       
   492     TInt safeVolume = Max(Min(aVolume, KPhoneInbandVolumeMax),
       
   493             KPhoneInbandVolumeMin);
       
   494 
       
   495     if (iCurrent && EMdaAudioToneUtilityNotReady != iCurrent->State())
       
   496         {
       
   497         TInt mediaServerVolume = CalculateMediaServerVolume(safeVolume);
       
   498         iCurrent->SetVolume(mediaServerVolume);
       
   499         }
       
   500     TRACE_PRN_FN_EXT;
       
   501     }
       
   502 
       
   503 // -----------------------------------------------------------------------------
       
   504 // TMSAudioInbandTonePlayer::MatoPlayComplete
       
   505 // -
       
   506 // (other items were commented in a header).
       
   507 // -----------------------------------------------------------------------------
       
   508 //
       
   509 void TMSAudioInbandTonePlayer::MatoPlayComplete(TInt aError)
       
   510     {
       
   511     TRACE_PRN_FN_ENT;
       
   512     if (aError != KErrNone)
       
   513         {
       
   514         }
       
   515     TRACE_PRN_FN_EXT;
       
   516     }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // TMSAudioInbandTonePlayer::CalculateMediaServerVolume
       
   520 // -----------------------------------------------------------------------------
       
   521 //
       
   522 TInt TMSAudioInbandTonePlayer::CalculateMediaServerVolume(TInt aVolume) const
       
   523     {
       
   524     TRACE_PRN_FN_ENT;
       
   525     TRACE_PRN_FN_EXT;
       
   526     // Our volume level scale is 0...10, media server's can be anything.
       
   527     // This scales the volume to correct level.
       
   528     return (iCurrent->MaxVolume() * aVolume) /
       
   529             (KPhoneInbandVolumeMax - KPhoneInbandVolumeMin);
       
   530     }
       
   531 
       
   532 // -----------------------------------------------------------------------------
       
   533 // TMSAudioInbandTonePlayer::UpdateTonePlayerVolume
       
   534 // -----------------------------------------------------------------------------
       
   535 //
       
   536 void TMSAudioInbandTonePlayer::UpdateTonePlayerVolume()
       
   537     {
       
   538     TRACE_PRN_FN_ENT;
       
   539     TInt volume( /*KPhoneInbandVolumeMin*/KPhoneInbandVolumeMax);
       
   540     // iOwner.GetAudioVolumeSync( volume );
       
   541     SetVolume(volume);
       
   542     TRACE_PRN_FN_EXT;
       
   543     }
       
   544 
       
   545 // End of File