private static void InitObs() { try { Debug.WriteLine("libobs version: " + Obs.GetVersion()); // forward OBS logging messages to debugger Obs.SetLogHandler((lvl, msg, p) => { Debug.WriteLine(msg); }); if (!Obs.Startup("en-US")) throw new ApplicationException("Startup failed."); // initialize video libobs.obs_video_info ovi = new libobs.obs_video_info { adapter = 0, base_width = (uint)MainWidth, base_height = (uint)MainHeight, fps_num = 30000, fps_den = 1001, graphics_module = "libobs-d3d11", output_format = libobs.video_format.VIDEO_FORMAT_RGBA, output_width = (uint)MainWidth, output_height = (uint)MainHeight, }; if (!Obs.ResetVideo(ovi)) throw new ApplicationException("ResetVideo failed."); // initialize audio libobs.obs_audio_info avi = new libobs.obs_audio_info { samples_per_sec = 44100, speakers = libobs.speaker_layout.SPEAKERS_STEREO, //buffer_ms = 1000 }; if (!Obs.ResetAudio(avi)) throw new ApplicationException("ResetAudio failed."); // load all plugins and modules Obs.LoadAllModules(); } catch (BadImageFormatException exp) { MessageBox.Show("Platform target mismatch: " + (Environment.Is64BitProcess ? "Loading 32-bit OBS with 64-bit executable is not supported." : "Loading 64-bit OBS with 32-bit executable is not supported.") + "\n\n" + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } }
private static void InitObs() { try { Debug.WriteLine("libobs version: " + Obs.GetVersion()); // forward OBS logging messages to debugger Obs.SetLogHandler((lvl, msg, p) => { Debug.WriteLine(msg); }); if (!Obs.Startup("en-US")) { throw new ApplicationException("Startup failed."); } // initialize video libobs.obs_video_info ovi = new libobs.obs_video_info { adapter = 0, base_width = (uint)MainWidth, base_height = (uint)MainHeight, fps_num = 30000, fps_den = 1001, graphics_module = "libobs-d3d11", output_format = libobs.video_format.VIDEO_FORMAT_RGBA, output_width = (uint)MainWidth, output_height = (uint)MainHeight, }; if (!Obs.ResetVideo(ovi)) { throw new ApplicationException("ResetVideo failed."); } // initialize audio libobs.obs_audio_info avi = new libobs.obs_audio_info { samples_per_sec = 44100, speakers = libobs.speaker_layout.SPEAKERS_STEREO, //buffer_ms = 1000 }; if (!Obs.ResetAudio(avi)) { throw new ApplicationException("ResetAudio failed."); } // load all plugins and modules Obs.LoadAllModules(); } catch (BadImageFormatException exp) { MessageBox.Show("Platform target mismatch: " + (FX35Helper.Is64BitProcess() ? "Loading 32-bit OBS with 64-bit executable is not supported." : "Loading 64-bit OBS with 32-bit executable is not supported.") + "\n\n" + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } }
public static libobs.obs_audio_info GetAudioInfo() { libobs.obs_audio_info ai = new libobs.obs_audio_info(); bool ret = libobs.obs_get_audio_info(ref ai); if (!ret) throw new ApplicationException("obs_get_audio_info failed"); return ai; }