Exemple #1
0
        public DroidAudioManager()
        {
            if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                // Do things the Lollipop way
                var attributes = new AudioAttributes.Builder()
                                 .SetUsage(AudioUsageKind.Game)
                                 .SetContentType(AudioContentType.Music)
                                 .Build();

                _soundPool = new SoundPool.Builder()
                             .SetAudioAttributes(attributes)
                             .SetMaxStreams(10)
                             .Build();
            }
            else
            {
                // Do things the pre-Lollipop way
                _soundPool = new SoundPool(10, Android.Media.Stream.Music, 0);
            }

            //6, Stream.Music, 0


            // Initialize
            ActivateAudioSession();
        }
        public ChronometerDrawer(Context context)
        {
            countDownView           = new CountDownView(context);
            countDownView.Countdown = (COUNT_DOWN_VALUE);
            countDownView.OnTick   += (long millisUntilFinish) => {
                MaybePlaySound(millisUntilFinish);
                Draw(countDownView);
            };
            countDownView.OnFinish += () => {
                countDownDone = true;
                chronometerView.BaseMillis = (SystemClock.ElapsedRealtime());
                if (_holder != null)
                {
                    chronometerView.Start();
                }
                PlaySound(startSoundId);
            };

            chronometerView           = new ChronometerView(context);
            chronometerView.OnChange += () => {
                Draw(chronometerView);
            };
            chronometerView.ForceStart = true;

            soundPool        = new SoundPool(MAX_STREAMS, Stream.Music, 0);
            startSoundId     = soundPool.Load(context, Resource.Raw.start, SOUND_PRIORITY);
            countDownSoundId = soundPool.Load(context, Resource.Raw.countdown_bip, SOUND_PRIORITY);
        }
Exemple #3
0
        static AudioService()
        {
            var alarmPath        = P42.Utils.EmbeddedResourceCache.LocalStorageFullPathForEmbeddedResource("Forms9Patch.Resources.Sounds.alarm.ogg", typeof(Forms9Patch.Feedback).Assembly);
            var alertPath        = P42.Utils.EmbeddedResourceCache.LocalStorageFullPathForEmbeddedResource("Forms9Patch.Resources.Sounds.alert.ogg", typeof(Forms9Patch.Feedback).Assembly);
            var errorPath        = P42.Utils.EmbeddedResourceCache.LocalStorageFullPathForEmbeddedResource("Forms9Patch.Resources.Sounds.error.ogg", typeof(Forms9Patch.Feedback).Assembly);
            var messagePath      = P42.Utils.EmbeddedResourceCache.LocalStorageFullPathForEmbeddedResource("Forms9Patch.Resources.Sounds.message.ogg", typeof(Forms9Patch.Feedback).Assembly);
            var notificationPath = P42.Utils.EmbeddedResourceCache.LocalStorageFullPathForEmbeddedResource("Forms9Patch.Resources.Sounds.notification.ogg", typeof(Forms9Patch.Feedback).Assembly);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                var audioAttributes = new AudioAttributes.Builder()
                                      .SetUsage(AudioUsageKind.NotificationEvent)
                                      .SetContentType(AudioContentType.Sonification)
                                      .Build();
                _soundPool = new SoundPool.Builder()
                             .SetMaxStreams(5)
                             .SetAudioAttributes(audioAttributes)
                             .Build();
            }
            else
            {
                _soundPool = new SoundPool(5, Stream.Alarm, 0);
            }

            alarmId        = _soundPool.Load(alarmPath, 1);
            alertId        = _soundPool.Load(alertPath, 1);
            errorId        = _soundPool.Load(errorPath, 1);
            messageId      = _soundPool.Load(messagePath, 1);
            notificationId = _soundPool.Load(notificationPath, 1);
        }
