static void Main(string[] args) { BassNet.Registration("*****@*****.**", "2X1837515183722"); BassNet.OmitCheckVersion = true; if (!Bass.LoadMe()) { System.Windows.Forms.MessageBox.Show("Unable to load bass.dll!", "Error", System.Windows.Forms.MessageBoxButtons.OK); return; } if (!Bass.BASS_Init(0, 48000, 0, IntPtr.Zero)) { System.Windows.Forms.MessageBox.Show("Unable to initialize the BASS library!", "Error", System.Windows.Forms.MessageBoxButtons.OK); } if (!BassWasapi.LoadMe()) { System.Windows.Forms.MessageBox.Show("Unable to load BassWasapi.dll!", "Error", System.Windows.Forms.MessageBoxButtons.OK); } Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); mainForm mainForm = new mainForm(); Application.Run(mainForm); }
static BeatDetector() { byte[] hex = { 0x74, 0x68, 0x69, 0x6A, 0x73, 0x40, 0x62, 0x72, 0x6F, 0x6B, 0x65, 0x6E, 0x77, 0x69, 0x72, 0x65, 0x2E, 0x6E, 0x65, 0x74, 0x2D, 0x32, 0x58, 0x31, 0x38, 0x33, 0x31, 0x32, 0x38, 0x32, 0x30, 0x31, 0x31, 0x33, 0x37, 0x31, 0x38 }; string[] str = ASCIIEncoding.ASCII.GetString(hex).Split('-'); BassNet.Registration(str[0], str[1]); Bass.LoadMe(); BassWasapi.LoadMe(); BassFx.LoadMe(); }
private BassEngine() { //Setup Bass bullshit BassNet.Registration("*****@*****.**", "2X1837515183722"); BassNet.OmitCheckVersion = true; Bass.LoadMe(); Bass.BASS_Init(0, 48000, 0, IntPtr.Zero); BassWasapi.LoadMe(); if (!Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_SPEAKERS, Process.GetCurrentProcess().MainWindowHandle)) { Console.WriteLine("Bass initialization error!"); } #region WASAPI int WASAPIDeviceIndex = -100; var devices = BassWasapi.BASS_WASAPI_GetDeviceInfos(); for (int i = 0; i < devices.Length; i++) { if (devices[i].IsEnabled && devices[i].SupportsRecording && devices[i].IsLoopback) { WASAPIDeviceIndex = i; break; } } if (WASAPIDeviceIndex != -100) { BASS_WASAPI_DEVICEINFO devInfo = devices[WASAPIDeviceIndex]; if (devInfo.IsInitialized) { Console.WriteLine("Deinitializing WASAPI device"); BassWasapi.BASS_WASAPI_Stop(true); BassWasapi.BASS_WASAPI_Free(); } if (!BassWasapi.BASS_WASAPI_Init(WASAPIDeviceIndex, devInfo.mixfreq, devInfo.mixchans, BASSWASAPIInit.BASS_WASAPI_AUTOFORMAT | BASSWASAPIInit.BASS_WASAPI_BUFFER, 0f, 0f, new WASAPIPROC(delegate(IntPtr buffer, int length, IntPtr user) { return(1); }), IntPtr.Zero)) { BASSError error = Bass.BASS_ErrorGetCode(); } if (!BassWasapi.BASS_WASAPI_Start()) { BASSError error = Bass.BASS_ErrorGetCode(); } IsPlaying = true; } else { IsPlaying = false; } #endregion WASAPI }
/// <summary> /// BASSを初期化する /// </summary> public void init() { // Bass.Net のスプラッシュ スクリーンを抑止 BassNet.Registration("*****@*****.**", "2X29142420162918"); // Bass.Net if (!Bass.LoadMe(Application.StartupPath + "\\lib\\bass")) { throw new LinearAudioPlayerException("Bass.Net の初期化に失敗しました。"); } // デバイス初期化 int i = 0; for (i = 0; i < 10; i++) { if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)) { break; } } if (i == 10) { var error = Bass.BASS_ErrorGetCode(); throw new LinearAudioPlayerException("デバイスの初期化に失敗しました。\nError : " + error.ToString()); } // プラグイン _loadPlugins = Bass.BASS_PluginLoadDirectory(Application.StartupPath + LinearConst.BASS_PLUGIN_DIRECTORY_NAME); if (BassWasapi.LoadMe(Application.StartupPath + LinearConst.BASS_PLUGIN_DIRECTORY_NAME)) { BassWasapi.BASS_WASAPI_Init(-1, 0, 0, BASSWASAPIInit.BASS_WASAPI_SHARED, 0.5F, 0, null, IntPtr.Zero); if (BassWasapi.BASS_WASAPI_Start()) { enablewasapi = true; } else { enablewasapi = false; } } else { enablewasapi = false; } }
public static void InitializeBass() { BassNet.Registration("*****@*****.**", "2X1837515183722"); BassNet.OmitCheckVersion = true; if (!Bass.LoadMe()) { throw new WASAPIInitializationException("Unable to load bass.dll!"); } if (!Bass.BASS_Init(0, 48000, 0, IntPtr.Zero)) { throw new WASAPIInitializationException("Unable to initialize the BASS library!"); } if (!BassWasapi.LoadMe()) { throw new WASAPIInitializationException("Unable to load BassWasapi.dll!"); } Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0); }