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