示例#1
0
        void build_theAudioStream()
        {
            try
            {
#if uAudio_debug
                UnityEngine.Debug.Log("load");
                UnityEngine.Debug.Log("1");
#endif
                _theAudioStream = new uAudio_backend.uAudio_Streaming();
#if UNITY_STANDALONE_WIN
                _theAudioStream.targetWindows = true;
#else
                // bypass hack
                //_theAudioStream.targetWindows = true;
#endif
                _theAudioStream.my_uAudioPlayer2 = my_uAudioPlayer;
                _theAudioStream.startVolume      = my_uAudioPlayer.Volume;
#if uAudio_debug
                UnityEngine.Debug.Log("2");
#endif
                _theAudioStream.Volume        = my_uAudioPlayer.Volume_BackEnd;
                _theAudioStream.sendPlaying  += theAudioStream_sendPlaying;
                _theAudioStream.Disposed     += theAudioStream_Disposed;
                _theAudioStream.minBufferTime = minBufferTime;
#if uAudio_debug
                UnityEngine.Debug.Log("3");
#endif
                _theAudioStream.maxBufferTime = maxBufferTime;


#if !RemoveThread_uAudio
                _theAudioStream.BetaNativeThreadBuffering = betaNativeThreadBuffering;
#else
                _theAudioStream.BetaNativeThreadBuffering = false;
#endif
                TheAudioStream.sendPlaybackState = (uAudio_backend.PlayBackState c) => {
                    _sendPlaybackState(c);
                };

                //_theAudioStream.sendStartLoopPump += theAudioStream_sendStartLoopPump;
                //_theAudioStream.sendStopLoopPump += theAudioStream_sendStopLoopPump;

                //my_uAudioPlayer.myAudioSource.clip =
                //       UnityEngine.AudioClip.Create("uAudio_song", int.MaxValue,
                //       2,
                //       44100,
                //       true, new UnityEngine.AudioClip.PCMReaderCallback(_theAudioStream.ReadData));

                myLoopRead = LoopRead();
#if uAudio_debug
                UnityEngine.Debug.Log("4");
#endif
            }
            catch
            {
                UnityEngine.Debug.LogWarning("Build _theAudioStream crash #78vfg78dv");
            }
        }
示例#2
0
        void theAudioStream_Disposed(object sender, System.EventArgs e)
        {
#if !RemoveThread_uAudio
            if (myThreadPump != null)
            {
                myThreadPump.Abort();
                myThreadPump = null;
            }
#endif
            _theAudioStream = null;
        }
示例#3
0
        public void Halt()
        {
#if uAudio_debug
            UnityEngine.Debug.Log("end");
#endif

#if !RemoveThread_uAudio
            //hot = false;
            if (myThreadPump != null)
            {
                myThreadPump.Abort();
                myThreadPump = null;
            }
#endif
            if (_theAudioStream != null)
            {
                _theAudioStream.Dispose();
                _theAudioStream = null;
            }
        }
示例#4
0
        public void Dispose()
        {
            if (_theAudioStream != null)
            {
                try
                {
                    _theAudioStream.Stop();
                }
                catch { }

                _theAudioStream.Dispose();
                _theAudioStream = null;
            }

#if !RemoveThread_uAudio
            if (myThreadPump != null)
            {
                myThreadPump.Abort();
                myThreadPump = null;
            }
#endif
        }