// 2. Stop public static AudioElement StopElement(string name, StopSettings stopSettings) { AudioElement e = GetElement(name); e.Stop(stopSettings); return(e); }
// 5. Panning public static AudioElement SetPan(string name, float pan) { AudioElement e = GetElement(name); e.SetPan(pan); return(e); }
protected override async Task OnInitializedAsync() { _audio = new AudioElement("playerAudio", JsRuntime); Data.CurrentTrackChanged += CurrentTrackChanged; AudioElement.OnEnded += OnEnded; await base.OnInitializedAsync(); }
void Start() { if (clickVolume < 0.0f) { clickVolume = 0.0f; } if (clickVolume > 1.0f) { clickVolume = 1.0f; } List <AudioClip> sounds = new List <AudioClip> (); List <float> volumes = new List <float> (); sounds.Add(clickSound); volumes.Add(clickVolume); audioElement = new AudioElement(sounds, volumes, "SelectPlayerMenu", null); avatars = ResourceManager.GetAvatars(); if (avatars.Length > 0) { avatarIndex = 0; } SelectionList.LoadEntries(PlayerManager.GetPlayerNames()); /* PlayerManager.Load (); * PlayerManager.SetAvatarTextures (avatars); * if (avatars.Length > 0) * avatarIndex = 0; * SelectionList.LoadEntries (PlayerManager.GetPlayerNames ());*/ }
public void StartConfirmation(AudioClip clickSound, AudioElement audioElement) { this.clickSound = clickSound; this.audioElement = audioElement; confirming = true; clickYes = false; clickNo = false; }
// 4. Volume public static AudioElement SetElementVolume(string name, float volume) { AudioElement e = GetElement(name); e.SetVolume(volume); return(e); }
public static AudioElement SetElementVolume(string name, FadeSettings fadeSettings) { AudioElement e = GetElement(name); e.SetVolume(fadeSettings); return(e); }
// Use this for initialization void Start() { ObjectList.Start(); if (clickVolume < 0.0f) { clickVolume = 0.0f; } if (clickVolume > 1.0f) { clickVolume = 1.0f; } List <AudioClip> sounds = new List <AudioClip>(); List <float> volumes = new List <float>(); sounds.Add(clickSound); volumes.Add(clickVolume); audioElement = new AudioElement(sounds, volumes, "NewGame", null); comboBoxList = new GUIContent[ObjectList.racesList.Count]; for (int i = 0; i < ObjectList.racesList.Count; i++) { comboBoxList[i] = new GUIContent(ObjectList.racesList[i].nameSpec); } listStyle.normal.textColor = Color.white; listStyle.onHover.background = listStyle.hover.background = new Texture2D(2, 2); playerInstance = new GameObject(); playerInstance.AddComponent <EmpireController>(); }
async void stopAudioElement() { await _cw.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { AudioElement.Stop(); }); }
public static AudioElement SetPan(string name, float fromPan, float toPan, float fadeLength, FadeType fadeType, float power) { AudioElement e = GetElement(name); e.pan.Fade(fadeLength, fromPan, toPan, fadeType, power); return(e); }
// 1. Play public static AudioElement PlayElement(string name, PlaySettings playSettings) { AudioElement e = GetElement(name); e.Play(playSettings); return(e); }
public static AudioElement SetPan(string name, FadeSettings FadeSettings) { AudioElement e = GetElement(name); e.SetPan(FadeSettings); return(e); }
public AudioSource playSound(string name, float volume = -1, float pitch = -1, bool loop = false) { if (_elementByName.ContainsKey(name) == false) { Debug.LogError("Unable to locate sound " + name); return(null); } AudioElement element = _elementByName[name]; AudioSource source = getSource(); if (volume < 0) { volume = element.defaultVolume; } if (pitch < 0) { pitch = element.defaultPitch; } source.clip = element.clip; source.volume = volume; source.pitch = pitch; source.loop = loop; source.name = "Audio Source - " + name; source.Play(); return(source); }
void Start () { List< AudioClip > sounds = new List< AudioClip >(); List< float > volumes = new List< float >(); sounds.Add(clickSound); volumes.Add (clickVolume); audioElement = new AudioElement(sounds, volumes, "ResultsScreen", null); }
private void Shoot() { if (subTargetName != "") { AudioElement element = targetSpace.GetElementByName(targetName); int sequenceId = element.GetIDByKey(subTargetName); element.sequence.SetTo(sequenceId); } switch (type) { case AudioActionType.Stop: targetSpace.Stop(targetName); break; case AudioActionType.Reset: targetSpace.GetElementByName(targetName).sequence.Reset(); break; case AudioActionType.SetTo: targetSpace.GetElementByName(targetName).sequence.SetTo(intValue); break; case AudioActionType.SelfDestruct: break; case AudioActionType.Play: default: targetSpace.Play(targetName); break; } Die(); }
// 3. Parameter public static AudioElement SetParameterInElement <T> (string name, SetParameterSettings <T> parameterSettings) { AudioElement e = GetElement(name); //e.SetParameter<T>(parameterSettings); return(e); }
public override void Dispose() { base.Dispose(); _backgroundImage = null; _music.Pause(); _music = null; Current = null; }
void Start() { List <AudioClip> sounds = new List <AudioClip>(); List <float> volumes = new List <float>(); sounds.Add(clickSound); volumes.Add(clickVolume); audioElement = new AudioElement(sounds, volumes, "ResultsScreen", null); }
// Use this for initialization void Start() { player = transform.root.GetComponent <Player> (); ResourceManager.StoreSelectBoxItems(selectBoxSkin, healthy, damaged, critical); SetCursorState(CursorState.Select); resourceValues = new Dictionary <ResourceType, int> (); resourceLimits = new Dictionary <ResourceType, int> (); resourceImages = new Dictionary <ResourceType, Texture2D> (); buildAreaHeight = Screen.height - RESOURCE_BAR_HEIGHT - SELECTION_NAME_HEIGHT - 2 * BUTTON_SPACING; for (int i = 0; i < resources.Length; i++) { switch (resources [i].name) { case "Money": resourceImages.Add(ResourceType.Money, resources [i]); resourceValues.Add(ResourceType.Money, 0); resourceLimits.Add(ResourceType.Money, 0); break; case "Power": resourceImages.Add(ResourceType.Power, resources [i]); resourceValues.Add(ResourceType.Power, 0); resourceLimits.Add(ResourceType.Power, 0); break; default: break; } } Dictionary <ResourceType, Texture2D> resourceHealthBarTextures = new Dictionary <ResourceType, Texture2D> (); for (int i = 0; i < resourceHealthBars.Length; i++) { switch (resourceHealthBars [i].name) { case "ore": resourceHealthBarTextures.Add(ResourceType.Ore, resourceHealthBars [i]); break; default: break; } } ResourceManager.SetResourceHealthBarTextures(resourceHealthBarTextures); List <AudioClip> sounds = new List <AudioClip> (); List <float> volumes = new List <float> (); sounds.Add(clickSound); volumes.Add(clickVolume); audioElement = new AudioElement(sounds, volumes, "HUD", null); }
public override void Dispose() { base.Dispose(); _backgroundImage = null; _timeLeftFrame = null; _meterImage = null; _markerImage = null; _music.Pause(); _music = null; }
public AudioElement LoadAudio(string url) { AudioElement audio = (AudioElement)Document.CreateElement("AUDIO"); _resourcesToLoad++; _resourcesToLoadLabel.InnerHTML = _resourcesToLoad.ToString(); audio.AddEventListener("canplaythrough", ResourceLoaded, false); audio.Src = url; return(audio); }
protected virtual void Start () { SetButtons(); if(clickVolume < 0.0f) clickVolume = 0.0f; if(clickVolume > 1.0f) clickVolume = 1.0f; List<AudioClip> sounds = new List<AudioClip>(); List<float> volumes = new List<float>(); sounds.Add(clickSound); volumes.Add (clickVolume); audioElement = new AudioElement(sounds, volumes, "Menu", null); }
void Start() { Activate(); if(clickVolume < 0.0f) clickVolume = 0.0f; if(clickVolume > 1.0f) clickVolume = 1.0f; List<AudioClip> sounds = new List<AudioClip>(); List<float> volumes = new List<float>(); sounds.Add(clickSound); volumes.Add (clickVolume); audioElement = new AudioElement(sounds, volumes, "LoadMenu", null); }
protected override void Init() { if (jQuery.Browser.Mozilla || jQuery.Browser.Opera) { _music = LoadAudio("Audio/race.ogg"); } else { _music = LoadAudio("Audio/race.mp3"); } TimeLeft = RoadLength / 35; Position = 0; Shift = 0; pendingTimers = new List <int>(); AddSystem(new RoadSystem()); AddSystem(new CloudSystem()); AddSystem(new ObstacleSystem()); AddSystem(_npcSystem = new NpcSystem()); AddSystem(CarSystem = new CarSystem()); AddSystem(_engineSoundSystem = new EngineSoundSystem()); // Get reference to game images _backgroundImage = LoadImage("Images/Race/bg.png", false); _timeLeftFrame = LoadImage("Images/Race/TimeLeft.png", false); _meterImage = LoadImage("Images/Race/rpm10.png", false); _markerImage = LoadImage("Images/Race/marker.png", false); // Setup the track Curve = 0; _rpm = 200; Status = RaceStatus.Starting; // Calculate the distance table for track rendering DistanceTable = new float[Lines]; for (int i = 0; i < Lines + 1; i++) { DistanceTable[i] = 1000000 / (300 - i); } ShowMessage(_startMessage); Window.SetTimeout(delegate() { HideMessage(); Status = RaceStatus.Running; _music.Play(); _music.AddEventListener("ended", delegate(ElementEvent e) { _music.Play(); }, false); }, 3000); }
public override void Process(out UiElement ui, XmlNode t, Builder b) { var uui = new AudioElement { Type = t.GetAttributeByName("type"), Source = t.GetAttributeByName("src"), AutoPlay = t.HasAttribute("autoplay") }; ui = uui; }
public override void CleanUp() { base.CleanUp(); if (audio != null) { audio.Pause(); audio.Src = null; audio = null; } }
async void SetAudioSource() { var AudioFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("folk_rock.mp3"); var AudioStream = await AudioFile.OpenAsync(Windows.Storage.FileAccessMode.Read); await _cw.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { AudioElement.SetSource(AudioStream, AudioFile.ContentType); }); }
public virtual AudioElement GetElementByName(string key) { AudioElement result = null; if (elements.ContainsKey(key)) { result = elements[key]; } return(result); }
public AudioElement GetAudio() { if (clips == null) { return(AudioElement.NULL); } else if (clips.Length <= 0) { return(AudioElement.NULL); } return(AudioElement.GetRandom(clips)); }
public override void Dispose() { if (_engine != null) { _engine.Pause(); _engine.RemoveEventListener("timeupdate", _timeUpdatedListener, false); } _playThroughListener = null; _timeUpdatedListener = null; _level = null; _engine = null; }
// Use this for initialization void Start () { avatars = ResourceManager.GetAvatars(); if(avatars.Length > 0) avatarIndex = 0; SelectionList.LoadEntries(PlayerManager.GetPlayerNames()); if(clickVolume < 0.0f) clickVolume = 0.0f; if(clickVolume > 1.0f) clickVolume = 1.0f; List<AudioClip> sounds = new List<AudioClip>(); List<float> volumes = new List<float>(); sounds.Add(clickSound); volumes.Add (clickVolume); audioElement = new AudioElement(sounds, volumes, "SelectPlayerMenu", null); }
public Category AddElement(AudioElement e) { if (e.transform.parent == null || !e.transform.parent.GetComponent<Category>()) { if (!categories.GetChild ("Default")) { categories.AddChild (new GameObject ("Default", typeof (Category)).GetComponent<Category>()); } elements.AddChild (e, categories.GetChild ("Default").transform); return categories.GetChild ("Default"); } else { elements.AddChild (e, e.transform.parent); return e.transform.parent.GetComponent<Category>(); } }
public bool Play(AudioElement a, bool setAudio = true) { if (!isComplete) { return(false); } if (setAudio) { SetAudio(a); } audioSource.PlayOneShot(a); return(true); }
public override void Init(Scene level) { _level = (RaceLevel)level; _playThroughListener = SoundLoaded; _timeUpdatedListener = TimeUpdated; if (jQuery.Browser.Mozilla || jQuery.Browser.Opera) { _engine = _level.LoadAudio("Audio/Race/engine.ogg"); } else { _engine = _level.LoadAudio("Audio/Race/engine.mp3"); } _engine.AddEventListener("canplaythrough", _playThroughListener, false); }
public static void Main() { UpdateButtons(); Global.SetInterval(ShowCoinsInterval, 1000); for (int n = 0; n < 7; n++) { audio[n] = new AudioElement("Sounds/" + noteNamesLetter[n] + ".mp3"); } staveImg.Src = "stave.png"; noteImg.Src = "note.png"; lineImg.Src = "line.png"; noteName = "do"; numRight--; ChooseNote("do", 0, false, false); }
protected virtual void InitialiseAudio() { List<AudioClip> sounds = new List<AudioClip>(); List<float> volumes = new List<float>(); if(attackVolume < 0.0f) attackVolume = 0.0f; if(attackVolume > 1.0f) attackVolume = 1.0f; sounds.Add(attackSound); volumes.Add(attackVolume); if(selectVolume < 0.0f) selectVolume = 0.0f; if(selectVolume > 1.0f) selectVolume = 1.0f; sounds.Add(selectSound); volumes.Add(selectVolume); if(useWeaponVolume < 0.0f) useWeaponVolume = 0.0f; if(useWeaponVolume > 1.0f) useWeaponVolume = 1.0f; sounds.Add(useWeaponSound); volumes.Add(useWeaponVolume); audioElement = new AudioElement(sounds, volumes, objectName + ObjectId, this.transform); }
/*** Game Engine Methods ***/ void Start () { player = transform.root.GetComponent<Player>(); resourceValues = new Dictionary<ResourceType, int>(); resourceLimits = new Dictionary<ResourceType, int>(); resourceImages = new Dictionary<ResourceType, Texture2D>(); for(int i=0; i<resources.Length; i++) { switch(resources[i].name) { case "Money": resourceImages.Add(ResourceType.Money, resources[i]); resourceValues.Add(ResourceType.Money, 0); resourceLimits.Add(ResourceType.Money, 0); break; case "Power": resourceImages.Add(ResourceType.Power, resources[i]); resourceValues.Add(ResourceType.Power, 0); resourceLimits.Add(ResourceType.Power, 0); break; default: break; } } Dictionary<ResourceType, Texture2D> resourceHealthBarTextures = new Dictionary<ResourceType, Texture2D>(); for(int i=0; i<resourceHealthBars.Length; i++) { switch(resourceHealthBars[i].name) { case "ore": resourceHealthBarTextures.Add(ResourceType.Ore, resourceHealthBars[i]); break; default: break; } } ResourceManager.SetResourceHealthBarTextures(resourceHealthBarTextures); buildAreaHeight = Screen.height - RESOURCE_BAR_HEIGHT - SELECTION_NAME_HEIGHT - 2 * BUTTON_SPACING; ResourceManager.StoreSelectBoxItems(selectBoxSkin, healthy, damaged, critical); SetCursorState(CursorState.Select); List<AudioClip> sounds = new List<AudioClip>(); List<float> volumes = new List<float>(); sounds.Add(clickSound); volumes.Add (clickVolume); audioElement = new AudioElement(sounds, volumes, "HUD", null); }
public void Init(AudioElement _element, bool randomVolume) { element = _element; sources[0] = CreateAudioSource (); this.randomVolume = randomVolume; }
/*** ------------------------------------------------------ ***/ /*** Audio methods ***/ /*** ------------------------------------------------------ ***/ // Initialise the audio settings by creating the audio element containing the audio objects (containing the audio clip). protected virtual void InitialiseAudio() { List< AudioClip > sounds = new List< AudioClip >(); List< float > volumes = new List< float >(); // TODO refactor those 3 calls (need to check how to use pointers inside safe context) if (attackVolume < 0.0f) attackVolume = 0.0f; if (attackVolume > 1.0f) attackVolume = 1.0f; sounds.Add(attackSound); volumes.Add(attackVolume); if (selectVolume < 0.0f) selectVolume = 0.0f; if (selectVolume > 1.0f) selectVolume = 1.0f; sounds.Add(selectSound); volumes.Add(selectVolume); if (useWeaponVolume < 0.0f) useWeaponVolume = 0.0f; if (useWeaponVolume > 1.0f) useWeaponVolume = 1.0f; sounds.Add(useWeaponSound); volumes.Add(useWeaponVolume); audioElement = new AudioElement(sounds, volumes, objectName, this.transform); }
// Initialise the audio settings by creating the audio element containing the audio objects (containing the audio clip). protected virtual void InitialiseAudio() { List< AudioClip > sounds = new List< AudioClip >(); List< float > volumes = new List< float >(); // TODO refactor those 3 calls (need to check how to use pointers inside safe context) if (clickVolume < 0.0f) clickVolume = 0.0f; if (clickVolume > 1.0f) clickVolume = 1.0f; sounds.Add(clickSound); volumes.Add(clickVolume); audioElement = new AudioElement(sounds, volumes, "Menu", this.transform); }
/*** Private Worker Methods ***/ private void InitialiseAudio() { Debug.Log ("Initialising HUD audio source..."); Debug.Log ("Adding sound clips..."); List<AudioClip> sounds = new List<AudioClip>(); sounds.Add(clickSound); Debug.Log ("Setting volumes..."); List<float> volumes = new List<float>(); volumes.Add (clickVolume); Debug.Log ("creating gameObject..."); audioElement = new AudioElement(sounds, volumes, "HUD", null); }
private void createRecordingFile(Section s) { deleteRecordingElements (s); foreach( var i in audioList){ var recFile = new AudioElement ("Voice File"); recFile.url = i; recFile.Tapped += () => { var actionSheet = new UIActionSheet ("Audio Options"); actionSheet.AddButton ("Play"); actionSheet.AddButton ("Delete"); actionSheet.AddButton ("Cancel"); actionSheet.Clicked += (object sender, UIButtonEventArgs e) => { switch (e.ButtonIndex) { case 0: //Console.Out.WriteLine ("Play"); //Console.Out.WriteLine (recFile.url); playRecordVoice (recFile.url); break; case 1: //Console.Out.WriteLine ("Delete"); deleteRecordingFile(s,recFile.url); break; case 2: //Console.Out.WriteLine ("Cancel"); break; } }; actionSheet.ShowInView (View); }; s.Add(recFile); } this.Root.Reload (s, UITableViewRowAnimation.None); //zipAllFiles (); }