//----------------------------------------------------------------------------
//
// File:		tms9919.hpp
// Date:		23-Feb-1998
// Programmer:	Marc Rousseau
//
// Description:
//
// Copyright (c) 1998-2004 Marc Rousseau, All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
//
// Revision History:
//
//----------------------------------------------------------------------------

#ifndef TMS9919_HPP_
#define TMS9919_HPP_

#include "cBaseObject.hpp"
#include "itms9919.hpp"

struct iTMS5220;

class cTMS9919 :
	public virtual cBaseObject,
	public virtual iTMS9919
{
protected:

	enum NOISE_COLOR_E
	{
		NOISE_PERIODIC,
		NOISE_WHITE
	};

	cRefPtr<iTMS5220>   m_pSpeechSynthesizer;

	UINT8               m_LastData;

	int                 m_Frequency[ 4 ];
	int                 m_Attenuation[ 4 ];
	NOISE_COLOR_E       m_NoiseColor;
	int                 m_NoiseType;

	virtual void SetNoise( NOISE_COLOR_E, int );
	virtual void SetFrequency( int, int );
	virtual void SetAttenuation( int, int );

public:

	cTMS9919( );

	// iBaseObject Methods
	virtual const void *GetInterface( const std::string &name ) const override;

	// iTMS9919 Methods
	virtual void SetSpeechSynthesizer( iTMS5220 * ) override;
	virtual void WriteData( UINT8 data ) override;
	virtual int GetPlaybackFrequency( ) override;

protected:

	virtual ~cTMS9919( );

private:

	cTMS9919( const cTMS9919 & ) = delete;			// no implementation
	void operator =( const cTMS9919 & ) = delete;	// no implementation

};

#endif
