Ejemplo n.º 1
0
        public HttpInfinitePlaySource(string address, DownloadTypes downloadMode,
            IEventAggregator positionEventAggregator)
        {
            OnGetPosition += RefreshPositions;
            _positionEventAggregator = positionEventAggregator;
            _subscriptionToken = _positionEventAggregator.GetEvent<HttpPositionEvent>().Subscribe(GetReadPosition);
            _downloadType = downloadMode;
            _downloadProcURL = (_downloadType == DownloadTypes.NoDownload)
                ? null
                : new DOWNLOADPROC(DownloadProc);

            Path = address;

            DownloadStream = Bass.BASS_StreamCreateURL(Path, 0,
                BASSFlag.BASS_STREAM_AUTOFREE|BASSFlag.BASS_STREAM_STATUS |BASSFlag.BASS_SAMPLE_FLOAT, _downloadProcURL, IntPtr.Zero);

            BASSError error = Bass.BASS_ErrorGetCode();

            if (DownloadStream == 0)
                throw new ArgumentException("Parameter cannot be null", error.ToString());

            _syncProcMeta = new SYNCPROC(SyncMethodMeta);

            Bass.BASS_ChannelSetSync(DownloadStream, BASSSync.BASS_SYNC_WMA_META, 0, _syncProcMeta, IntPtr.Zero);
            Bass.BASS_ChannelSetSync(DownloadStream, BASSSync.BASS_SYNC_OGG_CHANGE, 0, _syncProcMeta, IntPtr.Zero);
            Bass.BASS_ChannelSetSync(DownloadStream, BASSSync.BASS_SYNC_META, 0, _syncProcMeta, IntPtr.Zero);
            Bass.BASS_ChannelSetSync(DownloadStream, BASSSync.BASS_SYNC_WMA_CHANGE, 0, _syncProcMeta, IntPtr.Zero);

            _previousTags = new List<Tag>();
            Tags = new TrackTags(DownloadStream, SourceType);
            Tags.GetIcyMetaTags(DownloadStream);
            ChannelInfo = Bass.BASS_ChannelGetInfo(DownloadStream);

            if (ProcessMusic())
            {
                _bufferFileStream = new FileStream("RadioBuffer", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                _DSPHandler = new DSPPROC(DSPProc);
                _streamProc = new STREAMPROC(StreamRead);
                DSP = Bass.BASS_ChannelSetDSP(DownloadStream, _DSPHandler, IntPtr.Zero, 0);
                Stream = Bass.BASS_StreamCreate(ChannelInfo.freq, ChannelInfo.chans,
                    BASSFlag.BASS_STREAM_DECODE|BASSFlag.BASS_SAMPLE_FLOAT, _streamProc, IntPtr.Zero);

                Bass.BASS_ChannelPlay(DownloadStream, false);
                Bass.BASS_ChannelSetAttribute(DownloadStream, BASSAttribute.BASS_ATTRIB_VOL, 0);
                StreamFX = BassFx.BASS_FX_TempoCreate(Stream, BASSFlag.BASS_FX_FREESOURCE | BASSFlag.BASS_SAMPLE_FX);
            }
            else
            {
                error = Bass.BASS_ErrorGetCode();
                throw new ArgumentException("Parameter cannot be null", error.ToString());
            }
        }
Ejemplo n.º 2
0
        public HttpFinitePlaySource(string address, IEventAggregator waveFormEventAggregator)
        {
            OnGetWaveForm += EndDownload;
            _waveFormEventAggregator = waveFormEventAggregator;
            _downloadProc = new DOWNLOADPROC(Download);
            Path = address;

            Stream = Bass.BASS_StreamCreateURL(Path, 0,
                BASSFlag.BASS_STREAM_DECODE|BASSFlag.BASS_SAMPLE_FLOAT|BASSFlag.BASS_STREAM_PRESCAN,
                _downloadProc, IntPtr.Zero);
            Tags = new TrackTags(Stream, SourceType);
            StreamFX = BassFx.BASS_FX_TempoCreate(Stream, BASSFlag.BASS_FX_FREESOURCE | BASSFlag.BASS_SAMPLE_FX);
            ChannelInfo = Bass.BASS_ChannelGetInfo(StreamFX);
            Console.WriteLine("Chans - {0}, Ctype - {1}, Flags - {2}, Freq - {3}", ChannelInfo.chans, ChannelInfo.ctype, ChannelInfo.flags, ChannelInfo.freq);
        }
Ejemplo n.º 3
0
        private void NetRadio_Load(object sender, System.EventArgs e)
        {
            //BassNet.Registration("your email", "your regkey");

            // check the version..
            if (Utils.HighWord(Bass.BASS_GetVersion()) != Bass.BASSVERSION)
            {
                MessageBox.Show(this, "Wrong Bass Version!");
            }

            // stupid thing here as well, just to demo...
            //string userAgent = Bass.BASS_GetConfigString(BASSConfig.BASS_CONFIG_NET_AGENT);

            Bass.BASS_SetConfigPtr(BASSConfig.BASS_CONFIG_NET_AGENT, _myUserAgentPtr);

            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PREBUF, 0); // so that we can display the buffering%
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PLAYLIST, 1);

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle))
            {
                // Some words about loading add-ons:
                // In order to set an add-on option with BASS_SetConfig, we need to make sure, that the
                // library (in this case basswma.dll) is actually loaded!
                // However, an external library is dynamically loaded in .NET with the first call
                // to one of it's methods...
                // As BASS will only know about additional config options once the lib has been loaded,
                // we need to make sure, that the lib is loaded before we make the following call.
                // 1) Loading a lib manually :
                // BassWma.LoadMe();  // basswma.dll must be in same directory
                // 2) Using the BASS PlugIn system (recommended):
                _wmaPlugIn = Bass.BASS_PluginLoad("basswma.dll");
                // 3) ALTERNATIVLY you might call any 'dummy' method to load the lib!
                //int[] cbrs = BassWma.BASS_WMA_EncodeGetRates(44100, 2, BASSWMAEncode.BASS_WMA_ENCODE_RATES_CBR);
                // now basswma.dll is loaded and the additional config options are available...

                if (Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_WMA_PREBUF, 0) == false)
                {
                    Console.WriteLine("ERROR: " + Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode()));
                }
                // we alraedy create the user callback methods...
                myStreamCreateURL = new DOWNLOADPROC(MyDownloadProc);
            }
            else
            {
                MessageBox.Show(this, "Bass_Init error!");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file on the internet, optionally receiving the downloaded data in a callback function.
        /// </summary>
        /// <param name="url">URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server;
        /// the URL and each header should be terminated with a carriage return and line feed ("\r\n"). </param>
        /// <param name="offset">File position to start streaming from. This is ignored by some servers, specifically when the length is unknown/undefined.</param>
        /// <param name="flags">A combination of these flags.</param>
        /// <param name="proc">Callback function to receive the file as it is downloaded... NULL = no callback. </param>
        /// <param name="user">User instance data to pass to the callback function. </param>
        /// <returns>If successful, the new stream's handle is returned, else throw WavException</returns>
        public static int StreamCreateURL(string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
        {
            flags |= BASSFlag.BASS_DEFAULT | BASSFlag.BASS_UNICODE;
            int handle = NativeMethods.BASS_StreamCreateURLUnicode(url, offset, flags, proc, user);

            if (handle == 0)
            {
                flags &= BASSFlag.BASS_ASYNCFILE | BASSFlag.BASS_SPEAKER_REAR2RIGHT | BASSFlag.BASS_SPEAKER_CENTER | BASSFlag.BASS_SPEAKER_PAIR8 | BASSFlag.BASS_MIDI_SINCINTER | BASSFlag.BASS_AAC_STEREO | BASSFlag.BASS_MUSIC_DECODE | BASSFlag.BASS_MUSIC_NOSAMPLE | BASSFlag.BASS_MIDI_FONT_NOFX | BASSFlag.BASS_MIDI_FONT_XGDRUMS | BASSFlag.BASS_SAMPLE_OVER_DIST | BASSFlag.BASS_MIDI_NOCROP | BASSFlag.BASS_MIDI_DECAYSEEK | BASSFlag.BASS_MIDI_NOFX | BASSFlag.BASS_AAC_FRAME960 | BASSFlag.BASS_AC3_DYNAMIC_RANGE | BASSFlag.BASS_AC3_DOWNMIX_DOLBY | BASSFlag.BASS_MUSIC_FLOAT | BASSFlag.BASS_MUSIC_FX | BASSFlag.BASS_SAMPLE_VAM | BASSFlag.BASS_SAMPLE_MUTEMAX | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_MUSIC_3D | BASSFlag.BASS_MUSIC_LOOP | BASSFlag.BASS_FX_BPM_MULT2 | BASSFlag.BASS_FX_BPM_BKGRND;
                handle = NativeMethods.BASS_StreamCreateURLAscii(url, offset, flags, proc, user);
            }

            if (handle == 0)
            {
                throw new WavException(BassErrorCode.GetErrorInfo());
            }

            return(handle);
        }
Ejemplo n.º 5
0
 public static int BASS_WV_StreamCreateURL(string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
 {
     flags |= BASSFlag.BASS_UNICODE;
     return(BassWv.BASS_WV_StreamCreateURLUnicode(url, offset, flags, proc, user));
 }
Ejemplo n.º 6
0
 private static extern int BASS_MIDI_StreamCreateURLAscii([MarshalAs(UnmanagedType.LPStr)][In] string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user, int freq);
Ejemplo n.º 7
0
        public void init()
        {
            if (WinPOP.init_ok)
            {
                return;
            }
            _myUserAgentPtr = Marshal.StringToHGlobalAnsi(_myUserAgent);

            //BassNet.Registration("your email", "your regkey");

            // check the version..
            try
            {
                if (Utils.HighWord(Bass.BASS_GetVersion()) != Bass.BASSVERSION)
                {
                    System.Windows.MessageBox.Show("Ошибка bass.dll");
                    while (true)
                    {
                        Thread.Sleep(5000);
                    }
                }
            }
            catch
            {
                System.Windows.MessageBox.Show("Ошибка bass.dll");
                while (true)
                {
                    Thread.Sleep(5000);
                }
            }

            // stupid thing here as well, just to demo...
            //string userAgent = Bass.BASS_GetConfigString(BASSConfig.BASS_CONFIG_NET_AGENT);

            Bass.BASS_SetConfigPtr(BASSConfig.BASS_CONFIG_NET_AGENT, _myUserAgentPtr);

            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PREBUF, 0); // so that we can display the buffering%
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PLAYLIST, 1);

            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
            {
                // Some words about loading add-ons:
                // In order to set an add-on option with BASS_SetConfig, we need to make sure, that the
                // library (in this case basswma.dll) is actually loaded!
                // However, an external library is dynamically loaded in .NET with the first call
                // to one of it's methods...
                // As BASS will only know about additional config options once the lib has been loaded,
                // we need to make sure, that the lib is loaded before we make the following call.
                // 1) Loading a lib manually :
                BassWma.LoadMe();                   // basswma.dll must be in same directory
                // 2) Using the BASS PlugIn system (recommended):
                //_wmaPlugIn = Bass.BASS_PluginLoad( "basswma.dll" );
                // 3) ALTERNATIVLY you might call any 'dummy' method to load the lib!
                //int[] cbrs = BassWma.BASS_WMA_EncodeGetRates(44100, 2, BASSWMAEncode.BASS_WMA_ENCODE_RATES_CBR);
                // now basswma.dll is loaded and the additional config options are available...

                if (Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_WMA_PREBUF, 0) == false)
                {
                    System.Windows.MessageBox.Show("Ошибка Bass_Init " + Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode()));
                }
                // we alraedy create the user callback methods...
                myStreamCreateURL = new DOWNLOADPROC(MyDownloadProc);
                WinPOP.init_ok    = true;
            }
            else
            {
                System.Windows.MessageBox.Show("Bass_Init error!");
            }
        }