Exemple #4
0
    public track(string nName, string path)
    {
        isFromStringPath = true;
        songFileString   = path;

        isPrepped  = false;
        hasStarted = false;

        name   = nName;
        key    = null;
        bpm    = 0;
        defBPM = 0;
        type   = null;

        try
        {
            WaveFileReader wf = new WaveFileReader(songFileString);
            length  = wf.TotalTime;
            calcBPM = calculateBPM();
        }
        catch (System.Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); }

        sp = builder.Build();
        id = sp.Load(songFileString, 1);
    }
 public override void Update(GameSettings settings)
 {
     base.Update(settings);
     time--;
     SetVelocityAdd(0f, -0.007f);
     _smoke.SetPos(GetPosition());
     _smoke.SetRot(GetRotation());
     _smoke.Blow(0.01f, 1, false);
     if (time - 1 < 0)
     {
         SoundPool.PlaySound("explode");
         SetTexture("light");
         SetSize(1.0f, 1.0f);
     }
     if (time < 0)
     {
         if (Explode)
         {
             _explosion.SetColor(_color);
             _explosion.SetPos(GetPosition());
             _explosion.Blow(0.1f, 40, false);
         }
         TomatoMainEngine.RemoveRenderObject(EntityId);
     }
 }
 public DDDeadState(Player player)
 {
     Setup(player,
           DDStateTransitionSet.Instance,
           PlayerSpriteFactory.Instance.CreateDDDeadSprite());
     SoundPool.PlaySound(Sound.PlayerDDHit);
 }
Exemple #7
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            mContext                  = (MainActivity)Activity;
            rdoBtn_singleScan         = View.FindViewById <RadioButton> (Resource.Id.rdoBtn_singleScan);
            rdoBtn_continuous         = View.FindViewById <RadioButton> (Resource.Id.rdoBtn_continuous);
            rdoBtn_continuous.Checked = true;
            chkAnti  = View.FindViewById <CheckBox> (Resource.Id.chkAnti);
            sqn_Q    = View.FindViewById <Spinner> (Resource.Id.sqn_Q);
            btnScan  = View.FindViewById <Button> (Resource.Id.btnScan);
            LvTags   = View.FindViewById <ListView> (Resource.Id.LvTags);
            btnClear = View.FindViewById <Button> (Resource.Id.btnClear);
            tvTotal  = View.FindViewById <TextView> (Resource.Id.tvTotal);
            sqn_Q.SetSelection(3);
            tagList = new List <IDictionary <string, object> > ();
            adapter = new  SimpleAdapter(mContext, tagList, Resource.Layout.listtag_items,
                                         new String[] { "tagUii", "tagLen", "tagCount", "tagRssi" },
                                         new int[] { Resource.Id.TvTagUii, Resource.Id.TvTagLen, Resource.Id.TvTagCount,
                                                     Resource.Id.TvTagRssi });
            LvTags.Adapter = adapter;

            btnScan.Click += delegate {
                scan();
            };
            btnClear.Click += delegate {
                Clear();
            };
            soundPool   = new SoundPool(10, Stream.Music, 0);
            soundPoolId = soundPool.Load(mContext, Resource.Drawable.beep, 1);
            handler     = new UIHand(this);
        }
Exemple #8
0
 public void OnGUI()
 {
     if (this.clips != null)
     {
         foreach (AudioClip clip in this.clips)
         {
             if (GUILayout.Button(clip.name, new GUILayoutOption[0]))
             {
                 clip.Play();
             }
         }
     }
     GUI.Box(new Rect((float)(Screen.width - 0x100), 0f, 256f, 24f), "Total Sound Nodes   " + SoundPool.totalCount);
     GUI.Box(new Rect((float)(Screen.width - 0x100), 30f, 256f, 24f), "Playing Sound Nodes " + SoundPool.playingCount);
     GUI.Box(new Rect((float)(Screen.width - 0x100), 60f, 256f, 24f), "Reserve Sound Nodes " + SoundPool.reserveCount);
     if (GUI.Button(new Rect((float)(Screen.width - 0x80), 90f, 128f, 24f), "Drain Reserves"))
     {
         SoundPool.DrainReserves();
     }
     if (GUI.Button(new Rect((float)(Screen.width - 0x80), 120f, 128f, 24f), "Drain"))
     {
         SoundPool.Drain();
     }
     if (GUI.Button(new Rect((float)(Screen.width - 0x80), 150f, 128f, 24f), "Stop All"))
     {
         SoundPool.Stop();
     }
 }
