示例#1
0
        // Load the sound effect found with the given path. The sound effect is only loaded one time and the
        // effect is cached as an instance of EffectPlayer.
        public void PreloadEffect(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return;
            }

            int nId = filename.GetHashCode();

            lock (list)
            {
                if (list.ContainsKey(nId))
                {
                    return;
                }
            }
            CCEffectPlayer eff = new CCEffectPlayer();

            eff.Open(FullPath(filename), nId);
            eff.Volume = effectsVolume;
            lock (list)
            {
                list[nId] = eff;
            }
        }
        /**
         * @brief       preload a compressed audio file
         * @details	    the compressed audio will be decode to wave, then write into an
         * internal buffer in SimpleaudioEngine
         */


        /// <summary>
        /// Load the sound effect found with the given path. The sound effect is only loaded one time and the
        /// effect is cached as an instance of EffectPlayer.
        /// </summary>
        public void PreloadEffect(string pszFilePath)
        {
            if (_NoAudioHardware)
            {
                return;
            }
            if (string.IsNullOrEmpty(pszFilePath))
            {
                return;
            }

            int nId = pszFilePath.GetHashCode();

            lock (SharedList)
            {
                if (SharedList.ContainsKey(nId))
                {
                    return;
                }
            }
            try
            {
                CCEffectPlayer eff = new CCEffectPlayer();
                eff.Open(FullPath(pszFilePath), nId);
                SharedList[nId] = eff;
            }
            catch (NoAudioHardwareException ex)
            {
                _NoAudioHardware = true;
                CCLog.Log(ex.ToString());
            }
        }
示例#3
0
        /**
         * @brief       preload a compressed audio file
         * @details	    the compressed audio will be decode to wave, then write into an
         * internal buffer in SimpleaudioEngine
         */


        /// <summary>
        /// Load the sound effect found with the given path. The sound effect is only loaded one time and the
        /// effect is cached as an instance of EffectPlayer.
        /// </summary>
        public void PreloadEffect(string pszFilePath)
        {
            if (string.IsNullOrEmpty(pszFilePath))
            {
                return;
            }

            int nId = pszFilePath.GetHashCode();

            lock (SharedList)
            {
                if (SharedList.ContainsKey(nId))
                {
                    return;
                }
            }
            CCEffectPlayer eff = new CCEffectPlayer();

            eff.Open(FullPath(pszFilePath), nId);
            SharedList[nId] = eff;
        }
        /**
        @brief  		preload a compressed audio file
        @details	    the compressed audio will be decode to wave, then write into an 
        internal buffer in SimpleaudioEngine
        */


        /// <summary>
        /// Load the sound effect found with the given path. The sound effect is only loaded one time and the
        /// effect is cached as an instance of EffectPlayer.
        /// </summary>
        public void PreloadEffect(string pszFilePath)
        {
            if (string.IsNullOrEmpty(pszFilePath))
            {
                return;
            }

            int nId = pszFilePath.GetHashCode();
            lock (SharedList)
            {
                if (SharedList.ContainsKey(nId))
                {
                    return;
                }
            }
            CCEffectPlayer eff = new CCEffectPlayer();
            eff.Open(FullPath(pszFilePath), nId);
            SharedList[nId] = eff;
        }
        // Load the sound effect found with the given path. The sound effect is only loaded one time and the
        // effect is cached as an instance of EffectPlayer.
        public void PreloadEffect(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return;
            }

            int nId = filename.GetHashCode();
            lock (SharedList)
            {
                if (SharedList.ContainsKey(nId))
                {
                    return;
                }
            }
            CCEffectPlayer eff = new CCEffectPlayer();
            eff.Open(FullPath(filename), nId);
			eff.Volume = effectsVolume;
            SharedList[nId] = eff;
        }
        /**
        @brief  		preload a compressed audio file
        @details	    the compressed audio will be decode to wave, then write into an 
        internal buffer in SimpleaudioEngine
        */


        /// <summary>
        /// Load the sound effect found with the given path. The sound effect is only loaded one time and the
        /// effect is cached as an instance of EffectPlayer.
        /// </summary>
        public void PreloadEffect(string pszFilePath)
        {
            if (_NoAudioHardware) return;
            if (string.IsNullOrEmpty(pszFilePath))
            {
                return;
            }

            int nId = pszFilePath.GetHashCode();
            lock (SharedList)
            {
                if (SharedList.ContainsKey(nId))
                {
                    return;
                }
            }
            try
            {
                CCEffectPlayer eff = new CCEffectPlayer();
                eff.Open(FullPath(pszFilePath), nId);
                SharedList[nId] = eff;
            }
            catch (NoAudioHardwareException ex)
            {
                _NoAudioHardware = true;
                CCLog.Log(ex.ToString());
            }
        }