Ejemplo n.º 1
0
        public CommandReader(ref QueuedSpeechSynthesizer qss, ref AudioPlaybackEngine ape, ref AudioFileManager afm, SourceGame selectedGame)
        {
            this.selectedGame = selectedGame;
            this.logFile      = PathManager.steamApps + MainWindow.gameDir + @"\!tts-axynos.log";
            this.qss          = qss;
            this.ape          = ape;
            this.afm          = afm;

            this.synthCmd     = CommandManager.synthCmd;
            playCmd           = CommandManager.playCmd;
            playVideoCmd      = CommandManager.playVideoCmd;
            pauseCmd          = CommandManager.pauseCmd;
            resumeCmd         = CommandManager.resumeCmd;
            stopCmd           = CommandManager.stopCmd;
            skipCurrentCmd    = CommandManager.skipCurrentCmd;
            clearQueueCmd     = CommandManager.clearQueueCmd;
            ttsSkipCurrentCmd = CommandManager.ttsSkipCurrentCmd;
            ttsClearQueueCmd  = CommandManager.ttsClearQueueCmd;
            blockUserCmd      = CommandManager.blockUserCmd;
            blockWordCmd      = CommandManager.blockWordCmd;

            Setup(logFile);
            StartReadLoop();
        }
Ejemplo n.º 2
0
 protected virtual void Dispose(bool disposing)
 {
     if (qss != null)
     {
         qss.Dispose();
         qss = null;
     }
     if (afm != null)
     {
         afm.Dispose();
         afm = null;
     }
     if (ape != null)
     {
         ape.Dispose(); //rip Harambe
         ape = null;
     }
     if (wiMicrophone != null)
     {
         wiMicrophone.StopRecording();
         wiMicrophone.Dispose();
         wiMicrophone = null;
     }
     if (woLoopback != null)
     {
         woLoopback.Stop();
         woLoopback.Dispose();
         woLoopback = null;
     }
     if (woStandard != null)
     {
         woStandard.Stop();
         woStandard.Dispose();
         woStandard = null;
     }
 }
Ejemplo n.º 3
0
        //Timer steamAppsLoop; BURN IN HELL YOU F*****G C**T
        #endregion

        public MainWindow()
        {
            if (!File.Exists("audioformat.txt"))
            {
                using (StreamWriter sw = new StreamWriter(File.Open("audioformat.txt", FileMode.Create), Encoding.UTF8))
                {
                    sw.WriteLine("Sample rate: 44100");
                    sw.WriteLine("Channels: 2");
                }
            }
            else
            {
                int samplerate = int.Parse(File.ReadAllLines("audioformat.txt")[0].Replace("Sample rate: ", ""));
                int channels   = int.Parse(File.ReadAllLines("audioformat.txt")[1].Replace("Channels: ", ""));
                audioFormat = WaveFormat.CreateIeeeFloatWaveFormat(samplerate, channels);
            }

            InitializeComponent();

            //DEBUG CODE
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += CurrentDomain_UnhandledException;


            //
            populateAccentComboBox();
            CommandManager.synthCmd.changeCommand(TTS_CommandTextBox.Text);
            mw = this;

            InitializeMixer(ref mspStandard);
            InitializeMixer(ref mspLoopback);

            if (!File.Exists("blocked_users.txt"))
            {
                File.Create("blocked_users.txt");
            }
            if (!File.Exists("blocked_words.txt"))
            {
                File.Create("blocked_words.txt");
            }
            if (!File.Exists("whitelisted_users.txt"))
            {
                File.Create("whitelisted_users.txt");
            }
            if (!File.Exists("replace.txt"))
            {
                File.Create("replace.txt");
            }
            if (!File.Exists("regex_filter.txt"))
            {
                File.Create("regex_filter.txt");
            }

            if (!File.Exists("game.txt"))
            {
                using (StreamWriter sw = new StreamWriter(File.Open("game.txt", FileMode.Create), Encoding.UTF8))
                {
                    sw.WriteLine("tf2");
                    sw.WriteLine();
                    sw.WriteLine("Change the first line to the game you want STARK to use.");
                    sw.WriteLine("After changing the game you will need to restart STARK.");
                    sw.WriteLine();
                    sw.WriteLine("Here is the list of supported games:");
                    sw.WriteLine("csgo: Counter-Strike: Global Offensive");
                    sw.WriteLine("css: Counter-Strike: Source");
                    sw.WriteLine("tf2: Team Fortress 2");
                    sw.WriteLine("gmod: Garry's Mod");
                    sw.WriteLine("hl2dm: Half-Life 2 DeathMatch");
                    sw.WriteLine("l4d: Left 4 Dead");
                    sw.WriteLine("l4d2: Left 4 Dead 2");
                    sw.WriteLine("dods: Day of Defeat Source");
                    sw.WriteLine("insurg: Insurgency");
                }
                gameDir = @"\common\Team Fortress 2\tf";
            }
            else
            {
                string game = File.ReadLines("game.txt").First();

                if (game == "csgo")
                {
                    gameDir = @"\common\Counter-Strike Global Offensive\csgo";
                }
                else if (game == "css")
                {
                    gameDir = @"\common\Counter-Strike Source\cstrike";
                }
                else if (game == "tf2")
                {
                    gameDir = @"\common\Team Fortress 2\tf";
                }
                else if (game == "gmod")
                {
                    gameDir = @"\common\GarrysMod\garrysmod";
                }
                else if (game == "hl2dm")
                {
                    gameDir = @"\common\half-life 2 deathmatch\hl2mp";
                }
                else if (game == "l4d")
                {
                    gameDir = @"\common\Left 4 Dead\left4dead";
                }
                else if (game == "l4d2")
                {
                    gameDir = @"\common\Left 4 Dead 2\left4dead2";
                }
                else if (game == "dods")
                {
                    gameDir = @"\common\day of defeat source\dod";
                }
                else if (game == "insurg")
                {
                    gameDir = @"\common\insurgency2\insurgency";
                }
                else
                {
                    gameDir = @"\common\Team Fortress 2\tf";
                }
            }

            //Startup fam
            qss = new QueuedSpeechSynthesizer(ref mspStandard, ref mspLoopback, 50, -1);
            afm = new AudioFileManager();
            ape = new AudioPlaybackEngine(ref audioFormat, ref mspStandard, ref mspLoopback, ref afm, 10);


            InitializeSynthQueue();
            InitializeVoiceComboBox();
            populateSetupComboBoxes();
            InitializeAudioItemList();
            InitializeAudioQueue();

            loadSettings();

            //latency has to be >= 25
            InitializeMicrophone(ref wiMicrophone, Setup_Microphone.SelectedIndex, 25, 100);

            //latency has to be >= 100
            InitializeOutput(ref woStandard, Setup_OutputCombined.SelectedIndex, 25, ref mspStandard);
            InitializeOutput(ref woLoopback, Setup_SynthesizerOnly.SelectedIndex, 25, ref mspLoopback);

            changeMicrophone(Setup_Microphone.SelectedIndex);
            changeCombinedOutput(Setup_OutputCombined.SelectedIndex);
            changeLoopbackOutput(Setup_SynthesizerOnly.SelectedIndex);

            FindSteamApps();

            loaded = true;
        }