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

📄 cmixerthread.h

📁 SoundMixer example application is compatible with Series 60 Developer Platform v1.0 and v2.0. It
💻 H
字号:
   /*
    *
============================================================================
    *  Name     : CMixerThread.h
    *  Part of  : SoundMixer
    *  Created  : 03/01/2003 by Forum Nokia
    *  Description:
    *     This is the project specification file for SoundMixer.
    *     Initial content was generated by Series 60 AppWizard.
    *
    *  Version  : 1.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 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();
		
	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* Create( TAny* aData );

		/// Second phase constructor
		TInt Construct();

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

		/// static exception handler function
		/// @param aExc exception code
		static void ExcHandler( TExcType aExc );

		/// exception handler function
		/// @param aExc exception code
		void HandleException( TExcType aExc );

		/// starts mixer
		void StartMixer();

		/// 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 FillBuffer();


		
	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

		// 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

⌨️ 快捷键说明

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