mmfenh/enhancedaudioplayerutility/AudioStreaming/AudioClientStreamSource/src/S60ClientAudioBuffer.cpp
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2005 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: Enhance audio player utility
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #ifdef _DEBUG
       
    22 #include 	<e32svr.h>
       
    23 #endif
       
    24 
       
    25 #include "S60ClientAudioBuffer.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CClientAudioBuffer::CClientAudioBuffer
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CClientAudioBuffer::CClientAudioBuffer()
       
    36     : iAudioBufferDes(NULL,0),
       
    37       iLastBuffer(EFalse)
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CClientAudioBuffer::ConstructL
       
    43 // Symbian 2nd phase constructor can leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 void CClientAudioBuffer::ConstructL(TInt aBufferSize)
       
    47     {
       
    48 	iAudioBuffer = HBufC8::NewL(aBufferSize);
       
    49 	iAudioBufferDes.Set(iAudioBuffer->Des());
       
    50 #ifdef _DEBUG
       
    51 	RDebug::Print(_L("CClientAudioBuffer::ConstructL: Length=%d, MaxLength=%d"), iAudioBufferDes.Length(), iAudioBufferDes.MaxLength());
       
    52 #endif
       
    53 	}
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CClientAudioBuffer::NewL
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CClientAudioBuffer* CClientAudioBuffer::NewL(TInt aBufferSize)
       
    61     {
       
    62     CClientAudioBuffer* self = new(ELeave) CClientAudioBuffer();
       
    63     CleanupStack::PushL(self);
       
    64     self->ConstructL(aBufferSize);
       
    65     CleanupStack::Pop(self);
       
    66     return self;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CClientAudioBuffer::GetBufferPtr
       
    71 // Gets the Buffer Ptr to the Client Buffer
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C TPtr8& CClientAudioBuffer::GetBufferPtr()
       
    75 	{
       
    76 #ifdef _DEBUG
       
    77     RDebug::Print(_L("CClientAudioBuffer::GetBufferPtr"));
       
    78 #endif
       
    79 		return iAudioBufferDes;
       
    80 	}
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CClientAudioBuffer::IsLastBuffer
       
    84 // Gets the Last Buffer Status
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C TBool CClientAudioBuffer::IsLastBuffer()
       
    88 	{
       
    89 #ifdef _DEBUG
       
    90     RDebug::Print(_L("CClientAudioBuffer::IsLastBuffer"));
       
    91 #endif
       
    92 		return iLastBuffer;
       
    93 	}
       
    94 
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CClientAudioBuffer::SetLastBuffer
       
    98 // Sets the Last Buffer Status
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 EXPORT_C void CClientAudioBuffer::SetLastBuffer(TBool aStatus)
       
   102 	{
       
   103 #ifdef _DEBUG
       
   104     RDebug::Print(_L("CClientAudioBuffer::SetLastBuffer"));
       
   105 #endif
       
   106 		iLastBuffer = aStatus;
       
   107 	}
       
   108 
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CClientAudioBuffer::~CClientAudioBuffer
       
   112 // Destructor
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 EXPORT_C CClientAudioBuffer::~CClientAudioBuffer()
       
   116     {
       
   117 #ifdef _DEBUG
       
   118     RDebug::Print(_L("CClientAudioBuffer::~CClientAudioBuffer"));
       
   119 #endif
       
   120     delete iAudioBuffer;
       
   121     }
       
   122 
       
   123 
       
   124 
       
   125 
       
   126 // End of file
       
   127