public void OpenAudioFile() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "All Supported Files (*.wav;*.mp3)|*.wav;*.mp3|All Files (*.*)|*.*"; openFileDialog.Multiselect = true; bool?flag = openFileDialog.ShowDialog(); if (flag.HasValue && flag.Value) { var selFiles = openFileDialog.FileNames; WavesProvider = selFiles.Select(s => new WaveChannel32(new AudioFileReader(s))).ToArray(); foreach (var wav in WavesProvider) { var ap = new AudioProvider(wav); var av = new AudioVolume(ap); var pan = new AudioPan(av); /*Scene.AudioControllers.Add(ap); * Scene.AudioControllers.Add(av); * Scene.AudioControllers.Add(pan); * Scene.AudioControllers.Add(new AudioEqualizer(pan));*/ } } }
private static void AudioJson(string selectedPath) { if (!selectedPath.EndsWith(Paths.AUDIO_FOLDER)) { return; } var info = new DirectoryInfo(selectedPath); var fileInfos = info.GetFiles("*", SearchOption.AllDirectories); var path = Paths.CONFIG_AUDIO_VOLUME_CONFIG; var volumes = new List <AudioVolume>(); if (File.Exists(path)) { var data = JsonMapper.ToObject <AudioVolume[]>(File.ReadAllText(path)); foreach (var fileInfo in fileInfos) { if (fileInfo.Name.EndsWith(".meta")) { continue; } var name = Path.GetFileNameWithoutExtension(fileInfo.Name); var temp = new AudioVolume(); temp.Name = name; temp.Volume = GetVolume(data, name); volumes.Add(temp); } } else { foreach (var fileInfo in fileInfos) { if (fileInfo.Name.EndsWith(".meta")) { continue; } var name = Path.GetFileNameWithoutExtension(fileInfo.Name); var temp = new AudioVolume(); temp.Name = name; temp.Volume = 0.5f; volumes.Add(temp); } } var json = JsonMapper.ToJson(volumes); File.WriteAllText(path, json); Debug.Log("成功生成AudioVolume配置文件"); AssetDatabase.Refresh(); }
public static void Make(GameObject body, float airScale, bool isRaining) { GameObject air = new GameObject(); air.layer = 17; air.SetActive(false); air.transform.parent = body.transform; SphereCollider atmoSC = air.AddComponent <SphereCollider>(); atmoSC.isTrigger = true; atmoSC.radius = airScale; SimpleFluidVolume sfv = air.AddComponent <SimpleFluidVolume>(); sfv.SetValue("_layer", 5); sfv.SetValue("_priority", 1); sfv.SetValue("_density", 1.2f); sfv.SetValue("_fluidType", FluidVolume.Type.AIR); sfv.SetValue("_allowShipAutoroll", true); sfv.SetValue("_disableOnStart", false); if (isRaining) { VisorRainEffectVolume vref = air.AddComponent <VisorRainEffectVolume>(); vref.SetValue("_rainDirection", VisorRainEffectVolume.RainDirection.Radial); vref.SetValue("_layer", 0); vref.SetValue("_priority", 0); AudioSource auds = air.AddComponent <AudioSource>(); auds.mute = false; auds.bypassEffects = false; auds.bypassListenerEffects = false; auds.bypassReverbZones = false; auds.playOnAwake = false; auds.loop = true; auds.priority = 128; auds.volume = 0.35f; auds.pitch = 1f; auds.panStereo = 0f; auds.spatialBlend = 0f; auds.reverbZoneMix = 1f; OWAudioSource owas = air.AddComponent <OWAudioSource>(); owas.SetAudioLibraryClip(AudioType.GD_RainAmbient_LP); owas.SetClipSelectionType(OWAudioSource.ClipSelectionOnPlay.RANDOM); owas.SetTrack(OWAudioMixer.TrackName.Environment); AudioVolume av = air.AddComponent <AudioVolume>(); } air.SetActive(true); }
public override int GetHashCode() { int hash = 13; int prim = 11; hash = (hash * prim) ^ Difficulty.GetHashCode(); hash = (hash * prim) ^ MapWidth.GetHashCode(); hash = (hash * prim) ^ MapHeight.GetHashCode(); hash = (hash * prim) ^ MineDensitiy.GetHashCode(); hash = (hash * prim) ^ AudioVolume.GetHashCode(); hash = (hash * prim) ^ MusicVolume.GetHashCode(); hash = (hash * prim) ^ WindowMode.GetHashCode(); return(hash); }
private static void AudioJson(string selectedPath) { // 判断当前文件夹时候是 Audio 文件夹 if (selectedPath.EndsWith(Paths.AUDIO_FOLDER) == false) { return; } DirectoryInfo info = new DirectoryInfo(selectedPath); FileInfo[] fileInfos = info.GetFiles("*", SearchOption.AllDirectories); List <AudioVolume> volumes = new List <AudioVolume>(); foreach (FileInfo fileInfo in fileInfos) { // 排除 .meta文件 (如果是 mac ,可能还有 mac 自己生成的后缀文件) if (fileInfo.Name.EndsWith(".meta")) { continue; } // 获得文件名(不带后缀) string name = Path.GetFileNameWithoutExtension(fileInfo.Name); var temp = new AudioVolume() { Name = name, Volume = 0.5 }; volumes.Add(temp); } string json = JsonMapper.ToJson(volumes); string path = Paths.CONFIG_AUDIO_VOULME_CONFIG; if (File.Exists(path) == true) { if (EditorUtility.DisplayDialog("警告", "是否覆盖AudioVolume配置文件", "确定", "取消") == false) { return; } } File.WriteAllText(path, json); AssetDatabase.Refresh(); Debug.Log("成功生成 AudioVolume 配置文件"); }
IEnumerator switchAudio(AudioVolume clip) { float d = 0, a = 2f, initVol = source.volume; while (a > d) { d = Mathf.Min(d + Time.deltaTime, a); source.volume = (1 - d / a) * initVol; yield return(null); } source.clip = clip.Clip; d = 0; while (a > d) { d = Mathf.Min(d + Time.deltaTime, a); source.volume = (d / a) * clip.Volume; yield return(null); } source.Play(); }
private static string GetDescription(AudioVolume volume) { var stringBuilder = new StringBuilder(); if (volume.IsDramatic) { stringBuilder.Append("dramatic "); } stringBuilder.Append(volume.VersionName); switch (volume.CollectionType) { case CollectionType.OldTestamentOnly: stringBuilder.Append(" old testament"); break; case CollectionType.NewTestamentOnly: stringBuilder.Append(" new testament"); break; } return(stringBuilder.ToString()); }
public AudioPlayer(AudioSource audio, AudioVolume volume) { this.Audio = audio; this.Volume = volume; this.State = State.None; }
// Use this for initialization void Start() { gameOver = false; if (!audioVolumeScript) { audioVolumeScript = GetComponent <AudioVolume>(); audioVolumeScript.SetVolumeLevels(); } if (!pauseMenuScript) { pauseMenuScript = GetComponent <PauseMenu>(); pauseMenuScript.HidePauseMenu(); } if (!splashScreensScript) { splashScreensScript = GetComponent <SplashScreens>(); } //setup scoreboard scoreboardScript = GameObject.FindGameObjectWithTag("ScoreBoard").GetComponent <Scoreboard>(); //set random player at start 0-100 for larger random chances currentPlayer = Random.Range(0, 100); if (currentPlayer < 50) { currentPlayer = 1; } else { currentPlayer = 2; } //get scripts from player and throw throwScript = player.GetComponent <Throw>(); pControls = player.GetComponent <PlayerControls>(); //spawn jack on initial run time spawnJack(); //setup jack camera jcam = GameObject.FindGameObjectWithTag("JackCamera"); jackCamera = jcam.GetComponent <JackCamera>(); jackCamera.getJack(); cameraOverlay = GameObject.FindGameObjectWithTag("Screen"); cameraOverlay2 = GameObject.FindGameObjectWithTag("Screen2"); camAlt = player.GetComponent <CameraView>(); //Aim Assist aimAssistScript = player.GetComponent <AimAssist>(); //Faultboxes faultBoxes = GameObject.FindGameObjectWithTag("FaultBoxes"); //Populate list with FaultBoxes scripts foreach (FaultBoxes fault in faultBoxes.GetComponentsInChildren <FaultBoxes>()) { faultBoxList.Add(fault); } scoreboardScript.UpdateScoreboard(); //get the music player musicSource = GameObject.FindGameObjectWithTag("MusicPlayer"); splashScreensScript.GameStartPanel(); }
public void OnMediaPlayerAudioVolume(float volume) { AudioVolume?.Invoke(this, new VlcMediaPlayerAudioVolumeEventArgs(volume)); }
private int iterationResult; // Stores result of iteration #endregion Fields #region Constructors /// <summary> /// Class constructor /// </summary> /// <param name="_iterationResult"></param> /// <param name="_category"></param> /// <param name="_callerData"></param> /// <param name="_calleeData"></param> /// <param name="_spResult"></param> private IterationResult(int _iterationResult, CallerIterationInfo _callerData, CalleeIterationInfo _calleeData, SpeechRecognizerResult _callerSpResult, SpeechRecognizerResult _calleeSpResult) { iterationResult = _iterationResult; callerData = _callerData; calleeData = _calleeData; callerSpeechResult = _callerSpResult; calleeSpeechResult = _calleeSpResult; audioPowerResult = AudioVolume.NOT_ATTENUATED; audioVolConf = AudioVolumeConfidence.GOOD_CONFIDENCE; // determine the classification (category) for IterationResult if (iterationResult == ValidationErrors.NO_ERROR) category = TestIterationCategory.PASSED; else if (conditionExists(iterationResult, ValidationErrors.FAILED_CALL) || conditionExists(iterationResult, ValidationErrors.MISSING_HANGUP) || conditionExists(iterationResult, ValidationErrors.ECHO_DETECTED) || conditionExists(iterationResult, ValidationErrors.CALLER_NOISE_DETECTED) || conditionExists(iterationResult, ValidationErrors.CALLEE_NOISE_DETECTED) || conditionExists(iterationResult, ValidationErrors.CALLEE_NOT_HEARD) || conditionExists(iterationResult, ValidationErrors.CALLER_NOT_HEARD)) category = TestIterationCategory.FAILED; //if(iterationResult == ValidationErrors.FAILED_CALL || iterationResult == ValidationErrors.NOISE_DETECTED || iterationResult == ValidationErrors.ECHO_DETECTED) // category = TestIterationCategory.FAILED; else { // Use invalid for all others errors such as callee could not play prompt, execution error etc category = TestIterationCategory.INVALID; } }
public AudioPlayer(AudioSource audio, AudioVolume volume, State state) { this.Audio = audio; this.Volume = volume; this.State = state; }
public string WritePart() { FFMPEGCommand.AddInput(VideoPath); FFMPEGCommand.AddInput(AudioPath); /* * FFMPEGCommand.AddFlag(new SimpleFlag("filter_complex", "[0:a][1:a]amix=duration=first[aout]")); */ FilterComplexExpression fadeExpression = new FilterComplexExpression() .AddInputIdentifier("1:a") .AddFilter(new Filter() .SetName("volume") .SetValue(AudioVolume.ToString())) .AddFilter(new Filter() .SetName("afade") .AddAttribute("t", "in") .AddAttribute("st", "0") .AddAttribute("d", AudioFadeDuration.ToString())) .AddFilter(new Filter() .SetName("afade") .AddAttribute("t", "out") .AddAttribute("st", (VideoDuration - AudioFadeDuration).ToString()) .AddAttribute("d", AudioFadeDuration.ToString())) .SetOutputIdentifier("afaded"); FilterComplexExpression mixExpression = new FilterComplexExpression() .AddInputIdentifier("0:a") .AddInputIdentifier("afaded") .AddFilter(new Filter() .SetName("amix") .AddAttribute("duration", "first")) .SetOutputIdentifier("acompressed"); /* Audio Compressor. */ FilterComplexExpression compressorExpression = new FilterComplexExpression() .AddInputIdentifier("acompressed") .AddFilter(new Filter() .SetName("acompressor") .AddAttribute("threshold", Threshold.ToString()) .AddAttribute("ratio", Ratio) .AddAttribute("attack", Attack.ToString()) .AddAttribute("release", Release.ToString()) .AddAttribute("makeup", MakeupGain.ToString())) .SetOutputIdentifier("aout"); FilterComplexFlag fcf = new FilterComplexFlag() .AddFilterComplexExpression(fadeExpression) .AddFilterComplexExpression(mixExpression) .AddFilterComplexExpression(compressorExpression); FFMPEGCommand.AddFlag(fcf); FFMPEGCommand.AddFlag(new SimpleFlag("map", "0:v")); FFMPEGCommand.AddFlag(new SimpleFlag("map", "[aout]")); FFMPEGCommand.AddFlag(new SimpleFlag("c:v", "copy")); FFMPEGCommand.AddFlag(new SimpleFlag("y", null)); return(FFMPEGCommand.WritePart()); }
public AudioPlayer(AudioPlayer other, AudioVolume volume) : this(other.Audio, volume, other.State) { }
// Use this for initialization void Start() { audioVolume = GetComponent <AudioVolume>(); }
public AudioVolumeSequence(AudioVolume volumeProvider) { volumeProvider = volumeProvider; Changed += OnChanged; }
// Start is called before the first frame update void Start() { AudioVolume.Init(); }