示例#1
0
文件: Tape.cs 项目: BouKiCHi/TapeEx
    public bool OutputRawWave()
    {
        StreamReader sr = new StreamReader(InputFilename);

        var w = new WaveFormat();

        w.Open(OutputFilename, true);

        while (true)
        {
            var Line = sr.ReadLine();
            if (Line == null)
            {
                break;
            }
            var Data  = Line.Split(',');
            var Form  = Convert.ToInt32(Data[0]);
            var Width = Convert.ToInt32(Data[1]);

            var Sample = FormMin;
            if (Form == 1)
            {
                Sample = FormMax;
            }
            if (Form == -1)
            {
                Sample = 0 - (FormMax + 1);
            }

            WriteSample(w, Width, Sample);
        }

        sr.Dispose();
        w.Close();

        return(true);
    }
示例#2
0
文件: Tape.cs 项目: BouKiCHi/TapeEx
    // txtからWAVファイルを作成
    public bool OutputDataWave()
    {
        StreamReader sr = new StreamReader(InputFilename);

        var w = new WaveFormat();

        w.Open(OutputFilename, true);
        SamplePerSecond = w.Rate;

        var HighValue = FormMax;
        var LowValue  = 0 - (FormMax + 1);

        while (true)
        {
            var Line = sr.ReadLine();
            if (string.IsNullOrEmpty(Line))
            {
                break;
            }
            var Data  = Line.Split(',');
            var Form  = Convert.ToInt32(Data[0]);
            var Width = Convert.ToInt32(Data[1]);

            StepSample(Width);

            if (Form == 2)
            {
                WriteSample(w, Width, LowValue);
                continue;
            }

            if (Form == -1)
            {
                WriteSample(w, Width, 0);
                continue;
            }

            if (Form == 0)
            {
                var Left = Width - (25 * 7);
                // Wait + HL HL HL H
                WriteSample(w, Left, LowValue);
                for (var i = 0; i < 3; i++)
                {
                    WriteSample(w, 25, HighValue);
                    WriteSample(w, 25, LowValue);
                }
                WriteSample(w, 25, HighValue);
            }

            if (Form == 1)
            {
                var Left = Width - (47 * 3);
                // Wait + HL H
                WriteSample(w, Left, LowValue);
                WriteSample(w, 47, HighValue);
                WriteSample(w, 47, LowValue);
                WriteSample(w, 47, HighValue);
            }
        }

        Console.WriteLine();

        sr.Dispose();
        w.Close();

        return(true);
    }
示例#3
0
文件: Tape.cs 项目: BouKiCHi/TapeEx
 private void CloseWrite()
 {
     Writer.Dispose();
     Wav.Close();
 }