public AudioService() { speechSynthesiser = new SpeechSynthesizer(); maryTtsPlayer = new SoundPlayerEx(); BassNet.Registration(BassRegistrationEmail, BassRegistrationKey); Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero); Application.Current.Exit += (sender, args) => Bass.BASS_Free(); }
static void Main(string[] args) { SoundPlayerEx player = new SoundPlayerEx(@"c:\temp\sorry_dave.wav"); player.SoundFinished += player_SoundFinished; Console.WriteLine("Press any key to play the sound"); Console.ReadKey(true); player.PlayAsync(); Console.WriteLine("Press a key to stop the sound."); Console.ReadKey(true); player.Stop(); Console.WriteLine("Press any key to continue"); }