Exemplo n.º 1
0
 private void InitializeBass()
 {
     if (!_initialized)
     {
         BassException.CheckBoolResult(NativeMethods.BASS_Init(-1, 44100, BassDeviceFlags.Default, _hWnd));
         _initialized = true;
     }
 }
Exemplo n.º 2
0
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            BassException.CheckBoolResult(NativeMethods.BASS_Free());

            _disposed = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Registers the specified plugin.
        /// </summary>
        /// <param name="pluginName">The plugin name (do not provide any extension)</param>
        public void Register(string pluginName)
        {
            string fullPath = Path.Combine(BaseDirectory, pluginName + ".dll");

            if (!File.Exists(fullPath))
            {
                throw new FileNotFoundException("Could not find the plugin file.", fullPath);
            }
            SafePluginHandle pluginHandle = BassException.CheckHandleResult(NativeMethods.BASS_PluginLoad(fullPath, BassFlags.Unicode));

            _registeredPlugins.Add(fullPath, pluginHandle);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the specified media file.
        /// </summary>
        /// <param name="fileName">Name of the file to load.</param>
        public void Load(string fileName)
        {
            CheckNotDisposed();
            InitializeBass();

            if (_currentStream != null)
            {
                // Unload previous stream
                _currentStream.Dispose();
                _currentStream = null;
            }

            _currentStream = BassException.CheckHandleResult(NativeMethods.BASS_StreamCreateFile(false, fileName, 0, 0, BassFlags.Unicode));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Stops playing the currently loaded media
 /// </summary>
 public void Stop()
 {
     CheckNotDisposed();
     CheckMediaLoaded();
     BassException.CheckBoolResult(NativeMethods.BASS_ChannelStop(_currentStream));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Starts or resumes the currently loaded media.
 /// </summary>
 public void Play()
 {
     CheckNotDisposed();
     CheckMediaLoaded();
     BassException.CheckBoolResult(NativeMethods.BASS_ChannelPlay(_currentStream, false));
 }