Exemplo n.º 1
0
        /// <summary>
        /// Play requested audio on GameObject. Adds AudioSource if necessary.
        /// </summary>
        /// <param name="obj">Gameobject that plays the sound</param>
        /// <param name="type">Type of sound to be made</param>
        /// <param name="volume">Range: [0,1]</param>
        /// <param name="loop"></param>
        public static void PlayAudio(GameObject obj, AudioCategory type, float volume = 1.0f, bool loop = false)
        {
            AudioSource source = obj.GetComponent <AudioSource>();

            if (source == null)
            {
                // Create AudioSource if necessary and set default values.
                source = obj.AddComponent <AudioSource>();
                source.spatialBlend = 1;
                source.spread       = 90;
                source.rolloffMode  = AudioRolloffMode.Linear;
                source.playOnAwake  = false;
            }

            // Select random clip
            List <AudioClip> audioClips = AudioDictionary[type]; // All audio files of this type
            int       number            = RNG.Next(0, audioClips.Count);
            AudioClip audioClip         = audioClips[number];    // Loads the audioclip from the dictionary

            if (audioClip != null)
            {
                source.clip = audioClip;
                source.loop = loop;
                if (type.ToString().ToLower().Contains("pain") || type.ToString().ToLower().Contains("scream"))
                {
                    source.volume = 0.2f;
                }
                source.Play();
            }
            else
            {
                throw new IndexOutOfRangeException(
                          "Unable to select AudioClip. Ensure that lists in AudioDictionary are filled.");
            }
        }
Exemplo n.º 2
0
 public SoundItem(string itemName, AudioCategory catrgory)
 {
     AudioPath = $"Assets/Audio/{catrgory.ToString()}/{itemName}.wav";
     ImgPath   = $"Assets/Images/{catrgory.ToString()}/{itemName}.png";
     Catrgory  = catrgory;
     Name      = itemName;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users = new UsersCategory(this);
            Friends = new FriendsCategory(this);
            Status = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups = new GroupsCategory(this);
            Audio = new AudioCategory(this);
            Wall = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils = new UtilsCategory(this);
            Fave = new FaveCategory(this);
            Video = new VideoCategory(this);
            Account = new AccountCategory(this);
            Photo = new PhotoCategory(this);
            Docs = new DocsCategory(this);
            Likes = new LikesCategory(this);
            Pages = new PagesCategory(this);
            Gifts = new GiftsCategory(this);
            Apps = new AppsCategory(this);
            NewsFeed = new NewsFeedCategory(this);
            Stats = new StatsCategory(this);
            Auth = new AuthCategory(this);
            Markets = new MarketsCategory(this);
            Execute = new ExecuteCategory(this);

            RequestsPerSecond = 3;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 音を再生します。
        /// </summary>
        /// <param name="filename">(<see cref="string"/>)ファイル名</param>
        /// <param name="audiocategory">(<see cref="AudioCategory"/>)オーディオ情報の目的</param>
        public static IAsyncInfo PlayAsync(string filename, AudioCategory audiocategory)
        {
            if (rootPage == null)
            {
                if (ApplicationSetting.rootPage != null)
                {
                    rootPage = ApplicationSetting.rootPage;
                }
                else
                {
                    throw new NullReferenceException("Tools.Screens.rootPage に 表示するページ(通常は this)を入れてください。");
                }
            }
            return(AsyncInfo.Run((token) => {
                return Task.Run(async() => {
                    try {
                        await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => {
                            var uri = new Uri("ms-appx:///" + filename, UriKind.Absolute);
                            var file = await StorageFile.GetFileFromApplicationUriAsync(uri);

                            stream = await file.OpenAsync(FileAccessMode.Read);
                            MediaElement me = new MediaElement();
                            me.SetSource(stream, file.ContentType);
                            me.AutoPlay = false;
                            me.AreTransportControlsEnabled = true;
                            me.AudioCategory = audiocategory;
                            me.Play();
                        });
                    }
                    catch (Exception ex) {
                        Debug.Fail("Sounds.PlayAsync", ex.Message);
                    }
                });
            }));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
            Photo    = new PhotoCategory(this);
            Docs     = new DocsCategory(this);
            Likes    = new LikesCategory(this);
            Pages    = new PagesCategory(this);
            Gifts    = new GiftsCategory(this);
            Apps     = new AppsCategory(this);
            NewsFeed = new NewsFeedCategory(this);
            Stats    = new StatsCategory(this);
            Auth     = new AuthCategory(this);

            RequestsPerSecond = 3;
        }
