public InstrumentEditor()
        {
            InitializeComponent();

            this.virtPiano = virtPiano = new VirtualPiano(this);
            this.virtPiano.Mode = VirtualPiano.PianoMode.Instrument;
            this.virtPiano.Enabled = chkTesting.Checked;
        }
        public InstrumentEditor()
        {
            InitializeComponent();

            this.virtPiano         = virtPiano = new VirtualPiano(this);
            this.virtPiano.Mode    = VirtualPiano.PianoMode.Instrument;
            this.virtPiano.Enabled = chkTesting.Checked;
        }
 public EffectEditor()
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     this.virtPiano = new VirtualPiano(this);
     this.virtPiano.Mode = VirtualPiano.PianoMode.Fx;
     this.virtPiano.Enabled = chkTesting.Checked;
     this.virtPiano.NoteFxPressed += OnNoteOrFxPressed;
 }
Exemple #4
0
 public EffectEditor()
 {
     InitializeComponent();
     this.DoubleBuffered           = true;
     this.virtPiano                = new VirtualPiano(this);
     this.virtPiano.Mode           = VirtualPiano.PianoMode.Fx;
     this.virtPiano.Enabled        = chkTesting.Checked;
     this.virtPiano.NoteFxPressed += OnNoteOrFxPressed;
 }
Exemple #5
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            bool audioInitialized = PlaybackStreamer.IsAudioAvailable();

            if (!audioInitialized)
            {
                bool installed = installOpenAL();
                if (installed)
                {
                    Restart(string.Empty);
                }
            }

            if (audioInitialized)
            {
                try
                {
                    if (args.Length > 1)
                    {
                        startSeveralInstances(args);
                    }
                    else
                    {
                        startSingleInstance(args);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.ToString());

                    string errorMessage = string.Format(WYZTracker.Properties.Resources.ApplicationError, Logger.LogPath);

                    MessageBox.Show(errorMessage,
                                    WYZTracker.Properties.Resources.Error,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);

                    if (audioInitialized)
                    {
                        PlaybackStreamer.StopAudio();
                    }
                }
            }

            VirtualPiano.ReleaseDevices();
            Application.Exit();
        }
        public PatternView()
        {
            UpdateFont();
            this.SetStyle(ControlStyles.Selectable | ControlStyles.OptimizedDoubleBuffer, true);
            this.highlightRange = 4;
            this.highlightBackColor = Color.DarkGreen;
            this.highlightBackColor2 = Color.Transparent;
            this.highlightForeColor = Color.Yellow;
            this.selectionBackColor = Color.FromKnownColor(KnownColor.Highlight);
            this.selectionForeColor = Color.FromKnownColor(KnownColor.HighlightText);

            virtPiano = new VirtualPiano(this);
            virtPiano.Mode = VirtualPiano.PianoMode.Instrument;
            virtPiano.NoteFxPressed += virtPiano_NoteFxPressed;
        }
        private void OnNoteOrFxPressed(object sender, VirtualPiano.NoteFXEventArgs e)
        {
            if (!this.chkTesting.Checked && e.Note != null)
            {
                int freq = 0;
                if (e.Note.Note != 'P')
                {
                    int tone = (12 * e.Note.Octave - 2) + e.Note.GetNote() + (e.Note.Seminote == '+' ? 1 : 0) + 2;
                    int num = 0;

                    while (tone >= this.currentSong.Frequencies.Length)
                    {
                        tone -= 12;
                        num++;
                    }
                    freq = this.currentSong.Frequencies[tone];

                    freq = (int)(freq / Math.Pow(2, num));
                }

                this.freqHiSliders[this.SelectedIndex].Value = (freq & 0x0000FF00) >> 8;
                this.freqLoSliders[this.SelectedIndex].Value = (freq & 0x00FF);

                this.virtPiano.PlayEffect(this.CurrentEffect.ID);
            }
        }
 void virtPiano_NoteFxPressed(object sender, VirtualPiano.NoteFXEventArgs e)
 {
     clearMultipleSelection();
     if (e.Note != null && this.currentChannel < this.currentSong.Channels)
     {
         setNote(e.Note);
     }
     if (e.Fx != int.MinValue && this.currentChannel == this.currentSong.Channels)
     {
         setFx(e.Fx);
     }
 }
Exemple #9
0
        private void cmdOk_Click(object sender, EventArgs e)
        {
            string selectedLanguage = cboIdioma.SelectedItem as string;

            bool continueWithOk  = true;
            bool languageChanged = selectedLanguage != LocalizationManager.GetCurrentCultureName();

            if (languageChanged)
            {
                System.Windows.Forms.DialogResult result = MessageBox.Show(
                    Properties.Resources.RestartMessage,
                    Properties.Resources.Warning,
                    MessageBoxButtons.YesNoCancel,
                    MessageBoxIcon.Warning);

                switch (result)
                {
                case System.Windows.Forms.DialogResult.Yes:
                    if (string.IsNullOrEmpty(ApplicationState.Instance.FileName))
                    {
                        this.sfd.Filter = WYZTracker.Properties.Resources.WYZFilter;
                        if (this.sfd.ShowDialog() == DialogResult.OK)
                        {
                            SongManager.SaveSong(ApplicationState.Instance.CurrentSong, this.sfd.FileName);
                        }
                    }
                    else
                    {
                        SongManager.SaveSong(ApplicationState.Instance.CurrentSong, ApplicationState.Instance.FileName);
                    }
                    break;

                case System.Windows.Forms.DialogResult.Cancel:
                    continueWithOk = false;
                    break;
                }
            }

            if (continueWithOk)
            {
                Properties.Settings.Default.CheckFileAssociation = chkCheckFileAssociation.Checked;
                Properties.Settings.Default.ShowSplash           = chkSplash.Checked;
                Properties.Settings.Default.UseCustomFont        = chkDigitalFont.Checked;
                Properties.Settings.Default.Language             = selectedLanguage;

                Properties.Settings.Default.ColumnWidth    = (int)numColWidth.Value;
                Properties.Settings.Default.FontSize       = (int)numFontSize.Value;
                Properties.Settings.Default.KeyboardLayout = cboKeyboardLayout.SelectedItem as string;

                //Properties.Settings.Default.SoundBufSize = (int)numBufSize.Value;

                Properties.Settings.Default.Save();

                LocalizationManager.LocalizeApplication(Properties.Settings.Default.Language);
                VirtualPiano.InitPianoKeys();
                //Player.BufferLengthInMs = Properties.Settings.Default.SoundBufSize;

                if (languageChanged)
                {
                    Program.Restart(ApplicationState.Instance.FileName);
                }
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }