예제 #1
0
        public unsafe Recorder(string tempfilepath)
        {
            cb = new VorbisEnc.CircleBuffer();
            //ve = new VorbisEnc.VorbisEnc();
            ve = new VorbisEnc.FlacEncoder();
            //byte[] data = Encoding.GetBytes(tempfilepath);
            //filepath = System.Runtime.InteropServices.Marshal.AllocHGlobal(data.Length + 1);

            //System.Runtime.InteropServices.Marshal.Copy(data, 0, filepath, data.Length);
            //ve.Initialise((sbyte*)filepath.ToPointer());
            ve.Initialise((sbyte*)System.Runtime.InteropServices.Marshal.StringToHGlobalUni(tempfilepath).ToPointer());
            //System.Runtime.InteropServices.Marshal.FreeHGlobal(filepath);//need anymore?

            System.Threading.Thread th = new System.Threading.Thread(EncodeData);

            WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(16000, 16, 1);
            m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 4096, 4, new WaveLib.BufferDoneEventHandler(DataArrived));

            th.Start();
        }
예제 #2
0
        public unsafe Recorder(string tempfilepath)
        {
            cb = new VorbisEnc.CircleBuffer();
            //ve = new VorbisEnc.VorbisEnc();
            ve = new VorbisEnc.FlacEncoder();
            //byte[] data = Encoding.GetBytes(tempfilepath);
            //filepath = System.Runtime.InteropServices.Marshal.AllocHGlobal(data.Length + 1);

            //System.Runtime.InteropServices.Marshal.Copy(data, 0, filepath, data.Length);
            //ve.Initialise((sbyte*)filepath.ToPointer());
            ve.Initialise((sbyte *)System.Runtime.InteropServices.Marshal.StringToHGlobalUni(tempfilepath).ToPointer());
            //System.Runtime.InteropServices.Marshal.FreeHGlobal(filepath);//need anymore?

            System.Threading.Thread th = new System.Threading.Thread(EncodeData);

            WaveLib.WaveFormat fmt = new WaveLib.WaveFormat(16000, 16, 1);
            m_Recorder = new WaveLib.WaveInRecorder(-1, fmt, 4096, 4, new WaveLib.BufferDoneEventHandler(DataArrived));

            th.Start();
        }