private void AddSound() { // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension and default file extension dlg.DefaultExt = ".mp3"; dlg.Filter = "Audio Files|*.mp3;*.wav;*.wmp";; // Display OpenFileDialog by calling ShowDialog method Nullable <bool> result = dlg.ShowDialog(); // Get the selected file name if (result == true) { // Copy sound file to AppData Sounds folder File.Copy(dlg.FileName, appdata + dlg.SafeFileName, true); // Add new sound file to sound preferences list soundPreferences.Sounds.Add(dlg.SafeFileName); soundPreferences.Save(); SoundsList.Add(dlg.SafeFileName); messanger.Success("Added", false); } }
private void DeleteSound() { // Check that sound is not in use if (SelectedSound == soundPreferences.Success) { messanger.Error("Cannot delete sound file as it is used for Success sound", true); } else if (SelectedSound == soundPreferences.Neutral) { messanger.Error("Cannot delete sound file as it is used for Neutral sound", true); } else if (SelectedSound == soundPreferences.Error) { messanger.Error("Cannot delete sound file as it is used for Error sound", true); } else if (SelectedSound == soundPreferences.Delete) { messanger.Error("Cannot delete sound file as it is used for Delete sound", true); } else { // Delete sound soundPreferences.Sounds.Remove(SelectedSound); soundPreferences.Save(); if (File.Exists(appdata + SelectedSound)) { File.Delete(appdata + SelectedSound); } SoundsList.Remove(SelectedSound); SelectedSound = SoundsList.Count > 0 ? SoundsList[0] : string.Empty; messanger.Delete("Deleted", false); } }
public void Prepare(bool generateDefaultLight = true, bool generateDefaultCamera = true) { meshes = MeshesList.ToArray(); sounds = SoundsList.ToArray(); materials = MaterialsList.ToArray(); multiMaterials = MultiMaterialsList.ToArray(); shadowGenerators = ShadowGeneratorsList.ToArray(); skeletons = SkeletonsList.ToArray(); if (MorphTargetManagersList.Count > 0) { morphTargetManagers = MorphTargetManagersList.ToArray(); } if (CamerasList.Count == 0 && generateDefaultCamera) { var camera = new BabylonCamera { name = "Default camera", id = Guid.NewGuid().ToString() }; // Default camera init gives infinit values // Indeed, float.MaxValue - float.MinValue always leads to infinity var distanceVector = MaxVector - MinVector; var midPoint = MinVector + distanceVector / 2; camera.target = midPoint.ToArray(); camera.position = (midPoint + distanceVector).ToArray(); var distance = distanceVector.Length(); camera.speed = distance / 50.0f; camera.maxZ = distance * 4f; camera.minZ = distance < 100.0f ? 0.1f : 1.0f; CamerasList.Add(camera); } if (LightsList.Count == 0 && generateDefaultLight) { var light = new BabylonLight { name = "Default light", id = Guid.NewGuid().ToString(), type = 3, groundColor = new float[] { 0, 0, 0 }, direction = new[] { 0, 1.0f, 0 }, intensity = 1 }; LightsList.Add(light); } cameras = (CamerasList.Count > 0) ? CamerasList.ToArray() : null; lights = (LightsList.Count > 0) ? LightsList.ToArray() : null; if (activeCameraID == null && CamerasList.Count > 0) { activeCameraID = CamerasList[0].id; } }
private void LoadData() { foreach (var item in soundPreferences.Sounds) { SoundsList.Add(item); } SelectedSoundTypeChanged(); }
public void SesOynat(string sesAdi) //bu metot ile ismine göre seslerimizi istediğimiz yerde oynatacağız. { SoundsList s = Array.Find(sesler, ses => ses.sesAdi == sesAdi); if (s == null) { Debug.LogWarning(sesAdi + " adli ses dosyasi bulunamadi."); return; } s.source.Play(); }
public MainWindowVM() { ImagedList.Add(new VmHierarchicalMenuItem("Images", PackIconKind.Image)); SoundsList.Add(new VmHierarchicalMenuItem("Sounds", PackIconKind.Music)); var item = new VmHierarchicalMenuItem("Documents", PackIconKind.Folder); item.SubItems = new List <VmHierarchicalMenuItem>(); item.SubItems.Add(new VmHierarchicalMenuItem("Sounds", PackIconKind.Music)); DocumentsList.Add(item); }
public void PlaySound(string _soundName) { SoundsList s = Array.Find(sounds, sound => sound.soundName == _soundName); if (s == null) { Debug.LogWarning(_soundName + " not found."); return; } s.source.Play(); }
/// <summary> /// The load sound scenery. /// </summary> /// <param name="SoundsList">The sounds list.</param> /// <remarks></remarks> public void LoadSoundScenery(ref List <SceneryInfo> SoundsList) { if (SoundsList == null) { SoundsList = new List <SceneryInfo>(); } else { SoundsList.Clear(); } map.OpenMap(MapTypes.Internal); // Lists all Scenery & Obstacles for (int i = 0; i < map.MapHeader.fileCount; i++) { if (map.MetaInfo.TagType[i] == "scnr") { Meta m = new Meta(map); // Base address of SCNR tag, offset of Sound Scenery Palette pointer (+224) map.BR.BaseStream.Position = map.MetaInfo.Offset[i] + 224; int chunkCount = map.BR.ReadInt32(); int chunkOffset = map.BR.ReadInt32() - map.SecondaryMagic; // Scenery Palette Objects for (int a = 0; a < chunkCount; a++) { SceneryInfo Sound = new SceneryInfo(); // The Palette Chunk # Sound.ScenPalNumber = a; // Each chunk is 40 bytes apart map.BR.BaseStream.Position = chunkOffset + a * 40; char[] tagName = map.BR.ReadChars(4); Sound.ScenTagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); if (Sound.ScenTagNumber != -1) { string[] s = map.FileNames.Name[Sound.ScenTagNumber].Split('\\'); Sound.Name = s[s.Length - 1]; Sound.TagPath = map.FileNames.Name[Sound.ScenTagNumber]; Sound.TagType = map.MetaInfo.TagType[Sound.ScenTagNumber]; SoundsList.Add(Sound); } } break; } } map.CloseMap(); }
public void Play(SoundsList sName) { print("PLAY : " + sName.ToString()); try { var s = Array.Find(sounds, sound => sound.name == sName); s.source.Play(); } catch { Debug.LogError("Sound " + sName.ToString() + " not Found"); } }
public BeatsDrawer(Pattern pattern, IGridCoordinatesProvider grid) { this.pattern = pattern; this.grid = grid; this.patternPaint = new SKPaint { Color = SKColors.White, IsAntialias = true, Style = SKPaintStyle.StrokeAndFill }; this.patternSounds = pattern.Sounds; foreach (var beat in pattern.AllBeats()) { var coord = grid.Coordinates(beat.Sound.Instrument, beat.T); patternBeats.Add(new PointAndMark(coord, beat.Sound.Mark)); } }
private static BeatData ToData(PatternBeat beat, SoundsList patternSounds) { return(new BeatData { Time = beat.T.Index, Sound = patternSounds.IndexOf(beat.Sound), Velocity = beat.Velocity.Value }); }
private static SoundData ToData(ISoundId sound, SoundsList sounds) { return(new SoundData { Technique = sound.Technique, Instrument = sound.Instrument.Name, Id = sounds.IndexOf(sound), Mark = sound.Mark }); }
public StepsSoundPlayer(AudioSource audioSource, SoundsList soundsList) { _audioSource = audioSource; _soundsList = soundsList; }
private Pattern(PatternInfo info, PatternBeat[] beats, SoundsList sounds) { this.Info = info; this.Sounds = sounds; this.beats = beats; }