
	//双通道的波表合成器
	//首先缓冲前后两个音符的音量,防止产生跳变的电压导致声音有杂音,
	//然后依次处理两个通道的波形采样并叠加,再通过区间变换处理成无符号数输出到PWM
	//每个通道的波形为:
	//        *
	//       *  *
	//      *     **
	//     *         **
	//    *               **
	//   *                       ***
	//  *                                ****
	// *                                            ******
	//*                                                           *******


unit tone
{
	public const uint16 ID = 0;
	
	public link unit SOUND {}
	public link unit SOUND1 {}
	
	//[i] interface_tone tone1;
	public unit tone1
	{
		public link void play( int8 channal, int8 tone, uint8 vol ) {}
		public link void stop( int8 channal, int8 s ) {}
		public link uint8 switch_time( uint8 t ) {}
		public link bool isBusy;
		public link bool isNeed;
	}
	tone1.play = play;
	tone1.stop = stop;
	tone1.switch_time = switch_time;
	tone1.isBusy = NullFalse;
	tone1.isNeed = NullFalse;
	bool NullFalse;
	
	//[i] var_uint8 OS_time;
	uint8 OS_time;
	
	#include "$run$.txt"
	
	
	
	//---------------------------------------------------
	//[i] function_void OS_init;
	void OS_init()
	{
		RunInit();
		
		OS_time = 5;
		NullFalse = false;
	}
	//---------------------------------------------------
	//[i] function_void play int32 int32 int32;
	
	//...
	
	//---------------------------------------------------
	//[i] function_void stop int32 int32;
	
	//...
	
	//---------------------------------------------------
	//[i] function_void OS_run;
	
	//...
}





















































