javauis/nokiasound/inc/CMIDSound.h
branchRCL_3
changeset 24 6c158198356e
equal deleted inserted replaced
23:e5618cc85d74 24:6c158198356e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Wrapper for CMIDClip and CMIDTone class initialisations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDES
       
    20 #include <mevents.h>
       
    21 #include <e32base.h>
       
    22 #include <cenrepnotifyhandler.h>
       
    23 #include "MMIDEventSender.h"
       
    24 #include "functionserver.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CMIDSoundImpl;
       
    28 
       
    29 // CLASS DEFINITION
       
    30 /**
       
    31  * CMIDSound is a wrapper that handles which class is
       
    32  * wanted to be initialised, CMIDClip or CMIDTone
       
    33  *
       
    34  */
       
    35 NONSHARABLE_CLASS(CMIDSound):
       
    36         public CBase, MCenRepNotifyHandlerCallback, MMIDEventSender, java::util::FunctionServer
       
    37 {
       
    38 
       
    39 public:
       
    40 
       
    41     //   Destructor
       
    42     ~CMIDSound();
       
    43 
       
    44 public: // From MCenRepNotifyHandlerCallback
       
    45     /**
       
    46      * Notifies this class about changes in the audio enable status
       
    47      */
       
    48     void HandleNotifyInt(TUint32 aId, TInt aNewValue);
       
    49 
       
    50 public: // From MMIDEventSender
       
    51     /**
       
    52     * Sends event to Java SoundListener.
       
    53     * @since 3.0
       
    54     * @param aEventType Type of the event to send
       
    55     */
       
    56     void SendEvent(TInt aEventType);
       
    57 
       
    58 protected:
       
    59 
       
    60     //  C++ default constructor
       
    61     CMIDSound();
       
    62 
       
    63 private:
       
    64     TBool IsAudioEnabled();
       
    65 
       
    66 public:
       
    67 
       
    68     static CMIDSound* NewL(JNIEnv& aJni, jobject aSound);
       
    69     void SetBeep(TInt aFreq, TInt64 aDuration);
       
    70     TInt Init(TInt aType, const TDesC8* aData);
       
    71     void InitL(TInt aType, const TDesC8* aData);
       
    72     TInt InitProfileListener();
       
    73     void InitProfileListenerL();
       
    74     TInt Play(TInt aLoop);
       
    75     TInt DoPlay(TInt aLoop);
       
    76     void Resume();
       
    77     void DoResume();
       
    78     void Stop();
       
    79     void DoStop();
       
    80     TInt SoundVolume();
       
    81     TInt Volume();
       
    82     void SetVolume(TInt aVolume);
       
    83     void DoSetVolume(TInt aVolume);
       
    84     TInt State();
       
    85     TInt PlayerState();
       
    86     void Release();
       
    87     void DoRelease();
       
    88 
       
    89 
       
    90 private:
       
    91 
       
    92     CMIDSoundImpl* iMIDSound;
       
    93     TInt iFreq;
       
    94     TInt64 iDur;
       
    95     TInt iSource;
       
    96     TInt iRealVolume;
       
    97 
       
    98     // owned, informs about changes in iRepository
       
    99     CCenRepNotifyHandler* iProfileListener;
       
   100 
       
   101     // owned, current profile
       
   102     CRepository* iRepository;
       
   103 
       
   104     TInt iHandle;
       
   105 };
       
   106