Пример #1
0
        internal AudioPlayable(IAudio audio, IAudioStorage storage, IWebDownloader downloader, Uri url)
        {
            __Audio = audio;
            __Storage = storage;
            __Downloader = downloader;
            __Url = url;

            __BassFileProcs = new BASS_FILEPROCS(user => { },
                                                 user => 
                                                     __CacheStream.AudioSize,
                                                 BassReadProc,
                                                 (offset, user) => true);

            __EndStreamProc = (handle, channel, data, user) =>
            {
                __RequestTasksStop = true;
                CleanActions();
                OnAudioNaturallyEnded();
            };

            if (storage.CheckCached(audio))
            {
                DownloadedFracion = 1.0;
            }
        }
Пример #2
0
 // Token: 0x06001926 RID: 6438
 // RVA: 0x000788B8 File Offset: 0x00076AB8
 internal Class336(Stream stream_1, bool bool_5, bool bool_6)
 {
     this.bass_FILEPROCS_0 = new BASS_FILEPROCS(new FILECLOSEPROC(this.method_5), new FILELENPROC(this.method_6), new FILEREADPROC(this.method_7), new FILESEEKPROC(this.method_8));
     this.vmethod_3(bool_5);
     this.bool_4 = bool_6;
     BASSFlag bASSFlag = this.vmethod_2() ? 0 : 2228224;
     this.stream_0 = stream_1;
     if (this.stream_0 == null)
     {
         throw new Exception11();
     }
     this.stream_0.Seek(0L, SeekOrigin.Begin);
     this.int_3 = Bass.BASS_StreamCreateFileUser(0, bASSFlag, this.bass_FILEPROCS_0, IntPtr.Zero);
     if (this.vmethod_2())
     {
         base.method_1(this.int_1 = this.int_3);
     }
     else
     {
         base.method_1(this.int_1 = BassFx.BASS_FX_TempoCreate(this.int_3, bool_6 ? 4 : 0));
         this.int_2 = BassFx.BASS_FX_ReverseCreate(this.int_3, 5f, 0);
         Bass.BASS_ChannelSetAttribute(base.method_0(), 65554, 1f);
         Bass.BASS_ChannelSetAttribute(base.method_0(), 65557, 4f);
         Bass.BASS_ChannelSetAttribute(base.method_0(), 65555, 30f);
     }
     this.double_0 = Bass.BASS_ChannelBytes2Seconds(base.method_0(), Bass.BASS_ChannelGetLength(base.method_0())) * 1000.0;
     Bass.BASS_ChannelGetAttribute(base.method_0(), 1, ref this.float_0);
     this.float_1 = this.float_0;
 }
Пример #3
0
 public CoreDataProvider()
 {
     bassStreamingProc = new BASS_FILEPROCS(
             new FILECLOSEPROC(procUserClose),
             new FILELENPROC(procUserLength),
             new FILEREADPROC(procUserRead),
             new FILESEEKPROC(procUserSeek));
     seekPosition = 0L;
 }
Пример #4
0
        public void InitializeSound()
        {
            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Program.playerWindow.Handle))
            {
                initialized = true;
                Thread t = new Thread(new ThreadStart(FillMemoryStream));
                t.Start();

                playFromMemoryStream = new MemoryStream();
                //playFromMemoryStream.Seek(0, SeekOrigin.Begin);
                myStreamCreateUser = new BASS_FILEPROCS(
                    new FILECLOSEPROC(MyFileProcUserClose),
                    new FILELENPROC(MyFileProcUserLength),
                    new FILEREADPROC(MyFileProcUserRead),
                    new FILESEEKPROC(MyFileProcUserSeek));
            }
            else
                throw new Exception("Cannot initialize sound");
        }
Пример #5
0
 internal void PlaySong(string PlayURL)
 {
     if(this.Channel != 0)
             Bass.BASS_ChannelStop(this.Channel);
         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(PlayURL);
         req.Headers.Add("Cookie:" + Lala.API.Instance.Cookie);
         HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
         _fs = resp.GetResponseStream();
         _fsLength = resp.ContentLength;
         _myStreamCreateUser = new BASS_FILEPROCS(
                    new FILECLOSEPROC(MyFileProcUserClose),
                    new FILELENPROC(MyFileProcUserLength),
                    new FILEREADPROC(MyFileProcUserRead),
                    new FILESEEKPROC(MyFileProcUserSeek));
         Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
         this.Channel = Bass.BASS_StreamCreateFileUser(BASSStreamSystem.STREAMFILE_BUFFER, BASSFlag.BASS_STREAM_AUTOFREE, _myStreamCreateUser, IntPtr.Zero);
         if (this.Channel == 0)
         {
             throw new Exception(Bass.BASS_ErrorGetCode().ToString());
         }
          Bass.BASS_ChannelPlay(this.Channel, false);
        this.Played(this, new EventArgs());
 }
Пример #6
0
 public static extern int BASS_StreamCreateFileUser(BASSStreamSystem system, BASSFlag flags, BASS_FILEPROCS procs,
                                                    IntPtr user);
 public StreamInput(Stream inputStream)
 {
   _inputStream = inputStream;
   _fileProcs = new BASS_FILEPROCS(CloseCallback, LengthCalback, ReadCallback, SeekCallback);
 }
Пример #8
0
        /// <summary>
        /// Initialize the bass library
        /// </summary>
        /// <returns></returns>
        protected bool BassNetInitialize()
        {
            // Keep Bass.Net from putting a popup on the screen
            BassNet.Registration(email, registrationKey);

            if (Bass.BASS_Init(-1, BASS_SAMPLE_RATE, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)) // 0=console application otherwise this.Handle
            {
#if __IOS__
                //Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_IOS_SPEAKER, 1); 
#endif
                bassFileProcs = new BASS_FILEPROCS(
                    new FILECLOSEPROC(_BassCallback_FileProcUserClose),
                    new FILELENPROC(_BassCallback_FileProcUserLength),
                    new FILEREADPROC(_BassCallback_FileProcUserRead),
                    new FILESEEKPROC(_BassCallback_FileProcUserSeek));
                bassStalledSync = new SYNCPROC(_BassCallback_StalledSync);
                bassEndSync = new SYNCPROC(_BassCallback_EndSync);

                Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_BUFFER, 1000 * 2); // 2 seconds buffer (the default of bass also)

                return true;
            }

            return false;
        }
 public StreamInput(Stream inputStream)
 {
   _inputStream = inputStream;
   _fileProcs = new BASS_FILEPROCS(closeCallback, lengthCalback, readCallback, seekCallback);
 }
Пример #10
0
 public static extern int BASS_StreamCreateFileUser(BASSStreamSystem system, BASSFlag flags, BASS_FILEPROCS procs,
                                                    IntPtr user);