Example #1
0
        /// <summary>
        /// 初始化BassEngine
        /// </summary>
        private void Initialize()
        {
            positionTimer.Interval = TimeSpan.FromMilliseconds(50);
            positionTimer.Tick    += positionTimer_Tick;

            IsPlaying = false;

            Window mainWindow = Application.Current.MainWindow;
            WindowInteropHelper interopHelper = new WindowInteropHelper(mainWindow);

            if (Un4seen.Bass.Bass.BASS_Init(-1, 44100, Un4seen.Bass.BASSInit.BASS_DEVICE_DEFAULT, interopHelper.Handle))
            {
#if DEBUG
                Un4seen.Bass.BASS_INFO info = new Un4seen.Bass.BASS_INFO();
                Un4seen.Bass.Bass.BASS_GetInfo(info);
                Debug.WriteLine(info.ToString());
#endif
            }
            else
            {
                throw new Exception("Bass initialization error : " + Un4seen.Bass.Bass.BASS_ErrorGetCode());
            }

            Un4seen.Bass.Bass.BASS_SetConfig(Un4seen.Bass.BASSConfig.BASS_CONFIG_NET_TIMEOUT, 15000);
        }
Example #2
0
        public static BASS_INFO BASS_GetInfo()
        {
            BASS_INFO info = new BASS_INFO();

            if (BASS_GetInfo(info))
            {
                return(info);
            }
            return(null);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioDecoder" /> class.
        /// </summary>
        /// <exception cref="System.Exception">Bass_Init error!</exception>
        public AudioDecoder()
        {
            BassNet.Registration("*****@*****.**", "2X25317232238");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
            }
            else
                throw new Exception("Bass_Init error!");
        }
Example #4
0
        public BassDecoder()
        {
            BassNet.Registration("*****@*****.**", "2X7362611242534");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
            }
            else
                throw new Exception("Bass_Init error!");
        }
Example #5
0
        public AudioDecoder()
        {
            BassNet.Registration("*****@*****.**", "2X1931821152222");

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero))
            {
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
            }
            else
            {
                throw new Exception("Bass_Init error!");
            }
        }
Example #6
0
 public static BASS_INFO BASS_GetInfo()
 {
     BASS_INFO info = new BASS_INFO();
     if (BASS_GetInfo(info))
     {
         return info;
     }
     return null;
 }
        private void Initialize()
        {
            positionTimer.Interval = TimeSpan.FromMilliseconds(100);
            positionTimer.Tick += new EventHandler(positionTimer_Tick);

            IsPlaying = false;

            Window mainWindow = Application.Current.MainWindow;
            WindowInteropHelper interopHelper = new WindowInteropHelper(mainWindow);

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_SPEAKERS, interopHelper.Handle))
            {
                int pluginAAC = Bass.BASS_PluginLoad("bass_aac.dll");
            #if DEBUG
                BASS_INFO info = new BASS_INFO();
                Bass.BASS_GetInfo(info);
                Debug.WriteLine(info.ToString());
                BASS_PLUGININFO pluginInfo = Bass.BASS_PluginGetInfo(pluginAAC);
                foreach (BASS_PLUGINFORM f in pluginInfo.formats)
                    Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
            #endif
            }
            else
            {
                MessageBox.Show(mainWindow, "Bass initialization error!");
                mainWindow.Close();
            }
        }
 public DSDeviceInfo(BASS_INFO deviceInfo)
 {
     _DeviceInfo = deviceInfo;
 }
