Beispiel #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);
        }
Beispiel #2
0
        private void updateGrid()
        {
            float[] data = new float[numInstruments * songLength];

            for (int i = 0; i < numInstruments; i++)
            {
                for (int j = 0; j < songLength; j++)
                {
                    data[(i * songLength) + j] = float.Parse(songDataGrid.Rows[i].Cells[j].Value.ToString());
                }
            }

            AudioEngine.SendArray("pattern", 0, data, data.Length);
        }