Exemplo n.º 6
0
        }         // enum Sounds
        #endregion

        #region Constructor
        /// <summary>
        /// Create sound
        /// </summary>
        static Sound()
        {
            try
            {
                string dir = Directories.SoundsDirectory;
                audioEngine = new AudioEngine(
                    Path.Combine(dir, "RocketCommanderXna.xgs"));
                waveBank1 = new WaveBank(audioEngine,
                                         Path.Combine(dir, "Wave Bank.xwb"));
                // Use streaming for music to save memory
                //waveBank2 = new WaveBank(audioEngine,
                //	Path.Combine(dir, "Wave Bank 2.xwb"), 0, 16);

                // Dummy wavebank call to get rid of the warning that waveBank is
                // never used (well it is used, but only inside of XNA).
                if (waveBank1 != null)                // &&
                //waveBank2 != null)
                {
                    soundBank = new SoundBank(audioEngine,
                                              Path.Combine(dir, "Sound Bank.xsb"));
                }

                // Get the gears category to change volume and pitching of gear sounds
                motorCategory    = audioEngine.GetCategory("Motor");
                rocketMotorSound = soundBank.GetCue("RocketMotor");
            }             // try
            catch (Exception ex)
            {
                // Audio creation crashes in early xna versions, log it and ignore it!
                Log.Write("Failed to create sound class: " + ex.ToString());
            }     // catch
        }         // Sound()