Exemple #9
0
    public track(Java.IO.FileDescriptor filename, string filenameString, long l1, long l2)
    {
        songFile       = filename;
        songFileString = filenameString;
        long1          = l1;
        long2          = l2;

        isPrepped  = false;
        hasStarted = false;

        if (!(songFile == null))
        {
            string[] datalist = filenameString.Split("-");
            name   = datalist[0];
            key    = datalist[1];
            bpm    = int.Parse(datalist[2]);
            defBPM = bpm;
            type   = datalist[3].Remove(1);
            try
            {
                sp = builder.Build();
                id = sp.Load(songFile, long1, long2, 1);
            }
            catch (System.Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); }
        }
    }
Exemple #10
0
        public override void Update(GameSettings settings)
        {
            base.Update(settings);
            var data = SoundPool.GetBackgroundVisData();

            _data = data.Frequencies.ToArray();
        }
    void Start()
    {
        if (instance != null)
        {
            Debug.Log("Singleton violated for SoundPoolManager");
            Destroy(this);
        }

        instance = this;


        for (int i = 0; i < ToPool.Count; i++)
        {
            List <Sound> list = new List <Sound>();

            for (int x = 0; x < poolSize; x++)
            {
                GameObject go = Instantiate(ToPool[i]);
                list.Add(go.GetComponent <Sound>());
                go.SetActive(false);
                go.transform.SetParent(this.transform);
            }

            UnityObjectPool <Sound> pool = new UnityObjectPool <Sound>(list.ToArray());
            mapping.Add(ToPool[i].GetComponent <Sound>().Name, pool);
        }
    }
Exemple #12
0
 /** [シングルトン]インスタンス。作成。
  */
 public static void CreateInstance()
 {
     if (s_instance == null)
     {
         s_instance = new SoundPool();
     }
 }
Exemple #13
0
 public void OnGUI()
 {
     if (this.clips != null)
     {
         AudioClip[] audioClipArray = this.clips;
         for (int i = 0; i < (int)audioClipArray.Length; i++)
         {
             AudioClip audioClip = audioClipArray[i];
             if (GUILayout.Button(audioClip.name, new GUILayoutOption[0]))
             {
                 audioClip.Play();
             }
         }
     }
     GUI.Box(new Rect((float)(Screen.width - 256), 0f, 256f, 24f), string.Concat("Total Sound Nodes   ", SoundPool.totalCount));
     GUI.Box(new Rect((float)(Screen.width - 256), 30f, 256f, 24f), string.Concat("Playing Sound Nodes ", SoundPool.playingCount));
     GUI.Box(new Rect((float)(Screen.width - 256), 60f, 256f, 24f), string.Concat("Reserve Sound Nodes ", SoundPool.reserveCount));
     if (GUI.Button(new Rect((float)(Screen.width - 128), 90f, 128f, 24f), "Drain Reserves"))
     {
         SoundPool.DrainReserves();
     }
     if (GUI.Button(new Rect((float)(Screen.width - 128), 120f, 128f, 24f), "Drain"))
     {
         SoundPool.Drain();
     }
     if (GUI.Button(new Rect((float)(Screen.width - 128), 150f, 128f, 24f), "Stop All"))
     {
         SoundPool.Stop();
     }
 }
Exemple #14
0
    private IEnumerator PlaySoundOnceCoroutine(AudioParams.SoundPoolGroups soundPoolGroupTag, AudioParams.SoundPools soundPoolTag, GameObject caller)
    {
        SoundPoolGroup foundSoundPoolGroup = soundPoolGroups.FirstOrDefault(currentSoundPoolGroup => currentSoundPoolGroup.Tag == soundPoolGroupTag);

        if (foundSoundPoolGroup == null)
        {
            yield return(null);
        }
        else
        {
            SoundPool foundSoundPool = foundSoundPoolGroup.GetSoundPool(soundPoolTag);
            if (foundSoundPool != null)
            {
                AudioSource newAudioSource = caller.AddComponent <AudioSource>();
                newAudioSource = foundSoundPool.UpdateAudioSource(newAudioSource);
                if (newAudioSource != null)
                {
                    newAudioSource.PlayOneShot(newAudioSource.clip);
                    yield return(new WaitWhile(() => newAudioSource != null && newAudioSource.isPlaying));

                    Destroy(newAudioSource);
                }
            }
        }
    }
