public void preloadEffect(string pszFilePath) { if (pszFilePath.Length <= 0) { return; } uint num = SimpleAudioEngine._Hash(pszFilePath); if (SimpleAudioEngine.sharedList().ContainsKey(num)) { return; } EffectPlayer effectPlayer = new EffectPlayer(); effectPlayer.Open(SimpleAudioEngine._FullPath(pszFilePath), num); SimpleAudioEngine.sharedList().Add(num, effectPlayer); }
/** * @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; } } EffectPlayer eff = new EffectPlayer(); 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 */ public void preloadEffect(string pszFilePath) { do { if (pszFilePath.Length <= 0) { break; } uint nID = _Hash(pszFilePath); if (sharedList().ContainsKey(nID)) { break; } EffectPlayer eff = new EffectPlayer(); eff.Open(_FullPath(pszFilePath), nID); sharedList().Add(nID, eff); } while (false); }
/** @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; } } EffectPlayer eff = new EffectPlayer(); 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 */ public void preloadEffect(string pszFilePath) { do { if (pszFilePath.Length <= 0) break; uint nID = _Hash(pszFilePath); if (sharedList().ContainsKey(nID)) break; EffectPlayer eff = new EffectPlayer(); eff.Open(_FullPath(pszFilePath), nID); sharedList().Add(nID, eff); } while (false); }