private void DefaultOutput_Load(object sender, EventArgs e) { try { if (IsIt) { Text = String.Format(Text, "WASAPI"); } else { Text = String.Format(Text, "DirectSound"); } int selecteddeviceprev = (int)OmniMIDIConfiguratorMain.SynthSettings.GetValue("AudioOutput", 0); SwitchDefaultAudio.Checked = Convert.ToBoolean(OmniMIDIConfiguratorMain.SynthSettings.GetValue("FollowDefaultAudioDevice", 0)); BASS_DEVICEINFO info = new BASS_DEVICEINFO(); DevicesList.Items.Add("Default Windows audio output"); Bass.BASS_GetDeviceInfo(selecteddeviceprev - 1, info); Bass.BASS_GetDeviceInfo(-1, info); if (selecteddeviceprev < 1) { DefOut.Text = String.Format("Def. Windows audio output: Default Windows audio output", info.ToString()); } else { DefOut.Text = String.Format("Def. Windows audio output: {0}", (info.ToString() == "") ? "No devices have been found" : info.ToString()); } for (int n = 0; Bass.BASS_GetDeviceInfo(n, info); n++) { DevicesList.Items.Add(info.ToString()); } try { DevicesList.SelectedIndex = selecteddeviceprev; } catch { DevicesList.SelectedIndex = 0; } DevicesList.SelectedIndexChanged += new System.EventHandler(this.DevicesList_SelectedIndexChanged); } catch (Exception ex) { MessageBox.Show("Unable to load the dialog.\nBASS is probably unable to start, or it's missing.\n\nError:\n" + ex.Message.ToString(), "Oh no! OmniMIDI encountered an error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); Dispose(); } }
/// <summary> /// Get all avialable sound devices /// </summary> /// <param name="comboBox">Fill specified combobox</param> /// <returns></returns> public static void GetAllDevices(ComboBox comboBox) { BASS_DEVICEINFO info = new BASS_DEVICEINFO(); comboBox.Items.Clear(); for (int n = 0; Bass.BASS_GetDeviceInfo(n, info); n++) { comboBox.Items.Add(info.ToString()); } }
private void KeppySynthDefaultOutput_Load(object sender, EventArgs e) { try { int selecteddeviceprev = (int)KeppySynthConfiguratorMain.SynthSettings.GetValue("defaultdev", 0); BASS_DEVICEINFO info = new BASS_DEVICEINFO(); DevicesList.Items.Add("Default Windows audio output"); Bass.BASS_GetDeviceInfo(selecteddeviceprev - 1, info); Bass.BASS_GetDeviceInfo(-1, info); if (selecteddeviceprev < 1) { DefOut.Text = String.Format("Def. Windows audio output: Default Windows audio output", info.ToString()); } else { if (info.ToString() == "") { DefOut.Text = String.Format("Def. Windows audio output: No devices have been found", info.ToString()); } else { DefOut.Text = String.Format("Def. Windows audio output: {0}", info.ToString()); } } for (int n = 0; Bass.BASS_GetDeviceInfo(n, info); n++) { DevicesList.Items.Add(info.ToString()); } try { DevicesList.SelectedIndex = selecteddeviceprev; } catch { DevicesList.SelectedIndex = 0; } DevicesList.SelectedIndexChanged += new System.EventHandler(this.DevicesList_SelectedIndexChanged); } catch (Exception ex) { MessageBox.Show("Unable to load the dialog.\nBASS is probably unable to start, or it's missing.\n\nError:\n" + ex.Message.ToString(), "Oh no! Keppy's Synthesizer encountered an error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); Dispose(); } }
public static void BassInitialize() { if (IsBassInitialized) { return; } IsBassInitialized = true; IsAsioInitialized = false; IsWasapiInitialized = false; BassNet.Registration("*****@*****.**", "2X183372334322"); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 200); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 20); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_FLOATDSP, true); BASS_DEVICEINFO info = new BASS_DEVICEINFO(); for (int n = 0; Bass.BASS_GetDeviceInfo(n, info); n++) { // Console.WriteLine(info.ToString()); if (info.IsEnabled && info.IsDefault) { Console.WriteLine(info.ToString()); m_defaultdevicelongname = info.name; Bass.BASS_SetDevice(n); m_defaultdevice = n; } if (!Bass.BASS_Init(n, 44100, BASSInit.BASS_DEVICE_DEFAULT, PlayerControl.MainFormControl.Handle)) { var error = Bass.BASS_ErrorGetCode(); MessageBox.Show(error.ToString(), "Bass_Init error!"); // return; } } // already create a mixer //m_mixerChannel = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT); m_mixerChannel = MixerStreamCreate(44100); if (m_mixerChannel == 0) { var error = Bass.BASS_ErrorGetCode(); MessageBox.Show(error.ToString(), "Could not create mixer!"); Bass.BASS_Free(); return; } }
public static void Init() { #region dumb obfuscation for email and registration key, just to prevent bots. byte obfu = 0xDA; byte[] eml = new byte[] { 0xBE, 0xBB, 0xB4, 0xBF, 0x9A, 0xA2, 0xBB, 0xA3, 0xA8, 0xF4, 0xBD, 0xBB, }; byte[] rkey = new byte[] { 0xE8, 0x82, 0xE3, 0xE9, 0xE8, 0xE9, 0xEB, 0xE8, 0xEE, 0xE9, 0xE9, }; for (int i = 0; i < eml.Length; i++) { eml[i] ^= (obfu); } for (int i = 0; i < rkey.Length; i++) { rkey[i] ^= (obfu); } #endregion Un4seen.Bass.BassNet.Registration(Encoding.ASCII.GetString(eml), Encoding.ASCII.GetString(rkey)); // Registration code, feel free to email me. // Note that because of this, JaiSeqX cannot be used for commercial purposes. Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero); // Initialize audio engine BassFx.LoadMe(); // Load the effects library globalLoopProc = new SYNCPROC(DoLoop); // Create our loop proc to bind audio objects to, global and static so it doesn't get collected. g_FadeFreeProc = new SYNCPROC(FadeCollect); BASS_DEVICEINFO info = new BASS_DEVICEINFO(); // Print device info. for (int n = 0; Bass.BASS_GetDeviceInfo(n, info); n++) { Console.WriteLine(info.ToString()); } }