Exemple #15
0
        /// <summary>
        ///     Load all sounds.
        /// </summary>
        private void loadSound()
        {
            Stream st = new Stream();

            sp = new SoundPool(1, st, 0);
            SoundPushButton = sp.Load(this, Resource.Raw.clickInMenu, 1);
        }
 public override bool OnColision(GameObject col, float inpact)
 {
     if (inpact > 1)
     {
         SoundPool.PlaySound("");
     }
     return(true);
 }
Exemple #17
0
 /** [シングルトン]インスタンス。削除。
  */
 public static void DeleteInstance()
 {
     if (s_instance != null)
     {
         s_instance.Delete();
         s_instance = null;
     }
 }
Exemple #18
0
        static SoundMaster()
        {
            soundPool = new SoundPool(MaxStreams, Stream.Music, 0);
            var prefs = Application.Context.GetSharedPreferences("AppPrefs",
                                                                 FileCreationMode.Private);

            Volume = prefs.GetFloat("volume", 1);
        }
Exemple #19
0
        public void Reset()
        {
            Pool.Release();

            Pool = new SoundPool(MaxNumberOfStreams, Stream.Music, 0);

            Ids.Clear();
        }
        /// <summary>
        /// Initializes all required modules for the game.
        /// </summary>
        protected virtual void InitializeModules()
        {
            UnityThread.Initialize();

            Dependencies.CacheAs <IGame>(this);

            Dependencies.CacheAs <IPlatformHost>(platformHost = PlatformHost.CreateHost());
            Dependencies.CacheAs <DeepLinker>(deepLinker      = platformHost.CreateDeepLinker());

            Dependencies.CacheAs <IEnvConfiguration>(envConfiguration = new EnvConfiguration(EnvType.Production));

            Dependencies.CacheAs <IModeManager>(modeManager = new ModeManager());

            Dependencies.CacheAs <INotificationBox>(notificationBox = new NotificationBox());

            Dependencies.CacheAs <IGameConfiguration>(gameConfiguration     = new GameConfiguration());
            Dependencies.CacheAs <IMapConfiguration>(mapConfiguration       = new MapConfiguration());
            Dependencies.CacheAs <IMapsetConfiguration>(mapsetConfiguration = new MapsetConfiguration());

            Dependencies.CacheAs <IFontManager>(fontManager       = new FontManager());
            Dependencies.CacheAs <IAtlas <Sprite> >(spriteAtlas   = new ResourceSpriteAtlas());
            Dependencies.CacheAs <IAtlas <AudioClip> >(audioAtlas = new ResourceAudioAtlas());

            Dependencies.CacheAs <IMusicCacher>(musicCacher           = new MusicCacher());
            Dependencies.CacheAs <IBackgroundCacher>(backgroundCacher = new BackgroundCacher());
            Dependencies.CacheAs <IWebImageCacher>(webImageCacher     = new WebImageCacher());
            Dependencies.CacheAs <IWebMusicCacher>(webMusicCacher     = new WebMusicCacher());

            Dependencies.CacheAs <IMusicController>(musicController = MusicController.Create());

            Dependencies.CacheAs <ISoundTable>(soundTable = new DefaultSoundTable(audioAtlas));
            Dependencies.CacheAs <ISoundPool>(soundPool   = new SoundPool(soundTable));

            Dependencies.CacheAs <IMapsetStore>(mapsetStore   = new MapsetStore(modeManager));
            Dependencies.CacheAs <IMapSelection>(mapSelection = new MapSelection(musicCacher, backgroundCacher, gameConfiguration, mapsetConfiguration, mapConfiguration));
            Dependencies.CacheAs <IMapManager>(mapManager     = new MapManager(mapsetStore, notificationBox, mapSelection));
            Dependencies.CacheAs <IMetronome>(metronome       = new Metronome()
            {
                AudioController = musicController
            });
            Dependencies.CacheAs <IMusicPlaylist>(musicPlaylist = new MusicPlaylist());

            Dependencies.CacheAs <IDownloadStore>(downloadStore = new DownloadStore());
            Dependencies.CacheAs <IApi>(api = new Api(envConfiguration, notificationBox, deepLinker));

            Dependencies.CacheAs <IUserManager>(userManager = new UserManager(api, Dependencies));
            Dependencies.CacheAs <IRecordStore>(recordStore = new RecordStore());

            Dependencies.CacheAs <IRootMain>(rootMain                 = RootMain.Create(Dependencies));
            Dependencies.CacheAs <IRoot3D>(root3D                     = Root3D.Create(Dependencies));
            Dependencies.CacheAs <IColorPreset>(colorPreset           = new ColorPreset());
            Dependencies.CacheAs <IAnimePreset>(animePreset           = new AnimePreset());
            Dependencies.CacheAs <IScreenNavigator>(screenNavigator   = new ScreenNavigator(rootMain));
            Dependencies.CacheAs <IOverlayNavigator>(overlayNavigator = new OverlayNavigator(rootMain));
            Dependencies.CacheAs <IDropdownProvider>(dropdownProvider = new DropdownProvider(rootMain));

            Dependencies.CacheAs <ITemporaryStore>(temporaryStore = new TemporaryStore());
        }
