javauis/amms_qt/module/inc/cammsglobalmanager.h
changeset 23 98ccebc37403
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  This class provides GlobalManager functionality.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAMMSGLOBALMANAGER_H
       
    20 #define CAMMSGLOBALMANAGER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include <mmmaplayerinstanceobserver.h>
       
    26 
       
    27 #include "cammsmodule.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CAMMSModuleContainer;
       
    33 class CAMMSPlayerBuilderGroup;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *
       
    39 *  This class provides GlobalManager functionality.
       
    40 *  The GlobalManager handles the creation of EffectModules, SoundSource3Ds
       
    41 *  and MediaProcessors. Furthermore, a Spectator can be get from the
       
    42 *  GlobalManager. GlobalManager extends the CAMMSModule and contains global
       
    43 *  controls.
       
    44 *
       
    45 *
       
    46 *  @since 3.0
       
    47 */
       
    48 NONSHARABLE_CLASS(CAMMSGlobalManager): public CAMMSModule, public MMMAPlayerInstanceObserver
       
    49 {
       
    50 public:
       
    51 
       
    52     /**
       
    53     * Two-phased constructor.
       
    54     */
       
    55     static CAMMSGlobalManager* NewLC();
       
    56 
       
    57     /**
       
    58     * Destructor.
       
    59     */
       
    60     ~CAMMSGlobalManager();
       
    61 
       
    62 public: // From MMMAPlayerInstanceObserver
       
    63     /**
       
    64     * MMA will call this method when new player is created.
       
    65     * @since 3.0
       
    66     * @param aPlayer Player to add.
       
    67     */
       
    68     void AddPlayerNotifyL(CMMAPlayer* aPlayer);
       
    69 
       
    70     /**
       
    71     * MMA will call this method when player does not exist anymore.
       
    72     * @since 3.0
       
    73     * @param aPlayer Player to remove.
       
    74     */
       
    75     void RemovePlayerNotify(CMMAPlayer* aPlayer);
       
    76 
       
    77 public: // New functions
       
    78     /**
       
    79     * Initializes GlobalManager. This method is called when Java
       
    80     * GlobalManager is accessed for the first time.
       
    81     * This method creates mma controls to the added players and creates
       
    82     * global controls. After this method is called amms controls are added
       
    83     * to players immediately.
       
    84     * @param aPlayers Players created with mma api.
       
    85     * @since 3.0
       
    86     */
       
    87     void InitL(RPointerArray< CMMAPlayer >& aPlayers);
       
    88 
       
    89     /**
       
    90     * Creates a new sound source 3D module.
       
    91     * Module will be owned by global manager.
       
    92     * @since 3.0
       
    93     * @return New sound source 3D module.
       
    94     */
       
    95     CAMMSModule* CreateSoundSource3DL();
       
    96 
       
    97     /**
       
    98     * Creates a new effect module.
       
    99     * Module will be owned by global manager.
       
   100     * @since 3.0
       
   101     * @return New effect module.
       
   102     */
       
   103     CAMMSModule* CreateEffectModuleL();
       
   104 
       
   105     /**
       
   106     * Returns the spectator.
       
   107     * @since 3.0
       
   108     * @return Spectator.
       
   109     */
       
   110     CAMMSModule* Spectator();
       
   111 
       
   112     /**
       
   113     * Disposes module.
       
   114     * @param aModule Module to dispose.
       
   115     */
       
   116     void DisposeModule(CAMMSModule* aModule);
       
   117 
       
   118     /**
       
   119      * Checks whether the given player can be added to a module (EffectModule
       
   120      * or SoundSource3D).
       
   121      * @param aPlayer Player to be checked.
       
   122      * @return KErrNone if the player can be added or some error
       
   123      * code if the adding is not allowed.
       
   124      */
       
   125     TInt PlayerAddingAllowed(CMMAPlayer* aPlayer);
       
   126 
       
   127 private:
       
   128     /**
       
   129     * C++ default constructor.
       
   130     */
       
   131     CAMMSGlobalManager();
       
   132 
       
   133     /**
       
   134     * By default Symbian 2nd phase constructor is private.
       
   135     */
       
   136     void ConstructL();
       
   137 
       
   138 private:  // New functions
       
   139 
       
   140     /**
       
   141      * Checks whether the given player can be added to a module
       
   142      * according to the given module (is there any player in
       
   143      * the module that can prevent player adding to any module).
       
   144      * @param aPlayer Player to be checked.
       
   145      * @param aModule Module to be checked.
       
   146      * @return KErrNone if the player can be added or some error
       
   147      * code if the adding is not allowed.
       
   148      */
       
   149     TInt PlayerAddingAllowed(CMMAPlayer* aPlayer, CAMMSModule* aModule);
       
   150 
       
   151 
       
   152 private:    // Data
       
   153     // Owned spectator
       
   154     CAMMSModule* iSpectator;
       
   155 
       
   156     // Owned effect modules
       
   157     CAMMSModuleContainer* iEffectModules;
       
   158 
       
   159     // Owned sound source 3Ds
       
   160     CAMMSModuleContainer* iSoundSource3Ds;
       
   161 
       
   162     // Owned player builder
       
   163     CAMMSPlayerBuilderGroup* iPlayerBuilder;
       
   164 };
       
   165 
       
   166 #endif // CAMMSGLOBALMANAGER_H
       
   167 
       
   168