mmserv/tms/tmsserver/src/tmsglobaleffectssettings.cpp
branchRCL_3
changeset 19 095bea5f582e
parent 17 60e492b28869
child 20 0ac9a5310753
equal deleted inserted replaced
18:a36789189b53 19:095bea5f582e
    16  */
    16  */
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 #include "tmsglobaleffectssettings.h"
    19 #include "tmsglobaleffectssettings.h"
    20 #include "tmsclientserver.h"
    20 #include "tmsclientserver.h"
       
    21 #include "tmsutility.h"
    21 
    22 
    22 using namespace TMS;
    23 using namespace TMS;
    23 
    24 
    24 // CONSTANTS
    25 // CONSTANTS
    25 const TInt KDefaultVolume = 4;
    26 const TInt KDefaultVolume = 4;
    26 const TInt KDefaultMaxVolume = 10;
    27 const TInt KDefaultMaxVolume = 10;
    27 const TInt KDefaultGain = 1;
    28 const TInt KDefaultGain = 1;
    28 
    29 
    29 #ifndef __WINS__
    30 #ifndef __WINSCW__
    30 const TInt KDefaultMaxGain = 1;
    31 const TInt KDefaultMaxGain = 1;
    31 #else
    32 #else
    32 const TInt KDefaultMaxGain = 64;
    33 const TInt KDefaultMaxGain = 64;
    33 #endif
    34 #endif
    34 
    35 
    57 // Symbian 2nd phase constructor can leave.
    58 // Symbian 2nd phase constructor can leave.
    58 // -----------------------------------------------------------------------------
    59 // -----------------------------------------------------------------------------
    59 //
    60 //
    60 void TMSGlobalEffectsSettings::ConstructL()
    61 void TMSGlobalEffectsSettings::ConstructL()
    61     {
    62     {
       
    63     TRACE_PRN_FN_ENT;
    62     // Create repository instance
    64     // Create repository instance
    63     iRepository = CRepository::NewL(KCRUidTmseffects);
    65     iRepository = CRepository::NewL(KCRUidTmseffects);
    64     if (iRepository)
    66     if (iRepository)
    65         {
    67         {
    66         iRepository->Get(KTmsLoudSpkrVolume, iLoudSpkrVolume);
    68         iRepository->Get(KTmsLoudSpkrVolume, iLoudSpkrVolume);
    67         iRepository->Get(KTmsEarPieceVolume, iEarVolume);
    69         iRepository->Get(KTmsEarPieceVolume, iEarVolume);
    68         }
    70         TRACE_PRN_N1(_L("loud spkr vol %d"),iLoudSpkrVolume);
       
    71         TRACE_PRN_N1(_L("ear piece vol %d"),iEarVolume);
       
    72         }
       
    73     TRACE_PRN_FN_EXT;
    69     }
    74     }
    70 
    75 
    71 // -----------------------------------------------------------------------------
    76 // -----------------------------------------------------------------------------
    72 // TMSGlobalEffectsSettings::NewL
    77 // TMSGlobalEffectsSettings::NewL
    73 // Two-phased constructor.
    78 // Two-phased constructor.
    92 // TMSGlobalEffectsSettings::SetLoudSpkrVolume
    97 // TMSGlobalEffectsSettings::SetLoudSpkrVolume
    93 // -----------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
    94 //
    99 //
    95 void TMSGlobalEffectsSettings::SetLoudSpkrVolume(TInt aVolume)
   100 void TMSGlobalEffectsSettings::SetLoudSpkrVolume(TInt aVolume)
    96     {
   101     {
       
   102     TRACE_PRN_FN_ENT;
    97     TInt status(KErrNone);
   103     TInt status(KErrNone);
    98     if (iRepository)
   104     if (iRepository)
    99         {
   105         {
   100         status = iRepository->Set(KTmsLoudSpkrVolume, aVolume);
   106         if (aVolume > 0)
       
   107             {
       
   108             status = iRepository->Set(KTmsLoudSpkrVolume, aVolume);
       
   109             TRACE_PRN_N2(_L("status %d loud spkr vol %d"),status,aVolume);
       
   110             }
       
   111         else
       
   112             {
       
   113             status = iRepository->Set(KTmsLoudSpkrVolume, KDefaultVolume);
       
   114             TRACE_PRN_N(_L("loud spkr level 0 store default"));
       
   115             }
   101         if (status == KErrNone)
   116         if (status == KErrNone)
   102             {
   117             {
   103             iLoudSpkrVolume = aVolume;
   118             iLoudSpkrVolume = aVolume;
   104             }
   119             TRACE_PRN_N1(_L("cached loud spkr vol %d"),iLoudSpkrVolume);
   105         }
   120             }
       
   121         }
       
   122     TRACE_PRN_FN_EXT;
   106     }
   123     }
   107 
   124 
   108 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   109 // TMSGlobalEffectsSettings::SetEarPieceVolume
   126 // TMSGlobalEffectsSettings::SetEarPieceVolume
   110 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   111 //
   128 //
   112 void TMSGlobalEffectsSettings::SetEarPieceVolume(TInt aVolume)
   129 void TMSGlobalEffectsSettings::SetEarPieceVolume(TInt aVolume)
   113     {
   130     {
       
   131     TRACE_PRN_FN_ENT;
   114     TInt status(KErrNone);
   132     TInt status(KErrNone);
   115     if (iRepository)
   133     if (iRepository)
   116         {
   134         {
   117         status = iRepository->Set(KTmsEarPieceVolume, aVolume);
   135         if (aVolume > 0)
       
   136             {
       
   137             status = iRepository->Set(KTmsEarPieceVolume, aVolume);
       
   138             TRACE_PRN_N2(_L("status %d ear vol %d"),status,aVolume);
       
   139             }
       
   140         else
       
   141             {
       
   142             status = iRepository->Set(KTmsEarPieceVolume, KDefaultVolume);
       
   143             TRACE_PRN_N(_L("ear piece vol level 0 store default"));
       
   144             }
   118         if (status == KErrNone)
   145         if (status == KErrNone)
   119             {
   146             {
   120             iEarVolume = aVolume;
   147             iEarVolume = aVolume;
   121             }
   148             TRACE_PRN_N1(_L("cached ear piece vol %d"),iEarVolume);
   122         }
   149             }
       
   150         }
       
   151     TRACE_PRN_FN_EXT;
   123     }
   152     }
   124 
   153 
   125 // -----------------------------------------------------------------------------
   154 // -----------------------------------------------------------------------------
   126 // TMSGlobalEffectsSettings::GetLoudSpkrVolume
   155 // TMSGlobalEffectsSettings::GetLoudSpkrVolume
   127 // -----------------------------------------------------------------------------
   156 // -----------------------------------------------------------------------------
   128 //
   157 //
   129 void TMSGlobalEffectsSettings::GetLoudSpkrVolume(TInt& aVolume)
   158 void TMSGlobalEffectsSettings::GetLoudSpkrVolume(TInt& aVolume)
   130     {
   159     {
   131     aVolume = iLoudSpkrVolume;
   160     aVolume = iLoudSpkrVolume;
       
   161     TRACE_PRN_N1(_L("TMSGlobalEffectsSettings GetLoudSpkrVolume %d"),aVolume);
   132     }
   162     }
   133 
   163 
   134 // -----------------------------------------------------------------------------
   164 // -----------------------------------------------------------------------------
   135 // TMSGlobalEffectsSettings::GetEarPieceVolume
   165 // TMSGlobalEffectsSettings::GetEarPieceVolume
   136 // -----------------------------------------------------------------------------
   166 // -----------------------------------------------------------------------------
   137 //
   167 //
   138 void TMSGlobalEffectsSettings::GetEarPieceVolume(TInt& aVolume)
   168 void TMSGlobalEffectsSettings::GetEarPieceVolume(TInt& aVolume)
   139     {
   169     {
   140     aVolume = iEarVolume;
   170     aVolume = iEarVolume;
       
   171     TRACE_PRN_N1(_L("TMSGlobalEffectsSettings GetEarPieceVolume  %d"),aVolume);
   141     }
   172     }
   142 
   173 
   143 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   144 // TMSGlobalEffectsSettings::MaxVolume
   175 // TMSGlobalEffectsSettings::MaxVolume
   145 // -----------------------------------------------------------------------------
   176 // -----------------------------------------------------------------------------
   174 TInt TMSGlobalEffectsSettings::MaxGain() const
   205 TInt TMSGlobalEffectsSettings::MaxGain() const
   175     {
   206     {
   176     return iMaxGain;
   207     return iMaxGain;
   177     }
   208     }
   178 
   209 
   179 //  End of File
   210 // -----------------------------------------------------------------------------
       
   211 // TMSGlobalEffectsSettings::ResetDefaultVolume
       
   212 // -----------------------------------------------------------------------------
       
   213 //
       
   214 void TMSGlobalEffectsSettings::ResetDefaultVolume()
       
   215     {
       
   216     if (iLoudSpkrVolume == 0)
       
   217         {
       
   218         iRepository->Get(KTmsLoudSpkrVolume, iLoudSpkrVolume);
       
   219         TRACE_PRN_N1(_L("Needed to reset default loudspkr vol %d"),iLoudSpkrVolume);
       
   220         }
       
   221     if (iEarVolume == 0)
       
   222         {
       
   223         iRepository->Get(KTmsEarPieceVolume, iEarVolume);
       
   224         TRACE_PRN_N1(_L("Needed to reset default ear vol %d"),iEarVolume);
       
   225         }
       
   226     }
       
   227