Example #9
0
		static BassProxy()
		{
			// Call to avoid the freeware splash screen. Didn't see it, but maybe it will appear if the Forms are used :D
			BassNet.Registration("*****@*****.**", "2X155323152222");
			
			//Dummy calls made for loading the assemblies
			int bassVersion = Bass.BASS_GetVersion();
			int bassMixVersion = BassMix.BASS_Mixer_GetVersion();
			int bassfxVersion = BassFx.BASS_FX_GetVersion();
			
			#if DEBUG
			Debug.WriteLine("Bass Version: {0}, Mix Version: {1}, FX Version: {2}", bassVersion, bassMixVersion, bassfxVersion);
			#endif
			
			//Set Sample Rate / MONO
			//if (Bass.BASS_Init(-1, DEFAULT_SAMPLE_RATE, BASSInit.BASS_DEVICE_SPEAKERS | BASSInit.BASS_DEVICE_MONO | BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
			if (Bass.BASS_Init(-1, DEFAULT_SAMPLE_RATE, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
			{
				// Load the plugins
				int pluginFlac = Bass.BASS_PluginLoad("bassflac.dll");
				int pluginAAC = Bass.BASS_PluginLoad("bass_aac.dll");
				int pluginMPC = Bass.BASS_PluginLoad("bass_mpc.dll");
				int pluginAC3 = Bass.BASS_PluginLoad("bass_ac3.dll");
				int pluginWMA = Bass.BASS_PluginLoad("basswma.dll");
				int pluginAPE = Bass.BASS_PluginLoad("bass_ape.dll");
				
				if (pluginFlac == 0
				    || pluginAAC == 0
				    || pluginMPC == 0
				    || pluginAC3 == 0
				    || pluginWMA == 0
				    || pluginAPE == 0)
					throw new Exception(Bass.BASS_ErrorGetCode().ToString());
				
				#if DEBUG
				BASS_INFO info = new BASS_INFO();
				Bass.BASS_GetInfo(info);
				Debug.WriteLine(info.ToString());
				
				string nativeSupport = Utils.BASSAddOnGetSupportedFileExtensions(null);
				Debug.WriteLine("Native Bass Supported Extensions: " + nativeSupport);
				
				BASS_PLUGININFO flacInfo = Bass.BASS_PluginGetInfo(pluginFlac);
				foreach (BASS_PLUGINFORM f in flacInfo.formats) {
					Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
				}
				BASS_PLUGININFO aacInfo = Bass.BASS_PluginGetInfo(pluginAAC);
				foreach (BASS_PLUGINFORM f in aacInfo.formats) {
					Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
				}
				BASS_PLUGININFO mpcInfo = Bass.BASS_PluginGetInfo(pluginMPC);
				foreach (BASS_PLUGINFORM f in mpcInfo.formats) {
					Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
				}
				BASS_PLUGININFO ac3Info = Bass.BASS_PluginGetInfo(pluginAC3);
				foreach (BASS_PLUGINFORM f in ac3Info.formats) {
					Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
				}
				BASS_PLUGININFO wmaInfo = Bass.BASS_PluginGetInfo(pluginWMA);
				foreach (BASS_PLUGINFORM f in wmaInfo.formats) {
					Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
				}
				BASS_PLUGININFO apeInfo = Bass.BASS_PluginGetInfo(pluginAPE);
				foreach (BASS_PLUGINFORM f in apeInfo.formats) {
					Debug.WriteLine("Type={0}, Name={1}, Exts={2}", f.ctype, f.name, f.exts);
				}

				Dictionary<int, string> loadedPlugIns = new Dictionary<int, string>();
				loadedPlugIns.Add(pluginFlac, "bassflac.dll");
				loadedPlugIns.Add(pluginAAC, "bass_aac.dll");
				loadedPlugIns.Add(pluginMPC, "bass_mpc.dll");
				loadedPlugIns.Add(pluginAC3, "bass_ac3.dll");
				loadedPlugIns.Add(pluginWMA, "basswma.dll");
				loadedPlugIns.Add(pluginAPE, "bass_ape.dll");
				
				string fileSupportedExtFilter = Utils.BASSAddOnGetPluginFileFilter(loadedPlugIns, "All supported Audio Files", true);
				Debug.WriteLine("Bass generated FileFilter: " + fileSupportedExtFilter);
				#endif
			} else {
				throw new Exception(Bass.BASS_ErrorGetCode().ToString());
			}
			
			// Set filter for anti aliasing
			if (!Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_MIXER_FILTER, 50)) {
				throw new Exception(Bass.BASS_ErrorGetCode().ToString());
			}
			
			// Set floating parameters to be passed
			if (!Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_FLOATDSP, true)) {
				throw new Exception(Bass.BASS_ErrorGetCode().ToString());
			}
		}
Example #10
0
        /// <summary>
        /// Gets the BASS information.
        /// </summary>
        /// <returns>BASS_INFO structure</returns>
        public static BASS_INFO GetInfo()
        {
            BASS_INFO info = new BASS_INFO();
            if (!Bass.BASS_GetInfo(info))
            {
                // Check for error (throw exception if the error is found)
                CheckForError();
            }

            return info;
        }
Example #11
0
 public static extern bool BASS_GetInfo([In, Out] BASS_INFO info);
Example #12
0
        /// <summary>
        /// 初始化BassEngine
        /// </summary>
        private void Initialize()
        {
            positionTimer.Interval = TimeSpan.FromMilliseconds(50);
            positionTimer.Tick += positionTimer_Tick;

            downloadTimer.Interval = TimeSpan.FromMilliseconds(100);
            downloadTimer.Tick += downloadTimer_Tick;

            IsPlaying = false;

            Window mainWindow = Application.Current.MainWindow;
            WindowInteropHelper interopHelper = new WindowInteropHelper(mainWindow);

            if (Un4seen.Bass.Bass.BASS_Init(-1, 44100, Un4seen.Bass.BASSInit.BASS_DEVICE_DEFAULT, interopHelper.Handle))
            {
#if DEBUG
                Un4seen.Bass.BASS_INFO info = new Un4seen.Bass.BASS_INFO();
                Un4seen.Bass.Bass.BASS_GetInfo(info);
                Debug.WriteLine(info.ToString());
#endif
            }
            else
            {
                throw new Exception("Bass initialization error : " + Un4seen.Bass.Bass.BASS_ErrorGetCode());
            }

            Un4seen.Bass.Bass.BASS_SetConfig(Un4seen.Bass.BASSConfig.BASS_CONFIG_NET_TIMEOUT, 15000);
        }