/// <summary> /// 开启或禁止播放音乐 /// </summary> /*public static bool Enable * { * get { return ! denySound; } * set * { * denySound = !value; * * if (! value) * { * foreach (Transform t in instance.transform) * GameObject.Destroy(t.gameObject); * } * * PlayerPrefs.SetInt("deny_sound", denySound ? 1 : 0); * } * }*/ /// <summary> /// 播放背景音乐 /// </summary> public static void PlayBackGroundSound(string soundFile, bool bLoop, bool bFade) { if (denyBackGroundSound) { return; } if (string.IsNullOrEmpty(backGroundSoundName)) { backGroundSoundName = soundFile; } else if (backGroundSoundName.Equals(soundFile)) { return; } else { StopImmediately(backGroundSoundName); backGroundSoundName = soundFile; } AudioClip clip = AudioLoader.LoadAudio(soundFile); if (clip == null) { App.log.Print("音乐文件{0}不存在", soundFile); return; } Play(clip, bLoop, bFade, true); }
static void Main(string[] args) { try { var settings = new Settings(); using (var parser = new CommandLine.Parser(x => { x.CaseSensitive = false; x.IgnoreUnknownArguments = true; })) { if (!parser.ParseArguments(args, settings)) { Console.Error.WriteLine(settings.GetUsage()); return; } } if (settings.InputFiles == null) { RunMultiDumper(ref settings); } else { // We want to expand any wildcards in the input file list (and also fully qualify them) settings.InputFiles = settings.InputFiles .SelectMany(s => Directory .EnumerateFiles(Directory.GetCurrentDirectory(), s) .OrderByAlphaNumeric(x => x)) .ToList(); } if (settings.InputFiles == null || !settings.InputFiles.Any()) { Console.Error.WriteLine(settings.GetUsage()); throw new Exception("No inputs specified"); } using (var loader = new AudioLoader { AutoScalePercentage = settings.AutoScalePercentage, HighPassFilterFrequency = settings.HighPassFilterFrequency, VerticalScaleMultiplier = settings.VerticalScaleMultiplier, }) { loader.LoadAudio(settings.InputFiles); Render(settings, loader); } } catch (Exception e) { Console.Error.WriteLine($"Fatal: {e}"); } }
/// <summary> /// 延时播放音乐 /// </summary> public static void Play(string soundFile, bool bLoop, bool bFade, float delay) { AudioClip clip = AudioLoader.LoadAudio(soundFile); if (clip == null) { App.log.Print("音乐文件{0}不存在", soundFile); return; } PlayByDelay(clip, bLoop, bFade, delay); }
/// <summary> /// 加入等待播放队列 /// </summary> public static void JoinPlayQueue(string soundFile, float delay) { //Waitlist.Add(new WaitMuisc(soundFile, delay)); AudioClip clip = AudioLoader.LoadAudio(soundFile); if (clip == null) { App.log.Print("音乐文件{0}不存在", soundFile); return; } Play(clip, false, true, false, delay); }
/// <summary> /// 播放音乐 /// </summary> public static bool Play(string soundFile, bool bLoop, bool bFade) { AudioClip clip = AudioLoader.LoadAudio(soundFile); if (clip == null) { App.log.Print("音乐文件{0}不存在", soundFile); return(false); } Play(clip, bLoop, bFade); return(true); }
void OnFiles(List <string> aFiles, POINT aPos) { m_loader.LoadAudio(aFiles[0]); }