示例#1
0
        private void LoadRhythm_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string        filename = ofd.FileName;
                StreamReader  r        = File.OpenText(filename);
                string        json     = r.ReadToEnd();
                RhythmPattern item     = JsonConvert.DeserializeObject <RhythmPattern>(json);
                rp = item;
                rp.TimeOfBarSeconds  = 60 / rp.BPM * rp.TimeSignitureTop;
                rp.TimeOfBeatSeconds = 60 / rp.BPM;
            }
        }
示例#2
0
        public Form1(string rhythmFilename)
        {
            InitializeComponent();

            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
            generate_Image         = generate_Waveform;
            generate_Image_Cmdline = generate_Waveform_Cmdline;
            wgs = new WaveformGenerator[2];

            // Load rhythm
            StreamReader  r    = File.OpenText(rhythmFilename);
            string        json = r.ReadToEnd();
            RhythmPattern item = JsonConvert.DeserializeObject <RhythmPattern>(json);

            rp = item;
            rp.TimeOfBarSeconds  = 60 / rp.BPM * rp.TimeSignitureTop;
            rp.TimeOfBeatSeconds = 60 / rp.BPM;
        }
示例#3
0
        public WaveformGenerator(string filePath, RhythmPattern pattern)
        {
            this.filePath = filePath;

            // Set properties.
            ProgressPercentageInterval = DefaultProgressPercentageInterval;
            Detail          = DefaultDetail;
            Direction       = DefaultDirection;
            Orientation     = DefaultOrientation;
            LeftSideBrush   = DefaultLeftSideBrush;
            RightSideBrush  = DefaultRightSideBrush;
            CenterLineBrush = DefaultCenterLineBrush;

            // Init fields.
            leftLevelList  = new List <float>();
            rightLevelList = new List <float>();
            progressSw     = new Stopwatch();

            // Change state.
            State   = ReadyState.Started;
            Pattern = pattern;
        }