Exemple #21
0
        private void btnRepeatPlay_Click(object sender, RoutedEventArgs e)
        {
            if (_repeatSound == null)
            {
                _repeatSound = new SoundPool(System.IO.Path.Combine(WAVFOLDER, "engine.wav"));
            }

            _repeatSound.TestPlayRepeat();
        }
/// <summary>
///  Returns a sound pool with the defined tag
/// </summary>
    public SoundPool GetSoundPool(AudioParams.SoundPools soundPoolTag)
    {
        SoundPool foundSoundPool = soundPools.Find(currentSoundPool => currentSoundPool.Tag == soundPoolTag);

        if (foundSoundPool == null)
        {
            Debug.LogWarning("Sound Pool : " + soundPoolTag + " was not found !");
        }
        return(foundSoundPool);
    }
Exemple #23
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            mContext = (MainActivity)Activity;


            soundPool    = new SoundPool(10, Stream.Music, 0);
            soundPoolId1 = soundPool.Load(mContext, Resource.Drawable.barcodebeep, 1);
            soundPoolId2 = soundPool.Load(mContext, Resource.Drawable.serror, 1);
        }
 // アプリ終了時
 public void PlayRelease(Context context)
 {
     if (mSoundPool != null)
     {
         mSoundPool.Release();
         mSoundPool = null;
     }
     // マナーモード/音量を元の状態に戻す
     RestoreSilentMode(context);
 }
Exemple #25
0
        /** [シングルトン]削除。
         */
        private void Delete()
        {
            this.se_audiosource_monobehaviour.Delete();
            this.se_audiosource_monobehaviour = null;

            this.soundpool.Delete();
            this.soundpool = null;

            UnityEngine.GameObject.Destroy(this.root_gameobject);
        }
        // 起動時
        public void Initialize(Context context)
        {
            mSoundPool = new SoundPool(1, Stream.Music, 0);

            // 音声ファイルの登録
            mSoundFile[0] = mSoundPool.Load(context, Resource.Raw.keikoku, 1);  // 助けて下さい=警告っ(仮)
            mSoundFile[1] = mSoundPool.Load(context, Resource.Raw.kyaa, 1);     // 痴漢です=キャー(仮)

            // サイレントモード解除→ 音声出力
//            CancelSilentMode(context);
        }
Exemple #27
0
        private SoundPool LoadPlayerAttackSounds()
        {
            SoundPool soundPool = new SoundPool();

            for (int i = 1; i <= 10; i++)
            {
                soundPool.Add(Content.Load <SoundEffect>($"Sfx/fighter_1_attack_{i}"));
            }

            return(soundPool);
        }
Exemple #28
0
        /// <summary>
        ///     Loads all sound variables.
        /// </summary>
        private void loadSounds()
        {
            Stream st = new Stream();

            sp  = new SoundPool(1, st, 100);
            sp2 = new SoundPool(1, st, 100);
            sp3 = new SoundPool(1, st, 100);
            _soundPushButton   = sp.Load(this, Resource.Raw.buttonDown, 1);
            _singleRowOrColumn = sp2.Load(this, Resource.Raw.singleRowOrColumn, 1);
            _gameOver          = sp3.Load(this, Resource.Raw.gameOver, 1);
        }
