public void MakeDamage(float damage) { if (DamageMeter.instance.isActive) { DamageMeter.instance.damage += damage; } if (ShipsController.instance.doubleDamageActive) { damage = damage * 2f; } if (health <= damage) { if (isActive) { isActive = false; destroyWithPointsAction.Invoke(); RemoveFromExpObjList(); } } else { health -= damage; StartCoroutine(DamageAnimation()); string audioEffectPoolPath = "Prefabs/AudioEffects/hitEffect"; GameObject audioEffectObj = ObjectsPool.PullObject(audioEffectPoolPath); AudioEffect audioEffect = audioEffectObj.GetComponent <AudioEffect> (); audioEffect.poolPath = audioEffectPoolPath; audioEffect.StartEffect(); } }
public override void SendMsg(string AudioName, AudioState State, AudioEffect effect) { if (RepeatAudioPool.ContainsKey(AudioName)) { _AudioState.AudioExcute(RepeatAudioPool[AudioName], State, effect); } }
void Update() { if (Fade.GetComponent <CanvasGroup>().alpha == 0 && !Call1) { Call1 = true; Destroy(Fade.GetComponent <scrInitialFade>()); Chat.SetActive(true); } if (Chat == null) { Fade.GetComponent <CanvasGroup>().alpha += 0.008f; if (!call3) { Musica.GetComponent <scrAudioManager>().enabled = false; call3 = true; } Musica.GetComponent <AudioSource>().volume -= 0.008f; AudioEffect.GetComponent <AudioSource>().volume -= 0.008f; if (Fade.GetComponent <CanvasGroup>().alpha == 1 && !call2) { call2 = true; StartCoroutine(LoadScene()); } } }
public void PlayEffect(AudioEffect effect) { switch (effect) { case AudioEffect.GainCash: effectSource.PlayOneShot(gainCash); break; case AudioEffect.BellNotification: effectSource.PlayOneShot(bellNotification); break; case AudioEffect.StartDialogue: effectSource.PlayOneShot(startDialogue); break; case AudioEffect.SelectDialogueOption: effectSource.PlayOneShot(selectDialogueOption); break; case AudioEffect.ReadNewsNoNotif: effectSource.PlayOneShot(readNewsNoNotification); break; default: throw new ArgumentOutOfRangeException(nameof(effect), effect, null); } }
public void SetSoundEffect() { if (type != 7 && type != 8 && type != 9) { string audioEffectPoolPath = ""; if ( type == 1 || type == 2 || type == 3 || type == 6) { int expIndex = Random.Range(0, 5); audioEffectPoolPath = "Prefabs/AudioEffects/Explodes/exp" + expIndex.ToString(); } else if (type == 4 || type == 5) { int expIndex = Random.Range(0, 4); audioEffectPoolPath = "Prefabs/AudioEffects/Explodes/texp" + expIndex.ToString(); } GameObject audioEffectObj = ObjectsPool.PullObject(audioEffectPoolPath); AudioEffect audioEffect = audioEffectObj.GetComponent <AudioEffect> (); audioEffect.poolPath = audioEffectPoolPath; audioEffect.StartEffect(); } }
public override void SendMsg(string AudioName, AudioState State, AudioEffect effect) { GameObject obj; if (AudioSourceDictionary.ContainsKey(AudioName)) { if (AudioSourceDictionary[AudioName] == null) { obj = new GameObject(); obj.AddComponent <AudioSource>().clip = _AudioPlane.GetClipForDictionary(AudioName); AudioSourceDictionary.Add(AudioName, obj.GetComponent <AudioSource>()); } else { obj = AudioSourceDictionary[AudioName].gameObject; } } else { obj = new GameObject(); obj.AddComponent <AudioSource>().clip = _AudioPlane.GetClipForDictionary(AudioName); AudioSourceDictionary.Add(AudioName, obj.GetComponent <AudioSource>()); } _AudioState.AudioExcute(obj.GetComponent <AudioSource>(), State, effect); }
public ActionResult <Response> UpdateAudioEffect(AudioEffect audioEffect) { response = new Response(); response = audioEffectService.UpdateAudioEffect(audioEffect); return(responseFactory.CreateControllerResponse(response)); }
// Use this for initialization void Start() { pSystem = this.GetComponent <ParticleSystem> ().shape; emmision = this.GetComponent <ParticleSystem> ().emission; main = this.GetComponent <ParticleSystem> ().main; audio_effect = this.GetComponent <AudioEffect> (); audio = this.GetComponent <AudioSource> (); mat.SetColor("_EmissionColor", min_colour); }
private void Save(string fileName) { AudioEffect af = tcEffects.SelectedTab.Tag as AudioEffect; byte[] data = null; IntPtr format = IntPtr.Zero; Prepare(arw, af, ref format, ref data); Save(format, data, fileName); }
public void StopSound(AudioEffect audioEffect) { SFXInstance selectedAudio = soundEffectInstances.Find(x => x.audioEffect == audioEffect); if (selectedAudio == null) { return; } selectedAudio.audioS.Stop(); }
public Response UpdateAudioEffect(AudioEffect audioEffect) { response = responseFactory.CreateAudioEffectResponse(); response.audioEffect.id = magmaDbContext.Update <AudioEffect>(audioEffect).Entity.id; magmaDbContext.SaveChanges(); return(responseFactory.UpdateResponse(response, "Success: updated audio effect", ResponseStatus.OK)); }
// Use this for initialization void Start() { aberration_model = ppp.chromaticAberration.settings; aberration_model.intensity = 0.0f; if (audioEffect == null) { audioEffect = GameObject.Find("Audio").GetComponent <AudioEffect>(); } }
public void BossExplodeSound() { int bossType = type - 6; string audioEffectPoolPath = "Prefabs/AudioEffects/Explodes/race_" + explodeObject.raceType.ToString() + "_boss_" + bossType.ToString(); GameObject audioEffectObj = ObjectsPool.PullObject(audioEffectPoolPath); AudioEffect audioEffect = audioEffectObj.GetComponent <AudioEffect> (); audioEffect.poolPath = audioEffectPoolPath; audioEffect.StartEffect(); }
public void SendMsg(AudioUse use, string AudioName, AudioState state, AudioEffect effect = AudioEffect.Normal) { if (use == AudioUse.Repeat) { RepeateAudio.SendMsg(AudioName, state, effect); } else { SingleAudio.SendMsg(AudioName, state, effect); } }
void Awake() { if (instance) { Destroy(gameObject); } else { instance = this; GameObject.DontDestroyOnLoad(gameObject); } }
public void Play(IAudioReader wr, AudioEffect af) { //string fileName = @"c:\Wint\audio\NAudio-1-3\Source Code\MixDiff\bin\Debug\Windows XP Startup.wav";//1,16,8000.wav//G:\10\mp3\2,16,44100.wav //WaveReader wr = new WaveReader(File.OpenRead(fileName)); IntPtr format = wr.ReadFormat(); WaveFormat wf1 = AudioCompressionManager.GetWaveFormat(format); Console.WriteLine("{0},{1},{2}-{3}", wf1.nChannels, wf1.wBitsPerSample, wf1.nSamplesPerSec, wf1.wFormatTag); byte[] data = wr.ReadData(); if (wf1.wFormatTag != 1) { IntPtr formatNew = IntPtr.Zero; byte[] dataNew = null; AudioCompressionManager.ToPcm(format, data, ref formatNew, ref dataNew); format = formatNew; data = dataNew; WaveFormat wf2 = AudioCompressionManager.GetWaveFormat(format); Console.WriteLine("{0},{1},{2}-{3}", wf2.nChannels, wf2.wBitsPerSample, wf2.nSamplesPerSec, wf2.wFormatTag); } else if (wf1.wBitsPerSample != 16) { WaveFormat wf = AudioCompressionManager.GetWaveFormat(format); IntPtr formatNew = AudioCompressionManager.GetPcmFormat(wf.nChannels, 16, wf.nSamplesPerSec); byte[] dataNew = AudioCompressionManager.Convert(format, formatNew, data, false); format = formatNew; data = dataNew; WaveFormat wf2 = AudioCompressionManager.GetWaveFormat(format); Console.WriteLine("{0},{1},{2}-{3}", wf2.nChannels, wf2.wBitsPerSample, wf2.nSamplesPerSec, wf2.wFormatTag); } //wr.Close(); if (af != null) { bool hasProcessInPlace = af.HasProcessInPlace; //af.GetSupportedOutputFormats(); GCHandle src = GCHandle.Alloc(data, GCHandleType.Pinned); IntPtr formatPtr = src.AddrOfPinnedObject(); bool res = af.ProcessInPlace(format, data); src.Free(); if (!res) { MessageBox.Show("Unable to convert the audio data"); return; } } if (plex.State != DeviceState.Closed) { plex.ClosePlayer(); } Console.WriteLine(plex.State); plex.OpenPlayer(format); plex.AddData(data); plex.StartPlay(); }
public void PlaySound(AudioEffect audioEffect, float volume, bool makeInstace = false) { AudioInstance selectedAudio = soundEffectInstances.Find(x => x.audioEffect == audioEffect); if (makeInstace) { selectedAudio = new AudioInstance(); GameObject newObj = Instantiate(selectedAudio.audioS.gameObject); selectedAudio.audioS = newObj.GetComponent <AudioSource>(); } selectedAudio.audioS.spatialBlend = 0; selectedAudio.audioS.volume = volume; selectedAudio.audioS.Play(); }
private void btnPlay_Click(object sender, EventArgs e) { AudioEffect af = tcEffects.SelectedTab.Tag as AudioEffect; byte[] data = null; IntPtr format = IntPtr.Zero; Prepare(arw, af, ref format, ref data); Play(format, data); tcEffectsEnabled = false; btnPlay.Enabled = false; btnOpen.Enabled = false; btnStop.Enabled = true; }
public void Play() { switch (PlayMode) { case AudioEffectPlayMode.FireAndForget: AudioEffect.Play(); break; case AudioEffectPlayMode.Syncronious: CheckChanges(); _instance.Play(); _instance.IsLooped = Loop; break; } }
public void PlaySound(AudioEffect audioEffect, float volume, float pitch = 1f) { SFXInstance selectedAudio = soundEffectInstances.Find(x => x.audioEffect == audioEffect); if (selectedAudio == null) { return; } selectedAudio.audioS.spatialBlend = 0; selectedAudio.audioS.clip = selectedAudio.getClip; selectedAudio.audioS.volume = volume * Settings.SFX; selectedAudio.audioS.pitch = pitch; selectedAudio.audioS.Play(); }
/// <summary> /// Plays the audio effect linked to the AudioEffectType. Can also adjust the pitch and volume. /// </summary> /// <param name="_audioType"></param> /// <param name="_pitch"></param> /// <param name="_volume"></param> public void PlayEffect(AudioEffectType _audioType, float _pitch = 1f, float _volume = 1) { for (int i = 0; i < audioEffects.Count; i++) { if (audioEffects[i].Effect == _audioType) { if (audioEffects[i].Clip != null) { AudioEffect _effect = audioEffects[i]; PlayClipAtPoint(_effect.Clip, _pitch, _effect.Volume); } break; } } }
public void Play3DSound(AudioEffect audioEffect, float volume, Vector3 position, float pitch = 1) { SFXInstance selectedAudio = soundEffectInstances.Find(x => x.audioEffect == audioEffect); if (selectedAudio == null) { return; } selectedAudio.audioS.pitch = pitch; selectedAudio.audioS.spatialBlend = 1; selectedAudio.audioS.gameObject.transform.position = position; selectedAudio.audioS.volume = volume * Settings.SFX; selectedAudio.audioS.Play(); }
public Master(int bufsize) { name = "Master"; mute = false; level = 1; preE = true; preS = true; Plugins = new AudioEffect[10]; plugine = new bool[10]; Stereo = new float[2][]; peaklvl = new float[2]; for (int i = 0; i < 2; i++) { Stereo[i] = new float[bufsize]; } }
public void Play3DSound(AudioEffect audioEffect, float volume, Vector3 position, bool makeInstace = false, float pitch = 1) { AudioInstance selectedAudio = soundEffectInstances.Find(x => x.audioEffect == audioEffect); if (makeInstace) { selectedAudio = new AudioInstance(); GameObject newObj = Instantiate(selectedAudio.audioS.gameObject); selectedAudio.audioS = newObj.GetComponent <AudioSource>(); } selectedAudio.audioS.pitch = pitch; selectedAudio.audioS.spatialBlend = 1; selectedAudio.audioS.gameObject.transform.position = position; selectedAudio.audioS.volume = volume * Settings.SFX; selectedAudio.audioS.Play(); }
public override async void Initialize(IResolver resolver) { this.playerVm = new PlayerViewModel(); this.InitWorld(); this.InitUi(); this.musicManager = resolver.Resolve <IMusicManager>(); this.musicManager.LoadSongs("Audio/LOOP_1", "Audio/LOOP_2", "Audio/LOOP_3", "Audio/LOOP_4", "Audio/LOOP_5"); if (this.musicManager is Component musicComp) { this.WorldRoot.Components.Add(musicComp); } base.Initialize(resolver); this.IsPaused = true; this.playerVm.Dies += async(s, e) => { await this.WaitForUpdate(); foreach (var npc in this.WorldRoot.Children.OfType <Npc>()) { npc.PlayerDied(); } this.musicManager.EndSongs(); var shutdown = new AudioEffect("Audio/windows_shutdown") { Volume = .75f }; this.UiRoot.Components.Add(shutdown); shutdown.Stopped += (_s, _e) => this.UiRoot.Components.Remove(shutdown); shutdown.Play(); await this.player.PlayDeathAnimation(); this.UiRoot.Insert(0, new DeathScreen()); }; await Task.Delay(1500); await this.WaitForUpdate(); this.IsPaused = false; }
public void Prepare(IAudioReader wr, AudioEffect af, ref IntPtr format, ref byte[] data) { format = wr.ReadFormat(); WaveFormat wf1 = AudioCompressionManager.GetWaveFormat(format); Console.WriteLine("{0},{1},{2}-{3}", wf1.nChannels, wf1.wBitsPerSample, wf1.nSamplesPerSec, wf1.wFormatTag); data = wr.ReadData(); if (wf1.wFormatTag != 1) { IntPtr formatNew = IntPtr.Zero; byte[] dataNew = null; AudioCompressionManager.ToPcm(format, data, ref formatNew, ref dataNew); format = formatNew; data = dataNew; WaveFormat wf2 = AudioCompressionManager.GetWaveFormat(format); Console.WriteLine("{0},{1},{2}-{3}", wf2.nChannels, wf2.wBitsPerSample, wf2.nSamplesPerSec, wf2.wFormatTag); } else if (wf1.wBitsPerSample != 16) { WaveFormat wf = AudioCompressionManager.GetWaveFormat(format); IntPtr formatNew = AudioCompressionManager.GetPcmFormat(wf.nChannels, 16, wf.nSamplesPerSec); byte[] dataNew = AudioCompressionManager.Convert(format, formatNew, data, false); format = formatNew; data = dataNew; WaveFormat wf2 = AudioCompressionManager.GetWaveFormat(format); Console.WriteLine("{0},{1},{2}-{3}", wf2.nChannels, wf2.wBitsPerSample, wf2.nSamplesPerSec, wf2.wFormatTag); } //wr.Close(); if (af != null) { bool hasProcessInPlace = af.HasProcessInPlace; //af.GetSupportedOutputFormats(); GCHandle src = GCHandle.Alloc(data, GCHandleType.Pinned); IntPtr formatPtr = src.AddrOfPinnedObject(); bool res = af.ProcessInPlace(format, data); src.Free(); if (!res) { MessageBox.Show("Unable to convert the audio data"); return; } } }
private void CheckPowerups() { var powerups = this.WorldRoot.Children.OfType <ShoePowerup>().ToArray(); foreach (var powerup in powerups) { var pos = powerup.GlobalPosition.ToPoint(); if (this.player.GlobalRegion.Contains(pos.X, pos.Y)) { var audio = new AudioEffect("Audio/newShoes"); this.player.Components.Add(audio); audio.Play(); audio.Stopped += (s, e) => this.player.Components.Remove(audio); this.player.EquipShoe(powerup.Powerup); powerup.Dismiss(); break; } } }
public Channel(int bufsize, string name) { Sends = new Tuple <Bus, float> [10]; Plugins = new AudioEffect[10]; plugine = new bool[10]; peaklvl = new float[2]; Stereo = new float[2][]; Stereo2 = new float[2][]; for (int i = 0; i < 2; i++) { Stereo[i] = new float[bufsize]; Stereo2[i] = new float[bufsize]; } this.name = name; level = 1; mute = false; preE = true; preS = true; Pan = 0; }
private void Attack() { if (!this.IsCloseEnoughToHit()) { return; } if (this.viewModel.IsInvulnerable) { return; } this.viewModel.DamagePlayer(15f); var rnd = new Random(); var hit = new AudioEffect(rnd.Next(2) == 0 ? "Audio/hit" : "Audio/hit2"); this.Components.Add(hit); hit.Play(); hit.Stopped += (s, e) => this.Components.Remove(hit); }
private void Init() { sfdAudio.Filter = "*.wav|*.wav"; sfdAudio.DefaultExt = "wav"; ofdAudio.Filter = "*.wav|*.wav|*.mp3|*.mp3|*.avi|*.avi|*.wma;*.wmv;*.asf;*.mpg;*.aif;*.au;*.snd;*.mid;*.rmi;*.ogg;*.flac;*.cda;*.ac3;*.dts;*.mka;*.mkv;*.mpc;*.m4a;*.aac;*.mpa;*.mp2;*.m1a;*.m2a|*.wma;*.wmv;*.asf;*.mpg;*.aif;*.au;*.snd;*.mid;*.rmi;*.ogg;*.flac;*.cda;*.ac3;*.dts;*.mka;*.mkv;*.mpc;*.m4a;*.aac;*.mpa;*.mp2;*.m1a;*.m2a|*.*|*.*"; btnPlay.Enabled = false; btnStop.Enabled = false; btnSave.Enabled = false; ChorusAudioEffect aeChorus = AudioEffect.CreateChorusAudioEffect(); NewTab(aeChorus, "Chorus"); CompressorAudioEffect aeCompressor = AudioEffect.CreateCompressorAudioEffect(); NewTab(aeCompressor, "Compressor"); DistortionAudioEffect aeDistortion = AudioEffect.CreateDistortionAudioEffect(); NewTab(aeDistortion, "Distortion"); EchoAudioEffect aeEcho = AudioEffect.CreateEchoAudioEffect(); NewTab(aeEcho, "Echo"); FlangerAudioEffect aeFlanger = AudioEffect.CreateFlangerAudioEffect(); NewTab(aeFlanger, "Flanger"); GargleAudioEffect aeGargle = AudioEffect.CreateGargleAudioEffect(); NewTab(aeGargle, "Gargle"); I3DL2ReverbAudioEffect aeI3DL2Reverb = AudioEffect.CreateI3DL2ReverbAudioEffect(); NewTab(aeI3DL2Reverb, "I3DL2Reverb"); ParamEqAudioEffect aeParamEq = AudioEffect.CreateParamEqAudioEffect(); NewTab(aeParamEq, "ParamEq"); WavesReverbAudioEffect aeWavesReverb = AudioEffect.CreateWavesReverbAudioEffect(); NewTab(aeWavesReverb, "WavesReverb"); }
public Response UpdateAudioEffect(AudioEffect audioEffect) { if (audioEffect == null) { return(responseFactory.CreateResponse("Error: input parameter is null", ResponseStatus.BADREQUEST)); } if (audioEffect.id == 0) { return(responseFactory.CreateResponse("Error: audio effect id is null", ResponseStatus.BADREQUEST)); } response = new Response(); try { response = audioEffectDao.UpdateAudioEffect(audioEffect); } catch (Exception exception) { return(responseFactory.CreateResponse(exception.Message, ResponseStatus.EXCEPTION)); } return(response); }