mmserv/tms/tmsserver/src/tmsaudiotoneutilityimpl.cpp
changeset 20 b67dd1fc57c5
parent 19 4a629bc82c5e
equal deleted inserted replaced
19:4a629bc82c5e 20:b67dd1fc57c5
    30 
    30 
    31 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    32 // 2nd phase construcotor
    32 // 2nd phase construcotor
    33 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    34 //
    34 //
    35 void TMSAudioToneUtilityImpl::ConstructL(MMdaAudioToneObserver& aToneObserver)
    35 void TMSAudioToneUtilityImpl::ConstructL(MMdaAudioToneObserver& toneObserver)
    36     {
    36     {
    37     iToneUtility = CMdaAudioToneUtility::NewL(aToneObserver);
    37     iToneUtility = CMdaAudioToneUtility::NewL(toneObserver);
    38     }
    38     }
    39 
    39 
    40 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    41 // Static constructor
    41 // Static constructor
    42 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
    43 //
    43 //
    44 TMSAudioToneUtilityImpl* TMSAudioToneUtilityImpl::NewL(
    44 TMSAudioToneUtilityImpl* TMSAudioToneUtilityImpl::NewL(
    45         MMdaAudioToneObserver& aToneObserver)
    45         MMdaAudioToneObserver& toneObserver)
    46     {
    46     {
    47     TMSAudioToneUtilityImpl* self = new (ELeave) TMSAudioToneUtilityImpl;
    47     TMSAudioToneUtilityImpl* self = new (ELeave) TMSAudioToneUtilityImpl;
    48     CleanupStack::PushL(self);
    48     CleanupStack::PushL(self);
    49     self->ConstructL(aToneObserver);
    49     self->ConstructL(toneObserver);
    50     CleanupStack::Pop(self);
    50     CleanupStack::Pop(self);
    51     return self;
    51     return self;
    52     }
    52     }
    53 
    53 
    54 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    84 //
    84 //
    85 void TMSAudioToneUtilityImpl::CancelPlay()
    85 void TMSAudioToneUtilityImpl::CancelPlay()
    86     {
    86     {
    87     // Do state specific cancellations, this way we do not end up in a
    87     // Do state specific cancellations, this way we do not end up in a
    88     // endless play state if CancelPlay() is called during preparation.
    88     // endless play state if CancelPlay() is called during preparation.
    89     if (EMdaAudioToneUtilityPlaying == iToneUtility->State())
    89     if (iToneUtility)
    90         {
    90         {
    91         iToneUtility->CancelPlay();
    91         if (EMdaAudioToneUtilityPlaying == State())
    92         }
    92             {
    93     else if (EMdaAudioToneUtilityPrepared == iToneUtility->State())
    93             iToneUtility->CancelPlay();
    94         {
    94             }
    95         iToneUtility->CancelPrepare();
    95         else if (EMdaAudioToneUtilityPrepared == State())
       
    96             {
       
    97             iToneUtility->CancelPrepare();
       
    98             }
    96         }
    99         }
    97     }
   100     }
    98 
   101 
    99 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   100 // From class TMSAudioToneUtilityImpl
   103 // From class TMSAudioToneUtilityImpl
   101 // ---------------------------------------------------------------------------
   104 // ---------------------------------------------------------------------------
   102 //
   105 //
   103 TInt TMSAudioToneUtilityImpl::MaxVolume()
   106 gint TMSAudioToneUtilityImpl::MaxVolume()
   104     {
   107     {
   105     return iToneUtility->MaxVolume();
   108     return iToneUtility->MaxVolume();
   106     }
   109     }
   107 
   110 
   108 // ---------------------------------------------------------------------------
   111 // ---------------------------------------------------------------------------
   109 // From class TMSAudioToneUtilityImpl
   112 // From class TMSAudioToneUtilityImpl
   110 // ---------------------------------------------------------------------------
   113 // ---------------------------------------------------------------------------
   111 //
   114 //
   112 void TMSAudioToneUtilityImpl::SetVolume(TInt aVolume)
   115 void TMSAudioToneUtilityImpl::SetVolume(gint volume)
   113     {
   116     {
   114     iToneUtility->SetVolume(aVolume);
   117     iToneUtility->SetVolume(volume);
   115     }
   118     }
   116 
   119 
   117 // ---------------------------------------------------------------------------
   120 // ---------------------------------------------------------------------------
   118 // From class TMSAudioToneUtilityImpl
   121 // From class TMSAudioToneUtilityImpl
   119 // ---------------------------------------------------------------------------
   122 // ---------------------------------------------------------------------------
   120 //
   123 //
   121 void TMSAudioToneUtilityImpl::SetRepeats(TInt aRepeatNumberOfTimes,
   124 void TMSAudioToneUtilityImpl::SetRepeats(gint repeatNumberOfTimes,
   122         const TTimeIntervalMicroSeconds& aTrailingSilence)
   125         const TTimeIntervalMicroSeconds& trailingSilence)
   123     {
   126     {
   124     iToneUtility->SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
   127     iToneUtility->SetRepeats(repeatNumberOfTimes, trailingSilence);
   125     }
   128     }
   126 
   129 
   127 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   128 // From class TMSAudioToneUtilityImpl
   131 // From class TMSAudioToneUtilityImpl
   129 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   130 //
   133 //
   131 void TMSAudioToneUtilityImpl::SetPriority(TInt aPriority,
   134 void TMSAudioToneUtilityImpl::SetPriority(gint priority,
   132         TMdaPriorityPreference aPref)
   135         TMdaPriorityPreference pref)
   133     {
   136     {
   134     iToneUtility->SetPriority(aPriority, aPref);
   137     iToneUtility->SetPriority(priority, pref);
   135     }
   138     }
   136 
   139 
   137 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
   138 // From class TMSAudioToneUtilityImpl
   141 // From class TMSAudioToneUtilityImpl
   139 // ---------------------------------------------------------------------------
   142 // ---------------------------------------------------------------------------
   140 //
   143 //
   141 void TMSAudioToneUtilityImpl::SetVolumeRamp(
   144 void TMSAudioToneUtilityImpl::SetVolumeRamp(
   142         const TTimeIntervalMicroSeconds& aRampDuration)
   145         const TTimeIntervalMicroSeconds& rampDuration)
   143     {
   146     {
   144     iToneUtility->SetVolumeRamp(aRampDuration);
   147     iToneUtility->SetVolumeRamp(rampDuration);
   145     }
   148     }
   146 
   149 
   147 // ---------------------------------------------------------------------------
   150 // ---------------------------------------------------------------------------
   148 // From class TMSAudioToneUtilityImpl
   151 // From class TMSAudioToneUtilityImpl
   149 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------