Exemple #29
0
        public UpcAlert(AppCompatActivity act, Handler handler)
        {
            m_mpAlertMedia = new Dictionary <AlertType, int>();
            m_act          = act;
            m_handler      = handler;

            Task <SoundPool> tsp = LoadEffects(act.Assets);

            tsp.Wait();
            m_sp = tsp.Result;
        }
Exemple #30
0
        /// <summary>
        /// initiate a synthesizer with the given amount of keys
        /// </summary>
        /// <param name="keys">3 to 12 keys</param>
        public Synthesizer(AssetManager assets, short keys)
        {
            Keys = keys;
            if (keys > 2 && keys < 13)
            {
                //prepare stacks
                Playing           = new Stack <short>();
                PlayingPercussion = new Stack <short>();

                //load sounds
                SoundPool.Builder soundPoolBuilder = new SoundPool.Builder();
                Lead = new SoundPool[keys];

                //prepare percussion
                PercIds = new int[3];

                //prepare kick
                SoundPool kick = soundPoolBuilder.Build();
                kick.SetOnLoadCompleteListener(OnLoadCompleteListener);
                PercIds[0] = kick.Load(assets.OpenFd("perc/kick.mp3"), 1);

                //prepare snare
                SoundPool snare = soundPoolBuilder.Build();
                snare.SetOnLoadCompleteListener(OnLoadCompleteListener);
                PercIds[1] = snare.Load(assets.OpenFd("perc/snare.mp3"), 1);

                //prepare hi-hat
                SoundPool hat = soundPoolBuilder.Build();
                snare.SetOnLoadCompleteListener(OnLoadCompleteListener);
                PercIds[2] = hat.Load(assets.OpenFd("perc/hat.mp3"), 1);

                Percussion = new SoundPool[3]
                {
                    kick,
                    snare,
                    hat
                };

                //prepare lead
                SoundIds = new int[keys];

                for (int l = 0; l < keys; l++)
                {
                    SoundPool lead = soundPoolBuilder.Build();
                    lead.SetOnLoadCompleteListener(OnLoadCompleteListener);
                    SoundIds[0] = lead.Load(assets.OpenFd("keys/" + Synth + "/A.mp3"), 1);
                    Lead[l]     = lead;
                }
            }
            else
            {
                throw new IndexOutOfRangeException("Synthesizer size must be between 3 and 12.");
            }
        }
Exemple #31
0
        public static void LoadSound(string name)
        {
            if (ContentManager != null)
            {
                if (soundList.ContainsKey(name))
                {
                    return;
                }

                SoundEffect sound = ContentManager.Load<SoundEffect>(AssetPath + name);
                SoundPool pool = new SoundPool(ref sound);

                soundList.Add(name, pool);
            }
        }
Exemple #32
0
 //List<AudioSource> sources = new List<AudioSource>();
 // Use this for initialization
 void Awake()
 {
     if (!_instance)
     {
         _instance = this;
     }
     DontDestroyOnLoad(this);
 }
 void Awake()
 {
     mLoadedAudioFixFiles = new Dictionary<string, int[]>();
     mLoadedAudioFiles = new Dictionary<string, AudioClip[]>();
     mPlayingSoundEvents = new List<AudioInstanceData> ();
     mPlayingMusicEvents = new List<AudioInstanceData> ();
     mSoundPool = GetComponent<SoundPool>();
 }