Exemplo n.º 7
0
 public void StartCategoryTransition(bool toInGame)
 {
     transition = true;
     if (toInGame)
     {
         oldCategory     = menuCategory;
         currentCategory = graphXPackCategory;
         currentCategory.Stop(AudioStopOptions.Immediate);
         oldMusic        = currentMusic;
         currentPlaylist = graphXPackPlaylist;
         currentMusic    = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         popUpText.Text  = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     else
     {
         oldCategory     = graphXPackCategory;
         currentCategory = menuCategory;
         currentCategory.Stop(AudioStopOptions.Immediate);
         oldMusic        = currentMusic;
         currentPlaylist = playList;
         currentMusic    = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         popUpText.Text  = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     currentVolume = 0;
     currentCategory.SetVolume(currentVolume);
     currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
     currentMusic.Play();
 }
Exemplo n.º 8
0
    protected virtual void StartCurSentence()
    {
        if (m_CurSentenceIndex >= CorePlayData.CurrentSong.NonRhythmSenteces.Count)
        {
            m_Status = Status.Finish;
            CorePlayManager.Instance.GameFinish();
            return;
        }

        m_CurrentStreamSentence = CorePlayData.CurrentSong.NonRhythmSenteces[m_CurSentenceIndex];
        m_CurSentenceLength     = m_CurrentStreamSentence.Duration;
        switch (m_CurrentStreamSentence.Type)
        {
        case SentenceType.NonRhythmCommon:
            m_Status = Status.Reading;

            PlayAudio();
            break;

        case SentenceType.NonRhythmVoice:
            m_Status = Status.WaitForSpeech;
            if (string.IsNullOrEmpty(m_CurrentStreamSentence.Speaker) == false)
            {
                AudioCategory ac          = AudioController.GetCategory("AudioWords");
                var           obj_speaker = ac.Play(m_CurrentStreamSentence.Speaker);
                obj_speaker.completelyPlayedDelegate = PlayNonRhythmVoice;
                m_Timer = 0;
            }
            else
            {
                PlayNonRhythmVoice();
            }
            break;
        }
    }
Exemplo n.º 9
0
        public IEnumerator LoadAudioFiles(DirectoryInfo dir)
        {
            FileInfo[] files = new DirectoryInfo(dir.FullName + "/Audio").GetFiles("*.wav");
            foreach (FileInfo file in files)
            {
                GeneralManager.Instance.LogToFileOrConsole("[PromDate] Loading audio file: " + file.Name);
                WWW www = new WWW("file:///" + file.FullName);
                yield return(www);

                if (www.error != null)
                {
                    GeneralManager.Instance.LogToFileOrConsole(www.error);
                }
                AudioClip clip = www.GetAudioClip(false, false);
                clip.LoadAudioData();
                clip.name = file.Name.Split('.')[0];
                while (clip.loadState == AudioDataLoadState.Loading || clip.loadState == AudioDataLoadState.Unloaded)
                {
                    yield return(0);
                }
                AudioCategory category = AudioController.GetCategory(clip.name.Split('_')[0].ToUpper());
                if (category == null)
                {
                    category = AudioController.GetCategory("VOICE");
                }
                AudioItem audioItem = AudioController.AddToCategory(category, clip, clip.name);
                ((Dictionary <string, AudioItem>) typeof(AudioController).GetField("_audioItems", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(AudioController.Instance)).Add(audioItem.Name, audioItem);
                GeneralManager.Instance.LogToFileOrConsole("[PromDate] Finished loading audio: " + file.Name);
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Plays a sound clip AT A SPECIFIC POSITION that won't be interrupted.
 /// Also returns the AudioSource so the sound clip can be controlled (paused, stopped, volume, pitch, etc).
 /// Slightly slower and uses more memory than PlayClip().
 /// </summary>
 /// <param name="audioClip"></param>
 /// <param name="ac"></param>
 /// <param name="position"></param>
 /// <param name="volume">Volume prior to any user settings (master volume, sfx volume, etc).</param>
 /// <param name="pitch"></param>
 /// <returns></returns>
 public AudioSource PlayClipControllable(AudioClip audioClip, AudioCategory ac, Vector3 position, float volume = 1, float pitch = 1)
 {
     if (audioClip)
     {
         float adjVolume = CalcAdjustedVolume(ac, volume);
         // start with simplest and fastest option
         audioSourceSfx = audioSourceSfxPool.GetNextAudioSource();
         if (!audioSourceSfx.isPlaying)
         {
             audioSourceSfx.clip   = audioClip;
             audioSourceSfx.volume = adjVolume;
             audioSourceSfx.pitch  = pitch;
             audioSourceSfx.Play();
             return(audioSourceSfx);
         }
         // Slightly slower option
         else
         {
             AudioSource audioSourceTemp = PlayClipNewAudioSource(audioClip, ac, AudioManager.Instance.transform, Vector3.zero, volume, pitch);
             return(audioSourceTemp);
         }
     }
     else
     {
         Debug.LogError("AudioManager.PlayClipControllable() call received a bad or missing audioclip: " + audioClip);
         return(null);
     }
 }
Exemplo n.º 11
0
    public void PlayAudio(AudioCategory audio)
    {
        GameObject target = null;

        switch (audio)
        {
        case AudioCategory.CardPlace:
            target = AudioPlayerCardPlace;
            break;

        case AudioCategory.CardPlay:
            target = AudioPlayerCardPlay;
            break;

        case AudioCategory.CardShuffle:
            target = AudioPlayerShuffle;
            break;
        }
        if (target != null)
        {
            // Get all the audio sources
            AudioSource[] sources = target.GetComponents <AudioSource>();
            // Pick a random one
            int randomSource = Random.Range(0, sources.Length);
            sources[randomSource].Play();
        }
    }
Exemplo n.º 12
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load content belonging to the screen manager.
            ContentManager content = Game.Content;

            spriteBatch      = new SpriteBatch(GraphicsDevice);
            font             = content.Load <SpriteFont>("menufont");
            blankTexture     = content.Load <Texture2D>("blank");
            screenInCounter  = 0;
            originalViewport = GraphicsDevice.Viewport;
            audioEngine      = new AudioEngine("Content\\Sounds.xgs");
            soundBank        = new SoundBank(audioEngine, "Content\\SoundBank.xsb");
            waveBank         = new WaveBank(audioEngine, "Content\\WaveBank.xwb", 0, 64);
            while (!waveBank.IsPrepared)
            {
                audioEngine.Update();
            }
            musicCategory = audioEngine.GetCategory("Music");
            musicCategory.SetVolume(1);
            shipchosenBool1     = false;
            shipchosenBool2     = false;
            currentShipChoosing = 1;
            mainMenu            = soundBank.GetCue("MainMenu");
            mainMenu.Play();
            // Tell each of the screens to load their content.
            foreach (GameScreen screen in screens)
            {
                screen.Activate(false);
            }
        }
Exemplo n.º 13
0
        // ********************************************************************
        public static bool ChannelAvailable(AudioCategory _category)
        {
            int objectPoolObjects = (instance as AudioManager).m_audioObjectPools[_category].Count;
            int nonPooledObjects  = (instance as AudioManager).m_nonPooledObjects[_category].Count;

            return(objectPoolObjects + nonPooledObjects < (instance as AudioManager).m_audioCategorySettings_Internal[_category].numChannels);
        }
Exemplo n.º 14
0
        void Init(string name, string folder, string soundCategoryName, string musicCategoryName)
        {
            try
            {
                AudioEngine = new AudioEngine(string.Format(".\\Content\\{0}\\{1}.xgs", folder, name));
                WaveBank    = new WaveBank(AudioEngine, string.Format(".\\Content\\{0}\\Wave Bank.xwb", folder));
                SoundBank   = new SoundBank(AudioEngine, string.Format(".\\Content\\{0}\\Sound Bank.xsb", folder));

                SoundCategoryName = soundCategoryName;
                MusicCategoryName = musicCategoryName;

                if (!string.IsNullOrEmpty(SoundCategoryName))
                {
                    SoundCategory = AudioEngine.GetCategory(SoundCategoryName);
                }
                if (!string.IsNullOrEmpty(MusicCategoryName))
                {
                    MusicCategory = AudioEngine.GetCategory(MusicCategoryName);
                }
            }
            catch (Exception ex)
            {
                throw ex;
                //PopupMgr.CreatePopup(ex.Message);
            }
        }
Exemplo n.º 15
0
        public AudioManager(Game game, String AudioEnginePath, String SoundBankPath, String SE_WaveBankPath, String BGM_WaveBankPath)
            : base(game)
        {
            DefaultAudioEnginePathValues = false;

            _aEnginePath2     = AudioEnginePath;
            _aSoundBankPath2  = SoundBankPath;
            _seWaveBankPath2  = SE_WaveBankPath;
            _bgmWaveBankPath2 = BGM_WaveBankPath;

            try
            {
                _audioEngine = new AudioEngine(_aEnginePath2);
                _aSoundBank  = new SoundBank(_audioEngine, _aSoundBankPath2);
                _seWaveBank  = new WaveBank(_audioEngine, _seWaveBankPath2);
                _bgmWaveBank = new WaveBank(_audioEngine, _bgmWaveBankPath2, 0, 16);
            }
            catch (NoAudioHardwareException)
            {
                _audioEngine = null;
                _aSoundBank  = null;
                _seWaveBank  = null;
                _bgmWaveBank = null;
            }

            _seCategory  = _audioEngine.GetCategory("SE");
            _bgmCategory = _audioEngine.GetCategory("BGM");

            _seCategory.SetVolume(_seVolume);
            _bgmCategory.SetVolume(_bgmVolume);

            _gameRef = game;
            _AudMan  = this;
        }
Exemplo n.º 16
0
        public static void GenerateAOCtrl(AudioController aoCtrler, Dictionary <string, XCategory> dictData)
        {
            // 增加
            aoCtrler.AudioCategories = new AudioCategory[dictData.Count];
            int nIndex = 0;

            foreach (var category in dictData)
            {
                AudioCategory cat = new AudioCategory(aoCtrler);
                aoCtrler.AudioCategories[nIndex] = cat;
                cat.Name = category.Key;
                nIndex++;

                cat.AudioItems = new AudioItem[category.Value._lstItems.Count];
                for (int i = 0; i < category.Value._lstItems.Count; ++i)
                {
                    AudioItem curItem = new AudioItem();
                    cat.AudioItems[i] = curItem;
                    curItem.Name      = category.Value._lstItems[i].strItemName;
                    curItem.subItems  = new AudioSubItem[category.Value._lstItems[i]._lstSubItems.Count];

                    for (int j = 0; j < category.Value._lstItems[i]._lstSubItems.Count; ++j)
                    {
                        curItem.subItems[j]      = new AudioSubItem();
                        curItem.subItems[j].Clip = AssetDatabase.LoadAssetAtPath <AudioClip>(category.Value._lstItems[i]._lstSubItems[j]._strAoFilePath);
                    }
                }
            }
        }
Exemplo n.º 17
0
        public void SetVolume(AudioCategory category, float volume)
        {
            volume = Mathf.Clamp(volume, 0f, 1f);
            this.audioSources[category].volume = volume;
            bool flag = true;

            if (category == AudioCategory.Music)
            {
                bool flag2 = Service.EnvironmentController.IsMusicPlaying();
                bool flag3 = this.IsThirdPartyNativePluginActive();
                flag = (!flag2 && !flag3);
            }
            if (volume == 0f || (category == AudioCategory.Music && !flag))
            {
                this.audioSources[category].mute = true;
                this.audioSources[category].Stop();
                if (category == AudioCategory.Music || category == AudioCategory.Ambience || category == AudioCategory.Dialogue)
                {
                    this.UnloadLastPlayed(category);
                }
                else if (category == AudioCategory.Effect)
                {
                    this.UnloadEffectsAudio();
                }
            }
            else
            {
                this.audioSources[category].mute = false;
                if (category == AudioCategory.Music || category == AudioCategory.Ambience)
                {
                    Service.EventManager.SendEvent(EventId.MusicUnmuted, null);
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Create sound.
        /// </summary>
        public static void Initialize()
        {
            try
            {
                string dir = Directories.SoundsDirectory;
                audioEngine = new AudioEngine(Path.Combine(dir, "RacingGameManager.xgs"));
                waveBank    = new WaveBank(audioEngine, Path.Combine(dir, "Wave Bank.xwb"));

                if (waveBank != null)
                {
                    soundBank = new SoundBank(audioEngine,
                                              Path.Combine(dir, "Sound Bank.xsb"));
                }

                // Get the categories needed to change volume and pitching
                defaultCategory = audioEngine.GetCategory("Default");
                gearsCategory   = audioEngine.GetCategory("Gears");
                musicCategory   = audioEngine.GetCategory("Music");

                SetVolumes(GameSettings.Default.SoundVolume,
                           GameSettings.Default.MusicVolume);
            }
            catch (NoAudioHardwareException ex)
            {
                // Is they have no Audio hardware, note it and move on. Surface any
                // other exception that occurs since something is actually wrong!
                Log.Write("Failed to create sound class: " + ex.ToString());
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi(ICaptchaSolver captchaSolver = null)
        {
            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Board    = new BoardCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
            Photo    = new PhotoCategory(this);
            Docs     = new DocsCategory(this);
            Likes    = new LikesCategory(this);
            Pages    = new PagesCategory(this);
            Gifts    = new GiftsCategory(this);
            Apps     = new AppsCategory(this);
            NewsFeed = new NewsFeedCategory(this);
            Stats    = new StatsCategory(this);
            Auth     = new AuthCategory(this);
            Markets  = new MarketsCategory(this);
            Execute  = new ExecuteCategory(this);

            RequestsPerSecond = 3;

            MaxCaptchaRecognitionCount = 5;
            _captchaSolver             = captchaSolver;
        }
Exemplo n.º 20
0
Arquivo: Music.cs Projeto: THSJF/sjf
 public static void Init()
 {
     Music.AE = new AudioEngine("Content/Music/01.xna");
     Music.WB = new WaveBank(Music.AE, "Content/Music/02.xna", 0, (short)4);
     Music.SB = new SoundBank(Music.AE, "Content/Music/03.xna");
     Music.MV = Music.AE.GetCategory(nameof(Music));
 }
        /// <summary>
        /// Sets the given category's volume, including all audio entries of said category.
        /// </summary>
        /// <param name="category">The category to update.</param>
        /// <param name="volume">The new volume audio entries should be played at.</param>
        public static void SetCategoryVolume(AudioCategory category, float volume)
        {
            AudioCategoryVolumes[(int)category] = volume;

            AudioEntries.FindAll(entry => entry.Category == category)
            .ForEach(entry => entry.AudioSource.volume = volume);
        }
Exemplo n.º 22
0
    void RepeatVoice(StreamSentence sentence)
    {
        m_Status = Status.RepeatingVoice;
        m_WaitingForRepeatFinish = true;
        CorePlayManager.Instance.ShowHorn();

        if (m_AudioRepeatList.Count > 0)
        {
            // 暂时不支持拼字
            AudioCategory ac  = AudioController.GetCategory("AudioWords");
            var           obj = ac.Play(m_AudioRepeatList[0]);
            //LogManager.Log ("play : " , m_AudioRepeatList[0]);

            if (obj != null)
            {
                obj.completelyPlayedDelegate = (v) => {
                    MicManager.Instance.Play(sentence.needRecord, RepeatVoiceFinish, sentence.Sentence[0].Key);
                };
            }
        }
        else
        {
            MicManager.Instance.Play(sentence.needRecord, RepeatVoiceFinish, sentence.Sentence[0].Key);
        }
    }
Exemplo n.º 23
0
    private void PlayWordFor(AudioObject obj = null)
    {
        CreateTapSentence();
        AudioCategory ac = AudioController.GetCategory("AudioWords");

        ac.Play(m_CurrentStreamSentence.FileName);
        //LogManager.Log ("PlayWordFor : " , m_CurrentStreamSentence.FileName);
    }
Exemplo n.º 24
0
 public void PlaySource(AudioSource source, AudioCategory category, float delay = 0f)
 {
     if ((category == AudioCategory.BGMusic && bgMusicOn) ||
         (category == AudioCategory.SoundEffect && soundEffectsOn))
     {
         source.Play();
     }
 }
Exemplo n.º 25
0
 public void PlayOneShot(AudioClip clip, AudioCategory category)
 {
     if (clip)
     {
         AudioSource audioSource = GetAudioSource(category);
         audioSource.PlayOneShot(clip);
     }
 }
Exemplo n.º 26
0
 public float GetClipLength(AudioCategory category)
 {
     if (this.audioSources[category].clip != null)
     {
         return(this.audioSources[category].clip.length);
     }
     return(0f);
 }
Exemplo n.º 27
0
 public void SetCategory(AudioCategory cat)
 {
     if (category == cat)
     {
         return;
     }
     category = cat;
     CalculateWeight();
 }
        private static AudioEntry GetAudioEntry(AudioCategory category)
        {
            AudioEntry audioEntry = AudioEntries.Find(entry => !entry.AudioSource.isPlaying) ?? AddAudioEntry();

            audioEntry.Id       = _idCounter++;
            audioEntry.Category = category;

            return(audioEntry);
        }
Exemplo n.º 29
0
        // ********************************************************************
        public static void StopCategory(AudioCategory _category)
        {
            List <AudioObject> audioObjects = AudioManager.GetActiveAudioForCategory(_category);

            for (int i = 0; i < audioObjects.Count; ++i)
            {
                audioObjects[i].Stop();
            }
        }
Exemplo n.º 30
0
        // ********************************************************************
        public static void FadeOutCategory(AudioCategory _category)
        {
            List <AudioObject> audioObjects = AudioManager.GetActiveAudioForCategory(_category);

            for (int i = 0; i < audioObjects.Count; ++i)
            {
                audioObjects[i].Fade(false);
            }
        }
Exemplo n.º 31
0
        public static void StopAll(bool immediate = false)
        {
            AudioCategory c = m_audioEngine.GetCategory("Default");

            c.Stop(immediate ? AudioStopOptions.Immediate : AudioStopOptions.AsAuthored);

            c = m_audioEngine.GetCategory("Music");
            c.Stop(immediate ? AudioStopOptions.Immediate : AudioStopOptions.AsAuthored);
        }
Exemplo n.º 32
0
Arquivo: VkApi.cs Projeto: justloot/vk
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users = new UsersCategory(this);
            Friends = new FriendsCategory(this);
            Status = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups = new GroupsCategory(this);
            Audio = new AudioCategory(this);
            Wall = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils = new UtilsCategory(this);
            Fave = new FaveCategory(this);
            Video = new VideoCategory(this);
			Account = new AccountCategory(this);

            ApiVersion = "5.9";
        }
Exemplo n.º 33
0
 bool _IsCategoryParentOf( AudioCategory toTest, AudioCategory parent )
 {
     var cat = toTest;
     while ( cat != null )
     {
         if ( cat == parent ) return true;
         cat = cat.parentCategory;
     }
     return false;
 }
Exemplo n.º 34
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users = new UsersCategory(this);
            Friends = new FriendsCategory(this);
            Status = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups = new GroupsCategory(this);
            Audio = new AudioCategory(this);
            Wall = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils = new UtilsCategory(this);
            Fave = new FaveCategory(this);
            Video = new VideoCategory(this);
			Account = new AccountCategory(this);
            Photo = new PhotoCategory(this);
            Docs = new DocsCategory(this);
            Likes = new LikesCategory(this);
			
            RequestsPerSecond = 3;
        }
Exemplo n.º 35
0
    /// <summary>
    /// Initializes the audio item for a certain category. (Internal use only, not required to call).
    /// </summary>
    internal void _Initialize( AudioCategory categ )
    {
        category = categ;

        _NormalizeSubItems();
    }
Exemplo n.º 36
0
 internal AudioCategoryExtended(AudioCategory audioCategory, VkApi vk)
 {
     _audio = audioCategory;
     _vk = vk;
 }
 public void SetAudioCategory(AudioCategory category)
 {
     OutputMedia.AudioCategory = category;
 }
    protected override void LoadContent()
    {
        audioEngine = new AudioEngine("Content\\Audio\\Audio.xgs");
        waveBank = new WaveBank(audioEngine, "Content\\Audio\\myWaveBank.xwb");
        soundBank = new SoundBank(audioEngine, "Content\\Audio\\mySoundBank.xsb");
        musicCategory = audioEngine.GetCategory("Music");
        defaultCategory = audioEngine.GetCategory("Default");

        for (int i = 0; i < cueArray.Length; i++)
        {
            cueArray[i] = soundBank.GetCue("engine");
            cueArray[i].Apply3D(listener_, CarSoundEmitters.AudioEmitters[i]);
            cueArray[i].Play();
        }

        base.LoadContent();
    }