예제 #1
0
        public void SetupTrack(int instruments, int length, float[] melody, DrumsWrap drums)
        {
            numInstruments = instruments;
            songLength     = length;


            float[] data = new float[numInstruments * songLength];

            for (int i = 0; i < songLength; ++i)
            {
                data[i] = drums.bassNotes[i];
                data[i + songLength]     = drums.hihatNotes[i];
                data[i + songLength * 2] = drums.rideNotes[i];
                data[i + songLength * 3] = drums.snareNotes[i];
                data[i + songLength * 4] = drums.splashNotes[i];
                data[i + songLength * 5] = melody[i];
            }



            songDataGrid.Columns.Clear();
            songDataGrid.Rows.Clear();
            songDataGrid.AllowUserToAddRows = false;
            dataGridView1.Columns.Clear();
            dataGridView1.RowHeadersVisible = false;

            for (int x = 0; x < songLength; ++x)
            {
                songDataGrid.Columns.Add(x.ToString(), x.ToString());
                songDataGrid.Columns[x].Width = 40;
                dataGridView1.Columns.Add(x.ToString(), x.ToString());
                dataGridView1.Columns[x].Width = 673 / songLength;
            }

            for (int y = 0; y < numInstruments; y++)
            {
                songDataGrid.Rows.Add();

                for (int x = 0; x < songLength; x++)
                {
                    songDataGrid.Rows[y].Cells[x].Value = data[y * songLength + x];
                }
            }

            AudioEngine.SendFloat(AudioEngine.PrependDollarZero("numInstruments"), (float)numInstruments);

            playbackProgress.Maximum = (int)songLength - 1;
            AudioEngine.SendFloat(AudioEngine.PrependDollarZero("length"), (float)songLength);

            AudioEngine.SendArray("pattern", 0, data, data.Length);
        }
예제 #2
0
        public Form1()
        {
            defaultColor  = Color.FromKnownColor(KnownColor.White);
            playbackColor = Color.FromKnownColor(KnownColor.Yellow);

            playing = false;
            repeat  = false;
            playbackProgressValue = 0;

            InitializeComponent();

            AudioEngine.Startup();

            AudioEngine.SubscribeFloat(AudioEngine.PrependDollarZero("notifyProgress"), OnProgressFloat);
            AudioEngine.SubscribeBang("stopPlayback", OnStopBang);

            SetupTrack(6, 8);

            trackBarLength.TickStyle = TickStyle.None;
            trackBarTempo.TickStyle  = TickStyle.None;
        }
예제 #3
0
        private void trackBarTempo_Scroll(object sender, EventArgs e)
        {
            float tempo = 60000.0f / (((float)trackBarTempo.Value / 1000) * 400.0f + 60.0f);

            AudioEngine.SendFloat(AudioEngine.PrependDollarZero("tempo"), tempo);
        }
예제 #4
0
        private void repeatToggle_CheckedChanged(object sender, EventArgs e)
        {
            repeat = repeatToggle.Checked;

            AudioEngine.SendFloat(AudioEngine.PrependDollarZero("loopPlayback"), repeat ? 1.0f : 0.0f);
        }