Exemple #34
0
 private static void Play(ref SoundPool.Settings settings)
 {
     SoundPool.Root root;
     SoundPool.RootID rootID;
     bool flag;
     Vector3 vector3;
     Vector3 vector31;
     Quaternion quaternion;
     Quaternion quaternion1;
     SoundPool.RootID rootID1;
     if (!SoundPool._enabled || settings.volume <= 0f || settings.pitch == 0f || !settings.clip)
     {
         return;
     }
     Transform transforms = null;
     switch (settings.SelectRoot)
     {
         case 0:
         case 3:
         case 4:
         {
             root = SoundPool.playing;
             rootID = SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.PLAYING | SoundPool.RootID.RESERVED | SoundPool.RootID.DISPOSED;
             flag = false;
             break;
         }
         case 1:
         {
             if (!Camera.main)
             {
                 return;
             }
             transforms = Camera.main.transform;
             root = SoundPool.playingCamera;
             rootID = SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.DISPOSED;
             flag = false;
             break;
         }
         case 2:
         {
             if (!settings.parent)
             {
                 return;
             }
             root = SoundPool.playingAttached;
             rootID = SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.RESERVED;
             flag = false;
             break;
         }
         case 5:
         {
             if (!Camera.main)
             {
                 return;
             }
             transforms = Camera.main.transform;
             root = SoundPool.playingCamera;
             rootID = SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.DISPOSED;
             flag = true;
             break;
         }
         case 6:
         {
             if (!settings.parent)
             {
                 return;
             }
             root = SoundPool.playingAttached;
             rootID = SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.RESERVED;
             flag = true;
             break;
         }
         default:
         {
             goto case 4;
         }
     }
     if (!flag)
     {
         vector3 = settings.localPosition;
         quaternion = settings.localRotation;
         rootID1 = rootID;
         switch (rootID1)
         {
             case SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.RESERVED:
             {
                 vector31 = settings.parent.TransformPoint(vector3);
                 quaternion1 = settings.parent.rotation * quaternion;
                 goto Label1;
             }
             case SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.DISPOSED:
             {
                 vector31 = transforms.TransformPoint(vector3);
                 quaternion1 = transforms.rotation * quaternion;
                 goto Label1;
             }
             case SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.PLAYING | SoundPool.RootID.RESERVED | SoundPool.RootID.DISPOSED:
             {
                 vector31 = vector3;
                 quaternion1 = quaternion;
                 goto Label1;
             }
         }
         return;
     }
     else
     {
         rootID1 = rootID;
         if (rootID1 == (SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.RESERVED))
         {
             vector3 = settings.parent.InverseTransformPoint(settings.localPosition);
             quaternion = settings.localRotation * Quaternion.Inverse(settings.parent.rotation);
         }
         else
         {
             if (rootID1 != (SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.DISPOSED))
             {
                 return;
             }
             vector3 = transforms.InverseTransformPoint(settings.localPosition);
             quaternion = settings.localRotation * Quaternion.Inverse(transforms.rotation);
         }
         vector31 = settings.localPosition;
         quaternion1 = settings.localRotation;
     }
     Label1:
     if (!transforms)
     {
         Camera camera = Camera.main;
         if (!camera)
         {
             return;
         }
         transforms = camera.transform;
         float single = Vector3.Distance(vector31, transforms.position);
         switch (settings.mode)
         {
             case AudioRolloffMode.Logarithmic:
             {
                 if (single > settings.max * 2f)
                 {
                     return;
                 }
                 break;
             }
             case AudioRolloffMode.Linear:
             case AudioRolloffMode.Custom:
             {
                 if (single > settings.max)
                 {
                     return;
                 }
                 break;
             }
         }
     }
     SoundPool.Node node = SoundPool.CreateNode();
     if ((int)node.rootID != 0)
     {
         Debug.LogWarning(string.Concat("Wasn't Limbo ", node.rootID));
     }
     node.root = root;
     node.rootID = rootID;
     node.audio.pan = settings.pan;
     node.audio.panLevel = settings.panLevel;
     node.audio.volume = settings.volume;
     node.audio.dopplerLevel = settings.doppler;
     node.audio.pitch = settings.pitch;
     node.audio.rolloffMode = settings.mode;
     node.audio.minDistance = settings.min;
     node.audio.maxDistance = settings.max;
     node.audio.spread = settings.spread;
     node.audio.bypassEffects = settings.bypassEffects;
     node.audio.priority = settings.priority;
     node.parent = settings.parent;
     node.transform.position = vector31;
     node.transform.rotation = quaternion1;
     node.translation = vector3;
     node.rotation = quaternion;
     node.audio.clip = settings.clip;
     node.Bind();
     node.audio.enabled = true;
     node.audio.Play();
 }
Exemple #35
0
 private static UnityEngine.Object TARG(ref SoundPool.Settings settings)
 {
     UnityEngine.Object obj;
     if (!settings.parent)
     {
         obj = settings.clip;
     }
     else
     {
         obj = settings.parent;
     }
     return obj;
 }
Exemple #36
0
 public Root(SoundPool.RootID id)
 {
     this.id = id;
 }