audiostubs/devsoundextensions_stubs/audiovisualizationstub/src/VisualizationBody.cpp
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2004 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: Audio Stubs -  Implementation of class Audio VisualiztionBody.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #ifdef _DEBUG
       
    22 #include <e32svr.h>
       
    23 #endif
       
    24 #include <Visualization.h>
       
    25 #include <MVisualizationObserver.h>
       
    26 #include "VisualizationBody.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CVisualization::CVisualization
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CVisualization::CBody::CBody()
       
    37     : 	iFrequencyDataEnabled(EFalse),
       
    38     	iWaveFormDataEnabled(EFalse)
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 // Destructor
       
    44 CVisualization::CBody::~CBody()
       
    45     {
       
    46 	iFrequencyData.Close();
       
    47 	iWaveFormData.Close();
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CVisualization::ConstructL
       
    52 // Symbian 2nd phase constructor can leave.
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void CVisualization::CBody::ConstructL(
       
    56 	MVisualizationObserver& aObserver )
       
    57      {
       
    58 #ifdef _DEBUG
       
    59     RDebug::Print(_L("CVisualization::Body::ConstructL"));
       
    60 #endif
       
    61 	iObserver = &aObserver;
       
    62 	}
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CVisualization::NewL
       
    66 // Two-phased constructor.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CVisualization::CBody* CVisualization::CBody::NewL(
       
    70     MVisualizationObserver& aObserver )
       
    71     {
       
    72 #ifdef _DEBUG
       
    73     RDebug::Print(_L("CVisualization::Cbody::NewL"));
       
    74 #endif
       
    75     CVisualization::CBody* self = new (ELeave) CVisualization::CBody();
       
    76     CleanupStack::PushL(self);
       
    77     self->ConstructL(aObserver);
       
    78     CleanupStack::Pop();
       
    79     return self;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CVisualization::DataRate
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86  TUint32 CVisualization::CBody::DataRate() const
       
    87     {
       
    88 	return iDataRate;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CVisualization::DataRateRange
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95  void CVisualization::CBody::DataRateRange(
       
    96 	TUint32& aMin,
       
    97 	TUint32& aMax )
       
    98     {
       
    99 	aMin = iDataRateMin;
       
   100 	aMax = iDataRateMax;
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CVisualization::EnableFrequencyData
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107  void CVisualization::CBody::EnableFrequencyData(
       
   108 	TBool aIndicator )
       
   109     {
       
   110 	iFrequencyDataEnabled = aIndicator;
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CVisualization::EnableWaveformData
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117  void CVisualization::CBody::EnableWaveformData(
       
   118 	TBool aIndicator )
       
   119     {
       
   120 	iWaveFormDataEnabled = aIndicator;
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CVisualization::FreqencyBandCount
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127  TUint32 CVisualization::CBody::FreqencyBandCount() const
       
   128     {
       
   129 	return iFreqencyBandCount;
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CVisualization::FrequencyBandCountRange
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136  void CVisualization::CBody::FrequencyBandCountRange(
       
   137 	TUint32& aMin,
       
   138 	TUint32& aMax )
       
   139     {
       
   140 	aMin = iFreqencyBandCountMin;
       
   141 	aMax = iFreqencyBandCountMax;
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CVisualization::IsFrequencyDataEnabled
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148  TBool CVisualization::CBody::IsFrequencyDataEnabled() const
       
   149     {
       
   150 	return iFrequencyDataEnabled;
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CVisualization::IsWaveformDataEnabled
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157  TBool CVisualization::CBody::IsWaveformDataEnabled() const
       
   158     {
       
   159 	return iWaveFormDataEnabled;
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CVisualization::SamplingRate
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166  TUint32 CVisualization::CBody::SamplingRate() const
       
   167     {
       
   168 	return iSamplingRate;
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CVisualization::SetDataRateL
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175  void CVisualization::CBody::SetDataRateL(
       
   176 	TUint32 aDataRate )
       
   177 	{
       
   178 	if ( (aDataRate >= iDataRateMin) && (aDataRate <= iDataRateMax) )
       
   179 		{
       
   180 		iDataRate = aDataRate;
       
   181 		}
       
   182 	else
       
   183 		{
       
   184 		User::Leave(KErrArgument);
       
   185 		}
       
   186 	}
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CVisualization::SetFrequencyBandCount
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192  void CVisualization::CBody::SetFrequencyBandCountL(
       
   193 	TUint32 aFrequencyBandCount )
       
   194 	{
       
   195 	if ( (aFrequencyBandCount >= iFreqencyBandCountMin) && (aFrequencyBandCount <= iFreqencyBandCountMax) )
       
   196 		{
       
   197 		iFreqencyBandCount = aFrequencyBandCount;
       
   198 		}
       
   199 	else
       
   200 		{
       
   201 		User::Leave(KErrArgument);
       
   202 		}
       
   203 	}
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CVisualization::SetWaveformDataLength
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209  void CVisualization::CBody::SetWaveformDataLengthL(
       
   210 	TUint32 aWaveformDataLength )
       
   211 	{
       
   212 	if ( (aWaveformDataLength >= iWaveformDataLengthMin) && (aWaveformDataLength <= iWaveformDataLengthMax) )
       
   213 		{
       
   214 		iWaveformDataLength = aWaveformDataLength;
       
   215 		}
       
   216 	else
       
   217 		{
       
   218 		User::Leave(KErrArgument);
       
   219 		}
       
   220 	}
       
   221 
       
   222 // -----------------------------------------------------------------------------
       
   223 // CVisualization::StartL
       
   224 // -----------------------------------------------------------------------------
       
   225 //
       
   226  void CVisualization::CBody::StartL()
       
   227     {
       
   228 	User::Leave(KErrNotSupported);
       
   229     }
       
   230 
       
   231 // -----------------------------------------------------------------------------
       
   232 // CVisualization::StopL
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235  void CVisualization::CBody::StopL()
       
   236     {
       
   237 	User::Leave(KErrNotSupported);
       
   238     }
       
   239 
       
   240 // -----------------------------------------------------------------------------
       
   241 // CVisualization::WaveformDataLength
       
   242 // -----------------------------------------------------------------------------
       
   243 //
       
   244  TUint32 CVisualization::CBody::WaveformDataLength() const
       
   245     {
       
   246 	return iWaveformDataLength;
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CVisualization::WaveformDataLengthRange
       
   251 // -----------------------------------------------------------------------------
       
   252 //
       
   253  void CVisualization::CBody::WaveformDataLengthRange(
       
   254 	TUint32& aMin,
       
   255 	TUint32& aMax )
       
   256     {
       
   257 	aMin = iWaveformDataLengthMin;
       
   258 	aMax = iWaveformDataLengthMax;
       
   259     }
       
   260 
       
   261