Ejemplo n.º 1
0
        //Info Editor.
        #region infoEditor

        public void doInfoStuff()
        {
            if (tree.SelectedNode != null)
            {
                if (tree.SelectedNode.Parent != null)
                {
                    if (tree.SelectedNode.Text.StartsWith("Sound"))
                    {
                        soundSelected.Text = "Sound: " + tree.SelectedNode.Index;
                        bytesSelected.Text = file.data[0].files[tree.SelectedNode.Index].Length + " bytes.";

                        //Hide no info label.
                        noInfoLabel.Hide();

                        //Show swav group.
                        swavGroup.Show();

                        //Get info.
                        currentSwavFile = new swavFile();
                        currentSwavFile.load(file.data[0].files[tree.SelectedNode.Index]);

                        typeBox.SelectedIndex = currentSwavFile.data[0].info.waveType;
                        if ((int)currentSwavFile.data[0].info.loopFlag == 0)
                        {
                            loopBox.Checked = false;
                        }
                        else
                        {
                            loopBox.Checked = true;
                        }
                        samplingBox.Value      = currentSwavFile.data[0].info.nSampleRate;
                        nTimeBox.Value         = currentSwavFile.data[0].info.nTime;
                        loopOffsetBox.Value    = currentSwavFile.data[0].info.loopOffset;
                        nonLoopLengthBox.Value = currentSwavFile.data[0].info.nonLoopLength;
                    }
                    else
                    {
                        //Hide swav group.
                        swavGroup.Hide();

                        //Show no info label.
                        noInfoLabel.Show();

                        soundSelected.Text = "No sound selected!";
                        bytesSelected.Text = "No bytes selected!";
                    }
                }
                else
                {
                    //Hide swav group.
                    swavGroup.Hide();

                    //Show no info label.
                    noInfoLabel.Show();

                    soundSelected.Text = "No sound selected!";
                    bytesSelected.Text = "No bytes selected!";
                }
            }
        }
Ejemplo n.º 2
0
        private void updateDataButton_Click(object sender, EventArgs e)
        {
            //Set info.
            currentSwavFile = new swavFile();
            currentSwavFile.load(file.data[0].files[tree.SelectedNode.Index]);

            currentSwavFile.data[0].info.waveType = (byte)typeBox.SelectedIndex;
            if (loopBox.Checked)
            {
                currentSwavFile.data[0].info.loopFlag = 1;
            }
            else
            {
                currentSwavFile.data[0].info.loopFlag = 0;
            }
            currentSwavFile.data[0].info.nSampleRate   = (UInt16)samplingBox.Value;
            currentSwavFile.data[0].info.nTime         = (UInt16)nTimeBox.Value;
            currentSwavFile.data[0].info.loopOffset    = (UInt16)loopOffsetBox.Value;
            currentSwavFile.data[0].info.nonLoopLength = (UInt32)nonLoopLengthBox.Value;

            file.data[0].files[tree.SelectedNode.Index] = currentSwavFile.toBytes();
            tree.SelectedNode = tree.SelectedNode;
            doInfoStuff();
        }