Esempio n. 1
0
 /// <summary>
 /// Dispose.
 /// </summary>
 /// <param name="disposing">Indicates if the user called the dispose method or the finalizer did it.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (streamer != null)
     {
         streamer.Dispose();
         streamer = null;
     }
 }
Esempio n. 2
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();
        }
Esempio n. 3
0
        public Player()
        {
            this.playState = PlayStatus.Stopped;
            for (int i = 0; i < ayEmus.Length; i++)
            {
                ayEmus[i] = new AY();
                ayEmus[i].SetChipType(LibAYEmu.Chip.AY_Kay, null);
            }
            streamer = new PlaybackStreamer();
            streamer.BufferLengthInMs = 2 * GENSOUND_PERIOD;
            streamer.FillBuffer      += new EventHandler <FillBufferEventArgs>(OnFillBuffer);

            this.LimitLoops = -1;
            this.Volume     = 1.0;
        }
Esempio n. 4
0
        private static void startSingleInstance(string[] args)
        {
            if (args.Length == 1 && args[0] == CREATE_ASSOC_PARAM)
            {
                try
                {
                    createWYZFileAssociation();
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.ToString());
                }
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Logger.FileName = "WYZTracker.log";

                LocalizationManager.LocalizeApplication(Properties.Settings.Default.Language);

                if (Properties.Settings.Default.ShowSplash)
                {
                    ApplicationState.Instance.SplashScreen = new Splash();
                    ApplicationState.Instance.SplashScreen.FadeIn();
                }

                try
                {
                    checkWYZFileAssociation();
                }
                catch (Exception ex)
                {
                    Logger.Log(ex.ToString());
                }

                // Speed the cloning of songs a little...
                SerializationUtils.Clone(new Song());
                PlaybackStreamer.InitializeAudio();
                Application.Run(new frmDockedMain(args));
                PlaybackStreamer.StopAudio();
            }
        }