Example #1
0
        public LSVorbis(LSSettings settings, LSPcmFeed pimp) : base()
        {
            logger = Logger.ogg;

            this.pimp     = pimp;
            this.settings = settings;
            logger.a("creating oggenc object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName               = Program.tools + "oggenc2.exe";
            proc.StartInfo.WorkingDirectory       = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardInput  = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments              = string.Format(
                "-Q -R 44100 {0} {1} {2} " +               //.................target params
                "-r -F 1 -B 16 -C 2 --raw-endianness 0 -", //...source params
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? "-b" : "-q"),
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? settings.ogg.bitrate : settings.ogg.quality),
                (settings.ogg.channels == LSSettings.LSChannels.stereo ? "" : "--downmix"));

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting oggenc");
            proc.Start();
            while (true)
            {
                logger.a("waiting for oggenc");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1)
                    {
                        break;
                    }

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }

            /*foreach (System.Diagnostics.ProcessModule mod in proc.Modules)
             * {
             *  Console.WriteLine(mod.ModuleName + " // " + mod.FileName);
             * }*/
            logger.a("oggenc running");
            pstdin  = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump    = settings.recOgg;
            enc     = settings.ogg;
            makeShouter();
        }
Example #2
0
        public LSVorbis(LSSettings settings, LSPcmFeed pimp)
            : base()
        {
            logger = Logger.ogg;

            this.pimp = pimp;
            this.settings = settings;
            logger.a("creating oggenc object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName = Program.tools + "oggenc2.exe";
            proc.StartInfo.WorkingDirectory = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow = true;
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardInput = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments = string.Format(
                "-Q -R 44100 {0} {1} {2} " + //.................target params
                "-r -F 1 -B 16 -C 2 --raw-endianness 0 -", //...source params
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? "-b" : "-q"),
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? settings.ogg.bitrate : settings.ogg.quality),
                (settings.ogg.channels == LSSettings.LSChannels.stereo ? "" : "--downmix"));

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting oggenc");
            proc.Start();
            while (true)
            {
                logger.a("waiting for oggenc");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1) break;

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            /*foreach (System.Diagnostics.ProcessModule mod in proc.Modules)
            {
                Console.WriteLine(mod.ModuleName + " // " + mod.FileName);
            }*/
            logger.a("oggenc running");
            pstdin = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump = settings.recOgg;
            enc = settings.ogg;
            makeShouter();
        }
Example #3
0
        public LSLame(LSSettings settings, LSPcmFeed pimp)
        {
            logger = Logger.mp3;

            this.pimp     = pimp;
            this.settings = settings;
            logger.a("creating lame object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName               = Program.tools + "lame.exe";
            proc.StartInfo.WorkingDirectory       = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardInput  = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments              = string.Format(
                "{0} {1} -h -m {2} --noreplaygain -S " +                //..................target params
                "-r -s {3} --bitwidth 16 --signed --little-endian - -", //...source params
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? "--preset cbr" : "-V"),
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? settings.mp3.bitrate : settings.mp3.quality),
                (settings.mp3.channels == LSSettings.LSChannels.stereo ? "j" : "s -a"),
                settings.samplerate);

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting lame");
            proc.Start();
            while (true)
            {
                logger.a("waiting for lame");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1)
                    {
                        break;
                    }

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            logger.a("lame running");
            pstdin  = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump    = settings.recMp3;
            enc     = settings.mp3;
            makeShouter();
        }
Example #4
0
        public LSOpus(LSSettings settings, LSPcmFeed pimp) : base()
        {
            logger = Logger.opus;

            this.pimp     = pimp;
            this.settings = settings;
            logger.a("creating opusenc object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName               = Program.tools + "opusenc.exe";
            proc.StartInfo.WorkingDirectory       = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardInput  = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments              = string.Format(
                "--quiet --bitrate {1} --raw --raw-rate {0} {2} - -",
                settings.samplerate,
                settings.opus.quality,
                (settings.opus.channels == LSSettings.LSChannels.stereo ? "--downmix-stereo" : "--downmix-mono"));

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting opusenc");
            proc.Start();
            while (true)
            {
                logger.a("waiting for opusenc");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1)
                    {
                        break;
                    }

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            logger.a("opusenc running");
            pstdin  = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump    = settings.recOpus;
            enc     = settings.opus;
            makeShouter();
        }
Example #5
0
        public LSLame(LSSettings settings, LSPcmFeed pimp)
        {
            logger = Logger.mp3;

            this.pimp = pimp;
            this.settings = settings;
            logger.a("creating lame object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName = Program.tools + "lame.exe";
            proc.StartInfo.WorkingDirectory = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow = true;
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardInput = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments = string.Format(
                "{0} {1} -h -m {2} --noreplaygain -S " + //..................target params
                "-r -s {3} --bitwidth 16 --signed --little-endian - -", //...source params
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? "--preset cbr" : "-V"),
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? settings.mp3.bitrate : settings.mp3.quality),
                (settings.mp3.channels == LSSettings.LSChannels.stereo ? "j" : "s -a"),
                settings.samplerate);

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting lame");
            proc.Start();
            while (true)
            {
                logger.a("waiting for lame");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1) break;

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            logger.a("lame running");
            pstdin = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump = settings.recMp3;
            enc = settings.mp3;
            makeShouter();
        }
Example #6
0
 public LSEncoder()
 {
     stdin = stdout = pstdin = pstdout = null;
     s = null;
     tc = null;
     enc = null;
     proc = null;
     pimp = null;
     dump = false;
     settings = null;
     crashed = false;
     locker = new object();
     rekick = 0;
 }
Example #7
0
 public LSEncoder()
 {
     stdin    = stdout = pstdin = pstdout = null;
     s        = null;
     tc       = null;
     enc      = null;
     proc     = null;
     pimp     = null;
     dump     = false;
     settings = null;
     crashed  = false;
     locker   = new object();
     rekick   = 0;
 }
Example #8
0
        void connect()
        {
            if (settings.devRec == null || settings.devOut == null)
            {
                if (DialogResult.OK == MessageBox.Show(
                    "Please take a minute to adjust your settings\n\n(soundcard and radio server)",
                    "Audio endpoint is null", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
                {
                    gSettings_Click(null, null);

                    if (settings.devRec == null || settings.devOut == null)
                    {
                        MessageBox.Show("Config is still invalid.\n\nGiving up.", "Crit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else return;
            }

            if (settings.testDevs && (
                    settings.devOut == null ||
                    settings.devRec == null ||
                    settings.devOut.wf == null ||
                    settings.devRec.wf == null || (
                    settings.devMic != null &&
                    settings.devMic.id != null &&
                    settings.devMic.wf == null)))
            {
                // TODO: Fix devMic != null when disabled (deserializing bug?)

                MessageBox.Show("The soundcard devices you selected have been disabled or removed." +
                    "\r\n\r\nPlease check your privilege...uh, settings before connecting.",
                    "oh snap n***a", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Program.ni.ContextMenu.MenuItems[1].Text = "Disconnect";
            daText = "D I S C O N N E C T";
            gConnect.Text = daText;
            tag = new LSTag(settings);
            mixer = new LSMixer(settings, new LLabel[] { gMus.giSlider, gMic.giSlider, gOut.giSlider });
            pcm = new LSPcmFeed(settings, mixer.lameOutlet);
            assumeConnected = true;
        }