Ejemplo n.º 8
0
        public bool Init()
        {
            IntPtr handle = IntPtr.Zero;

            string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string targetPath;

            if (Un4seen.Bass.Utils.Is64Bit)
            {
                targetPath = Path.Combine(appPath, "lib/x64");
            }
            else
            {
                targetPath = Path.Combine(appPath, "lib/x86");
            }

            // EXTERNAL PATH SEEMS TO NOT LONGER WORK
            targetPath = appPath;

            this.LibPath = targetPath;

            bool isBassLoadOk    = Bass.LoadMe(targetPath);
            bool isBassMixLoadOk = BassMix.LoadMe(targetPath);

            if (!(isBassLoadOk && isBassMixLoadOk))
            {
                throw new Exception(String.Format("Init error: {0}", Bass.BASS_ErrorGetCode().ToString()));
            }

            this.PluginsLoaded = Bass.BASS_PluginLoadDirectory(targetPath);

            const string allSupportedAudioFilesWord = "All supported Audio Files";
            const string playlistExtFilter          = "*.pls;*.m3u;*.impls";

            string fileSupportedExtFilter = Un4seen.Bass.Utils.BASSAddOnGetPluginFileFilter(PluginsLoaded, allSupportedAudioFilesWord);

            Regex allSupportedFilesPattern = new Regex(allSupportedAudioFilesWord + @"\|(.*?)\|");
            Match match = allSupportedFilesPattern.Match(fileSupportedExtFilter);

            string allSupportedFiles = match.Value;

            allSupportedFiles = String.Format("{0};{1}|", allSupportedFiles.Substring(0, allSupportedFiles.Length - 1), playlistExtFilter);

            fileSupportedExtFilter = fileSupportedExtFilter.Replace(match.Value, allSupportedFiles);

            fileSupportedExtFilter += String.Format("|Playlist|{0}", playlistExtFilter);

            this.FileSupportedExtFilter = fileSupportedExtFilter;

            bool config = Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PLAYLIST, 0);

            downloadProc = new DOWNLOADPROC(DownloadProcCallback);

            BASS_DEVICEINFO[] devices = Bass.BASS_GetDeviceInfos();

            int devnum = 0;

            foreach (BASS_DEVICEINFO device in devices)
            {
                bool init = Bass.BASS_Init(devnum++, 44100, BASSInit.BASS_DEVICE_DEFAULT, handle);
                if (!init)
                {
                    throw new Exception(String.Format("Init error: {0}", Bass.BASS_ErrorGetCode().ToString()));
                }
            }

            return(true);
        }
