public AudioPlaybackEngine(ref WaveFormat format, ref MixingSampleProvider mspStandard, ref MixingSampleProvider mspLoopback, ref AudioFileManager afm, int masterVolume) { this.mspStandard = mspStandard; this.mspLoopback = mspLoopback; this.masterVolume = masterVolume; this.afm = afm; audioFormat = format; items = new ObservableCollection <AudioPlaybackItem>(); }
//AudioFileManager afm; public ConsoleUI(SourceGame game, ref AudioFileManager afm, ref MainWindow mw) { this.afm = afm; startUpContent = new List <string>(); trackListContent = new List <string>(); helpContent = new List <string>(); tracks = new List <TrackListItem>(); this.mw = mw; this.game = game; Render(); }
private AudioFileManager getAFM() { AudioFileManager afm = null; App.Current.Dispatcher.Invoke(delegate { afm = (App.Current.MainWindow as MainWindow).getAFM(); }); if (afm == null) { return(null); } return(afm); }
public AudioPlaybackItem(string name, string path, int volume) { this.name = name; this.path = path; this.fileName = Path.GetFileName(path); this.volume = volume; afm = getAFM(); tags = new ObservableCollection <string>(); //update the list in the ui tags.CollectionChanged += Tags_CollectionChanged; //if the name is empty, it will generate a new name GenerateName(); GenerateTags(); }
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(); }
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; } }
//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; }