示例#1
0
        private void button_of_fun_Click(object sender, EventArgs e)
        {
            //   OpenFileDialog dialog = new OpenFileDialog();
            //    dialog.Filter = "All Supported File Types (*.AIFF; *.ASF; *.ASX; *.DAT; *.FLAC; *.GM; *.IT; *.M3U; *.MID; *.MOD; *.MP2; *.MP3; *.OGG; *.RAW; *.S3M; *.VAG; *.WAV; *.WAX; *.WMA; *.XM; *.XMA)|*.aiff;*.asf;*.asx;*.dat;*.flac;*.gm;*.it;*.m3u;*.mid;*.mod;*.mp2;*.mp3;*.ogg;*.raw;*.s3m;*.vag;*.wav;*.wax;*.wma;*.xm;*.xma|Audio Interchange File Format (*.AIFF)|*.aiff|Chris Sawyer Software [CSS] Audio Data File (*.DAT)|*.dat|Free Lossless Audio Codec (*.FLAC)|*.flac|Impulse Tracker (*.IT)|*.it|Musical Instrument Digital Interface (*.GM, *.MID, *.MIDI)|*.gm;*.mid;*.midi|Modular Audio File Format (*.MOD)|*.mod|MPEG-1 Audio Layer 3 (*.MP2, *.MP3)|*.mp2;*.mp3|OGG Vorbis File Format (*.OGG)|*.ogg|Raw Audio File (*.RAW)|*.raw|Scream Tracker (*.S3M)|*.s3m|Wave File (*.WAV)|*.wav|Windows Media File Format (*.WMA)|*.wma|Extended Modular Audio File Format (*.XM, *.XMA)|*.xm;*.xma|All Files|*.*";
            //   dialog.InitialDirectory = GAPT_LastDirectoryName; dialog.Title = "Open";
            dialog.Filter = DefaultOpenDialogFilter;
            dialog.Multiselect = false;

            if (dialog.ShowDialog() == DialogResult.OK)
            {

                string input = string.Empty;
                input = dialog.FileName;

                if (input != string.Empty)
                {
                    GAPT_LastDirectoryName = Path.GetDirectoryName(input);
                    TTRTrackPlayingEntryID = -1;
                    TTRPlaySound(input, GAPT_CurrentLoopStart, GAPT_CurrentLoopDone, true);
                    TTRStopSound();

                    if (radioButton2.Checked)
                    {
                        subForm_LoopStart = new Form2();
                        if (subForm_LoopStart.ShowDialog() == DialogResult.OK)
                        {
                            if (subForm_LoopStart.textBox1.Text.ToString() == "")
                            {
                                GAPT_CurrentLoopStart = 0;
                            }
                            else
                            {
                                try
                                {
                                    GAPT_CurrentLoopStart = Convert.ToUInt32(subForm_LoopStart.textBox1.Text.ToString());
                                    if (GAPT_CurrentLoopStart > TTRLength)
                                    {
                                        GAPT_CurrentLoopStart = 0;
                                    }
                                    else if (GAPT_CurrentLoopStart < 0)
                                    {
                                        GAPT_CurrentLoopStart = 0;
                                    }
                                }
                                catch
                                {
                                    MessageBox(new IntPtr(0), "Non-critical Exception Raised: GAPI_DIALOG1_EXCEPTION" + Environment.NewLine + "Sorry, that failed.", "GSA Exception Trapper", MB_OK | ICON_STOP);
                                    GAPT_CurrentLoopStart = 0;
                                }
                            }

                        }

                    }

                    {
                        subForm_LoopEnd = new Form3();
                        if (subForm_LoopEnd.ShowDialog() == DialogResult.OK)
                        {
                            if (subForm_LoopEnd.textBox1.Text.ToString() == "")
                            {
                                try
                                {
                                    GAPT_CurrentLoopDone = 0;
                                }
                                catch
                                {
                                    MessageBox(new IntPtr(0), "Non-critical Exception Raised: GAPI_DIALOG2_EXCEPTION" + Environment.NewLine + "Sorry, that failed.", "GSA Exception Trapper", MB_OK | ICON_STOP);
                                    GAPT_CurrentLoopDone = 0;
                                }
                            }
                            else
                            {
                                try
                                {
                                    GAPT_CurrentLoopDone = Convert.ToUInt32(subForm_LoopEnd.textBox1.Text.ToString());
                                    if (GAPT_CurrentLoopDone > TTRLength)
                                    {
                                        GAPT_CurrentLoopDone = 0;
                                    }
                                    else if (GAPT_CurrentLoopDone < 0)
                                    {
                                        GAPT_CurrentLoopDone = 0;
                                    }
                                }
                                catch
                                {
                                    MessageBox(new IntPtr(0), "Non-critical Exception Raised: GAPI_DIALOG3_EXCEPTION" + Environment.NewLine + "Sorry, that failed.", "GSA Exception Trapper", MB_OK | ICON_STOP);
                                    GAPT_CurrentLoopDone = 0;
                                }
                            }

                        }

                    }

                    TTRPlaySound(input, GAPT_CurrentLoopStart, GAPT_CurrentLoopDone, false);
                }

                dialog.Dispose();
            }
        }
示例#2
0
        private void button_next_Click(object sender, EventArgs e)
        {
            //FMOD.RESULT result;
            if (radioButton2.Checked)
            {
                if (GAPT_LastTrackName == string.Empty)
                {
                    return;
                }
                subForm_LoopEnd = new Form3();
                if (subForm_LoopEnd.ShowDialog() == DialogResult.OK)
                {
                    if (subForm_LoopEnd.textBox1.Text.ToString() == "")
                    {
                        try
                        {
                            GAPT_CurrentLoopDone = 0;
                            TTRPlaySound(GAPT_LastTrackName, GAPT_CurrentLoopStart, GAPT_CurrentLoopDone, false);
                        }
                        catch
                        {
                            MessageBox(new IntPtr(0), "Non-critical Exception Raised: GAPI_RAD2C_FAILURE" + Environment.NewLine + "Sorry, that failed.", "GSA Exception Trapper", MB_OK | ICON_STOP);
                        }
                    }
                    else
                    {
                        try
                        {
                            GAPT_CurrentLoopDone = Convert.ToUInt32(subForm_LoopEnd.textBox1.Text.ToString());
                            if (GAPT_CurrentLoopDone > TTRLength)
                            {
                                GAPT_CurrentLoopDone = 0;
                            }
                            else if (GAPT_CurrentLoopDone < 0)
                            {
                                GAPT_CurrentLoopDone = 0;
                            }
                            TTRPlaySound(GAPT_LastTrackName, GAPT_CurrentLoopStart, GAPT_CurrentLoopDone, false);
                        }
                        catch
                        {
                            MessageBox(new IntPtr(0), "Non-critical Exception Raised: GAPI_RAD2D_FAILURE" + Environment.NewLine + "Sorry, that failed.", "GSA Exception Trapper", MB_OK | ICON_STOP);
                        }
                    }

                }

            }
            else
            {
            }
        }