from System import *
from System.Collections.Generic import *
from System.Text import *
from Alvas.Audio import *

def rex_Open(sender, e):
	_play.OpenPlayer(_pcmFormat)
	_play.StartPlay()

def rex_Close(sender, e):
	_play.ClosePlayer()

def rex_Data(sender, e):
	data = AudioCompressionManager.Reverse(_pcmFormat, e.Data)
	_play.AddData(data)

_play = PlayerEx(True)
_pcmFormat = AudioCompressionManager.GetPcmFormat(1, 16, 44100)
_rex = RecorderEx(True)
_rex.Data += rex_Data
_rex.Open += rex_Open
_rex.Close += rex_Close
_rex.Format = _pcmFormat
_rex.StartRecord()
Console.WriteLine("Please press enter to exit!")
Console.ReadLine()
_rex.StopRecord()

	