Esempio n. 1
0
        public async Task SendAsync(IAudioClient client, string path)
        {
            LogMessage msg = new LogMessage(LogSeverity.Verbose, "AudioServ", "Sending Audio File " + path + " For " + client.ToString());
            await client.SetSpeakingAsync(true);

            using var ffmpeg  = CreateStream(path);
            using var output  = ffmpeg.StandardOutput.BaseStream;
            using var discord = client.CreatePCMStream(AudioApplication.Mixed, 48000, 500);
            try
            {
                await output.CopyToAsync(discord);
            }
            finally
            {
                await discord.FlushAsync();

                await output.DisposeAsync();

                output.Close();
                await client.SetSpeakingAsync(false);
            }
        }