Ejemplo n.º 9
0
 public static extern uint BASS_StreamCreateURL(string url, uint offset, uint flags, DOWNLOADPROC proc, IntPtr user);
Ejemplo n.º 10
0
        public static int BASS_AAC_StreamCreateURL(string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
        {
            flags |= BASSFlag.BASS_UNICODE;
            int num = BassAac.BASS_AAC_StreamCreateURLUnicode(url, offset, flags, proc, user);

            if (num == 0)
            {
                flags &= (BASSFlag.BASS_SAMPLE_8BITS | BASSFlag.BASS_SAMPLE_MONO | BASSFlag.BASS_SAMPLE_LOOP | BASSFlag.BASS_SAMPLE_3D | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_SAMPLE_MUTEMAX | BASSFlag.BASS_SAMPLE_VAM | BASSFlag.BASS_SAMPLE_FX | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_RECORD_PAUSE | BASSFlag.BASS_RECORD_ECHOCANCEL | BASSFlag.BASS_RECORD_AGC | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_STREAM_RESTRATE | BASSFlag.BASS_STREAM_BLOCK | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_STATUS | BASSFlag.BASS_SPEAKER_FRONT | BASSFlag.BASS_SPEAKER_REAR | BASSFlag.BASS_SPEAKER_REAR2 | BASSFlag.BASS_SPEAKER_LEFT | BASSFlag.BASS_SPEAKER_RIGHT | BASSFlag.BASS_SPEAKER_PAIR8 | BASSFlag.BASS_ASYNCFILE | BASSFlag.BASS_SAMPLE_OVER_VOL | BASSFlag.BASS_WV_STEREO | BASSFlag.BASS_AC3_DOWNMIX_2 | BASSFlag.BASS_AC3_DOWNMIX_4 | BASSFlag.BASS_AC3_DYNAMIC_RANGE | BASSFlag.BASS_AAC_FRAME960);
                num    = BassAac.BASS_AAC_StreamCreateURLAscii(url, offset, flags, proc, user);
            }
            return(num);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file on the internet, optionally receiving the downloaded data in a callback function
 /// </summary>
 /// <param name="url">URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and each header should be terminated with a carriage return and line feed ("\r\n"). </param>
 /// <param name="offset">File position to start streaming from. This is ignored by some servers, specifically when the length is unknown/undefined</param>
 /// <param name="flags">A combination of these flags</param>
 /// <param name="proc">Callback function to receive the file as it is downloaded... NULL = no callback</param>
 /// <param name="user">User instance data to pass to the callback function</param>
 /// <returns>If successful, the new stream's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code</returns>
 public static int BASS_StreamCreateURL(string url, int offset, BASSUrlFlag flags, DOWNLOADPROC proc, IntPtr user)
 {
     if (Environment.Is64BitProcess)
     {
         return(BassX64.BASS_StreamCreateURL(url, offset, flags, proc, user));
     }
     else
     {
         return(BassX86.BASS_StreamCreateURL(url, offset, flags, proc, user));
     }
 }
Ejemplo n.º 12
0
 public static extern int BASS_StreamCreateURL([In, MarshalAs(UnmanagedType.LPWStr)] string url, int offset, BASSUrlFlag flags, DOWNLOADPROC proc, IntPtr user);
Ejemplo n.º 13
0
        private void setup()
        {
            streamRef = 0;

            controller.RequestAction(QActionType.Resumed);

            int maxLoops = 4;

            for (int i = 0; (i < maxLoops) && (streamRef == 0); i++)
            {
                streamRef = Bass.BASS_StreamCreateURL(station.URL, 0, BASSFlag.BASS_STREAM_STATUS | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT, myStreamCreateURL, IntPtr.Zero);

                if (closing)
                {
                    controller.RequestAction(QActionType.Stop);
                    return;
                }

                if (streamRef == 0)
                {
                    isWMA     = true;
                    streamRef = BassWma.BASS_WMA_StreamCreateURL(station.URL, 0, 0, BASSFlag.BASS_STREAM_STATUS | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
                }

                if (closing)
                {
                    controller.RequestAction(QActionType.Stop);
                    return;
                }

                if (streamRef == 0 && i < maxLoops - 1)
                {
                    System.Threading.Thread.Sleep(500);
                }
            }

            if (streamRef == 0)
            {
                Radio.PlayingStation = null;
                controller.RequestAction(QActionType.RadioFailed);
                return;
            }

            setupChannelFromStream();

            if (Frequency != presumedFreq)
            {
                frequencyMismatchDelegate();
            }

            syncEvent = new SYNCPROC(MetaSync);
            Bass.BASS_ChannelSetSync(streamRef, BASSSync.BASS_SYNC_META, 0, syncEvent, IntPtr.Zero);
            Bass.BASS_ChannelSetSync(streamRef, BASSSync.BASS_SYNC_WMA_CHANGE, 0, syncEvent, IntPtr.Zero);

            myStreamCreateURL = new DOWNLOADPROC(MyDownloadProc);

            try
            {
                // might throw up on certains chars
                tagInfo = new TAG_INFO(station.URL);
            }
            catch
            {
            }

            prebuffer();

            buffered = true;

            Radio.PlayingStation  = station;
            controller.RadioTrack = null;

            readStreamTags();

            if (station.StreamType == StationStreamType.None)
            {
                setStationStreamType();
            }

            controller.RequestAction(QActionType.RadioStreamStarted);
        }
Ejemplo n.º 14
0
        //attach from internet
        private void AttachUrlSong(AudioVK track,bool needCache)
        {
            if (track != null)
            {
                isLocal = false;
                currTrack = track;
                _myDownloadProc = new DOWNLOADPROC(MyDownload);
                //destroy current playing stream
                Bass.BASS_Free();
                Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, System.IntPtr.Zero);
                if (needCache)
                stream = Bass.BASS_StreamCreateURL(track.GetLocation, 0, BASSFlag.BASS_DEFAULT, _myDownloadProc, IntPtr.Zero);
                else
                    stream = Bass.BASS_StreamCreateURL(track.GetLocation, 0, BASSFlag.BASS_DEFAULT, null, IntPtr.Zero);

                // pre-buffer
                Bass.BASS_ChannelUpdate(stream, 0);

                UpdateStatus(PLAYER_STATUS.PLAYER_STATUS_READY_STOPPED);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// The BASS engine itself is not initialised at this stage, since it may cause S/PDIF for Movies not working on some systems.
        /// </summary>
        private void Initialize()
        {
            try
            {
                Log.Info("BASS: Initialize BASS environment ...");
                LoadSettings();

                //TODO: Make this configurable
                if (_regEmail != string.Empty)
                    BassNet.Registration(_regEmail, _regKey);

                // Set the Global Volume. 0 = silent, 10000 = Full
                // We get 0 - 100 from Configuration, so multiply by 100
                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_GVOL_STREAM, _StreamVolume*100);

                if (_Mixing)
                {
                    // In case of mixing use a Buffer of 500ms only, because the Mixer plays the complete bufer, before for example skipping
                    BufferingMS = 500;
                }
                else
                {
                    Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, _BufferingMS);
                }

                for (int i = 0; i < MAXSTREAMS; i++)
                {
                    Streams.Add(0);
                }

                PlaybackFadeOutProcDelegate = PlaybackFadeOutProc;
                PlaybackEndProcDelegate = PlaybackEndProc;
                PlaybackStreamFreedProcDelegate = PlaybackStreamFreedProc;
                MetaTagSyncProcDelegate = MetaTagSyncProc;

                DownloadProcDelegate = DownloadProc;

                StreamEventSyncHandles.Add(new List<int>());
                StreamEventSyncHandles.Add(new List<int>());

                LoadAudioDecoderPlugins();

                Log.Info("BASS: Initializing BASS environment done.");

                _Initialized = true;
                _BassFreed = true;
            }

            catch (Exception ex)
            {
                Log.Error("BASS: Initialize thread failed.  Reason: {0}", ex.Message);
                throw new BassException("BASS: Initialize thread failed.  Reason: " + ex);
            }
        }
Ejemplo n.º 16
0
 private static extern int BASS_AAC_StreamCreateURLUnicode([MarshalAs(UnmanagedType.LPWStr)][In] string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user);
Ejemplo n.º 17
0
 public static void PlayInitUrl(string StrUrl, bool Record)
 {
     BASSFlag flag = BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE;
     if (!Record)
     {
         stream = Bass.BASS_StreamCreateURL(StrUrl, 0, flag, null, IntPtr.Zero);
         if (stream == 0)
         {
             stream = BassAac.BASS_AAC_StreamCreateURL(StrUrl, 0, flag, null, IntPtr.Zero);
         }
     }
     else
     {
         tryDownload = new DOWNLOADPROC(MyDownload);
         stream = Bass.BASS_StreamCreateURL(StrUrl, 0, flag, tryDownload, dlPointer);
         if (stream == 0)
         {
             stream = BassAac.BASS_AAC_StreamCreateURL(StrUrl, 0, flag, tryDownload, dlPointer);
         }
     }
     if (stream == 0)
     {
         stream = BassWma.BASS_WMA_StreamCreateURL(StrUrl, 0, 0, flag);
     }
     Play();
 }
Ejemplo n.º 18
0
 public static extern int BASS_StreamCreateURL([In, MarshalAs(UnmanagedType.LPStr)] string url, int offset,
                                               BASSFlag flags, DOWNLOADPROC proc, IntPtr user);
Ejemplo n.º 19
0
        public static bool ShutDownNet()
        {
            try
            {
                Stop();
                if (_fs != null)
                {
                    _fs.Flush();
                    _fs.Close();

                    dlPointer = IntPtr.Zero;
                    tryDownload = null;
                    _data = null;
                    saveFile = "output";
                }

                return true;
            }
            catch
            {
                _fs = null;
                return false;
            }
        }