⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmixerthread.h

📁 在symbian中
💻 H
字号:
/*
 * ============================================================================
 *  Name     : CMixerThread.h
 *  Part of  : SoundMixer
 *  Created  : 03/30/2006 by Forum Nokia
 *  Description:
 *     This is the project specification file for SoundMixer.
 *     Initial content was generated by Series 60 AppWizard.
 *  Version  : 2.0.0
 *  Copyright: Forum Nokia
 * ============================================================================
 */

#ifndef __CMIXERTHREAD_H__
#define __CMIXERTHREAD_H__

// INCLUDES
#include <E32Base.h>
#include <mdaaudiooutputstream.h>
#include <mda\common\audio.h>
#include "TAudioShared.h"

class MyActive;

// CLASS DECLARATION

/**
* CMixerThread is a class which is created to new thread
* for performance reasons. This class takes care of mixing
* maximum of 16 channels of sampled sound to audio output
* stream. Messages between client thread and mixer thread
* are handled via exceptions.
*/

class CMixerThread
  : CBase
  , MMdaAudioOutputStreamCallback
  {
  public:

    /// Thread entry point
    static TInt ThreadFunction( TAny* aData );

    /// Default destructor
    ~CMixerThread();
    
    /// exception handler function
    /// @param aExc exception code
    void HandleExceptionL( /*TExcType aExc */);
    
  private:

    /// Default constructor
    /// @param aData data pointer from creator thread
    CMixerThread( TAny* aData );

    /// Two phased constructor
    /// @param aData data pointer from creator thread
    static CMixerThread* CreateL( TAny* aData );

    /// Second phase constructor
    TInt Construct();

    /// Second phase constructor which can leave
    void ConstructL();

    /// starts mixer
    void StartMixerL();

    /// stops mixer
    void StopMixer();

  private: // MMdaAudioOutputStreamCallback
    
    void MaoscPlayComplete( TInt aError );
    void MaoscBufferCopied( TInt aError, const TDesC8& aBuffer );
    void MaoscOpenComplete( TInt aError );

  private:
    
    /// Fill mixing buffer with new data
    void FillBufferL();
    
  private:

    CTrapCleanup*     iCleanupStack;
    CActiveScheduler*   iActiveScheduler;
    CMdaAudioOutputStream*  iStream;
    TMdaAudioDataSettings iSet;

    TInt16*         iBuffer;  // buffer to CMdaAudioOutput
    TInt*         iMixBuffer; // 32-bit buffer to mixing
    TPtrC8          iBufferPtr; // pointer to iBuffer
    
    TInt          iError;   // contains CMdaAudioOutput errors

    TAudioShared&     iShared;  // reference to shared data with client

    MyActive* iActive;
  
    // current sample data pointers
    TInt16* iAudioData[ KMaxChannels ];

    // These are shifted by KAudioShift
    TInt iAudioPos[ KMaxChannels ];
    TInt iAudioEnd[ KMaxChannels ];
    TInt iRepStart[ KMaxChannels ];
    TInt iRepEnd[ KMaxChannels ];   
  };
  
#endif

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -