This commit is contained in:
2023-07-31 20:47:44 -03:00
parent 9df9090812
commit 0b9f96460f
8 changed files with 84 additions and 40 deletions

View File

@@ -0,0 +1,28 @@
using System.Diagnostics;
namespace Kasbot.Services.Internal
{
public class AudioService
{
public AudioService() { }
public Process CreateStream()
{
var process = Process.Start(new ProcessStartInfo
{
FileName = "ffmpeg",
Arguments = $"-hide_banner -loglevel panic -i pipe:0 -ac 2 -f s16le -ar 48000 pipe:1",
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true
});
if (process == null || process.HasExited)
{
throw new Exception("Sorry, ffmpeg killed itself in a tragic accident!");
}
return process;
}
}
}