public void RestoreStageCreationOrder() { if (MessageBox.Show(Strings.WARNING_RESTORE_DATA, Strings.CAPTION_WARNING, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { Dictionary <string, int> dictOriginal = new Dictionary <string, int>(); List <SoundEntry> list = new List <SoundEntry>(); List <SoundEntry> listOriginal = new List <SoundEntry>(); IEnumerator enumeratorOriginal = _CurrentListOriginal.GetEnumerator(); while (enumeratorOriginal.MoveNext()) { SoundEntry sEntry = (SoundEntry)enumeratorOriginal.Current; dictOriginal.Add(sEntry.SoundID.ToString(), sEntry.StageCreationOrder); listOriginal.Add(sEntry); } IEnumerator enumerator = _CurrentList.GetEnumerator(); while (enumerator.MoveNext()) { SoundEntry sEntry = (SoundEntry)enumerator.Current; sEntry.StageCreationOrder = dictOriginal[sEntry.SoundID.ToString()]; list.Add(sEntry); } LoadStageCreationOrder(list, listOriginal); } }
private static void WriteSound(BBData data, SoundInfo si, StringsChunkBuilder strings, string[] audioGroups) { var se = new SoundEntry { NameOffset = si.Name == null ? 0 : strings.GetOffset(si.Name), TypeOffset = si.Type == null ? 0 : strings.GetOffset(si.Type), FileOffset = si.File == null ? 0 : strings.GetOffset(si.File), Volume = si.VolumeMod, Pitch = si.PitchMod, GroupID = (si.Group == null || si.Group.Length == 0) ? 0 : Array.IndexOf(audioGroups, si.Group), AudioID = si.AudioID, Flags = SoundEntryFlags.Normal }; if (si.IsEmbedded) { se.Flags |= SoundEntryFlags.Embedded; } if (si.IsCompressed) { se.Flags |= SoundEntryFlags.Compressed; } data.Buffer.Write(se); }
public SoundEntryController(EntryChunkController entrychunkcontroller, SoundEntry soundentry) : base(entrychunkcontroller, soundentry) { this.soundentry = soundentry; Node.Text = string.Format("Sound Entry ({0})", soundentry.EIDString); Node.ImageKey = "soundentry"; Node.SelectedImageKey = "soundentry"; }
private void listEntries_ItemAdded(object sender, EventArgs e) { SoundEntry sEntry = SoundEntryCollection.CreateSoundEntry(); listEntries.RefreshList(); listEntries.SelectItem(sEntry); }
public static SoundEffectInstance PlayMusic(SoundEntry sound) { SoundEffectInstance instance = soundEffects[(int)sound].CreateInstance(); instance.IsLooped = (sound == SoundEntry.MusicGame); instance.Play(); return(instance); }
private void listEntries_ItemSelected(object sender, EventHandlers.ListEntryArgs e) { SoundEntry sEntry = e.ListEntry as SoundEntry; if (sEntry != null) { PopulateInfo(sEntry); } }
internal void RemoveSoundEntry() { SoundEntry entry = (SoundEntry)SelectedListItem.Tag; SoundEntries.Remove(entry); ListItems.Remove(SelectedListItem); SelectedListItem = null; }
private void listEntries_ItemRemoved(object sender, EventHandlers.ListEntryArgs e) { SoundEntry sEntry = e.ListEntry as SoundEntry; if (sEntry != null) { ClearBindings(this); _CurrentSoundEntry = null; SoundEntryCollection.RemoveSoundEntry(sEntry.SoundID); listEntries.RefreshList(); } }
public static TreeNode ToTreeNode(this SoundEntry snd) { if (snd.GetIsProperEntry()) { var newNode = new TreeNode(snd.GetCommand()) { Name = DB_Editor.NodeNameEntry, ImageIndex = 0 }; var FilesNode = newNode.Nodes.Add(DB_Editor.NodeNameFiles); FilesNode.ImageIndex = 1; FilesNode.SelectedImageIndex = 1; FilesNode.StateImageIndex = 1; FilesNode.Name = DB_Editor.NodeNameFiles; foreach (var file in snd.GetAllFiles()) { if (file.RemoveWhitespaces() != String.Empty) { var fNode = FilesNode.Nodes.Add(file); fNode.ImageIndex = 1; fNode.SelectedImageIndex = 1; fNode.StateImageIndex = 1; } } var Requirement = newNode.Nodes.Add(DB_Editor.NodeNameRequirements); Requirement.ImageIndex = 2; Requirement.SelectedImageIndex = 2; Requirement.StateImageIndex = 2; Requirement.Name = DB_Editor.NodeNameRequirements; Requirement.Text = snd.GetRequirement().ToString(); var Description = newNode.Nodes.Add(DB_Editor.NodeDescription); Description.ImageIndex = 3; Description.SelectedImageIndex = 3; Description.StateImageIndex = 3; Description.Name = DB_Editor.NodeDescription; Description.Text = snd.GetDescription(); var DateTimeTreeNode = newNode.Nodes.Add(DB_Editor.NodeNameDateAdded); DateTimeTreeNode.ImageIndex = 4; DateTimeTreeNode.SelectedImageIndex = 4; DateTimeTreeNode.StateImageIndex = 4; DateTimeTreeNode.Name = DB_Editor.NodeNameDateAdded; DateTimeTreeNode.Text = snd.GetDateAdded().ToString(); return(newNode); } else { throw new Exception(snd.GetCommand() + " is an incorrect entry!"); } }
//Constructs dictionaries void ConstructDicts() { musicDict = new Dictionary <string, SoundEntry>(); foreach (SoundEntry song in musicClips) { SoundEntry entry = new SoundEntry(); entry.startClip = song.startClip; entry.loopClip = song.loopClip; musicDict[song.name] = entry; } }
public void Add(SoundEntry s) { foreach (SoundEntry x in soundList) { if (x.Key.Equals(s.Key)) { x.Parent = s.Parent; return; } } soundList.Add(s); }
public AddEditNewEntryDialog(SoundEntry Entry) { InitializeComponent(); AddComboboxDataSources(); this.Text = "Entry editing"; this.TB_Command.Text = Entry.GetCommand(); this.CBox_RequiredRight.SelectedIndex = (int)Entry.GetRequirement(); foreach (var sound in Entry.GetAllFiles()) { ListB_Files.Items.Add(sound); } this.RB_Description.Text = Entry.GetDescription(); Verify(); }
private void PopulateData(SoundEntry sEntry) { for (int i = 1; i <= 8; i++) { ComboBox ddlList = (ComboBox)(this.Controls.Find("ddlChar" + i, true)[0]); if (CurrentSoundEntry.AssociatedFightersIDs.Count >= i) { ddlList.SelectedItem = _EnumChars.FirstOrDefault(p => p.Value == (int)sEntry.AssociatedFightersIDs[i - 1]); } else { ddlList.SelectedIndex = 0; } } }
internal void CopySoundEntry() { SoundEntry entry = (SoundEntry)((SoundEntry)SelectedListItem.Tag).Clone(); SoundEntries.Add(entry); ListViewItemModel newItem = new ListViewItemModel { Texts = new ObservableCollection <string>(new string[1]), Tag = entry }; UpdateListItem(newItem); ListItems.Add(newItem); SelectedListItem = ListItems.Last(); }
internal void UpdateListItem(ListViewItemModel item) { SoundEntry soundEntry = item.Tag as SoundEntry; CommandEntry commandEntry = item.Tag as CommandEntry; if (soundEntry != null) { item.Texts[0] = soundEntry.Index.ToString(culture); } if (commandEntry != null) { item.Texts[0] = commandEntry.Info.Name; item.Texts[1] = commandEntry.Option.ToString(culture); } }
private void B_OK_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; var listFile = ListB_Files.Items; string[] files = new string[listFile.Count]; for (int i = 0; i < files.Length; i++) { files[i] = listFile[i].ToString(); } this.ReturnSound = new SoundEntry(TB_Command.Text, (TwitchRightsEnum)CBox_RequiredRight.SelectedIndex, files, RB_Description.Text, DateTime.UtcNow); this.Close(); }
private string GetTableRowForFile(SoundEntry hSound) { return(string.Format("<tr>" + "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{0}{1}</td>" + "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{2}</td>" + "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{3}</td>" + "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{4}</td>" + "</tr>", PrefixCharacter, hSound.GetCommand(), hSound.GetAllFiles().Length > 1 ? "multiple" : System.IO.Path.GetFileNameWithoutExtension(hSound.GetAllFiles().First()), hSound.GetDescription(), hSound.GetDateAdded().ToString(), GetHTMLColor(hSound.GetRequirement()) )); }
public GameScreen(Game game, string backgroundImage, SoundEntry backgroundMusic) : base(game, backgroundImage, backgroundMusic) { //Remove the define at the top of the file to play the tutorial version bool tutorialVersion = false; #if TutorialVersion tutorialVersion = true; #endif if(tutorialVersion) { board = new TutorialGameBoard(this.Game); } else { board = new GameBoard(this.Game); } }
private void AddSoundEntry(float value) { SoundEntry se = new SoundEntry { value = value }; string path = Application.dataPath + "/Data/Sound.json"; string jsonString = File.ReadAllText(path); Sound s = JsonUtility.FromJson <Sound>(jsonString); s.sound_entry_list.Add(se); string json = JsonUtility.ToJson(s); File.WriteAllText(path, json); }
public void SaveSoundTestOrder() { int index = 0; Dictionary <string, int> dict = new Dictionary <string, int>(); foreach (TreeNode nodeSound in treeView.Nodes) { dict.Add(nodeSound.Name, index); index++; } IEnumerator enumerator = _CurrentList.GetEnumerator(); while (enumerator.MoveNext()) { SoundEntry sEntry = (SoundEntry)enumerator.Current; sEntry.SoundTestOrder = dict[sEntry.SoundID.ToString()]; } }
public GameScreen(Game game, string backgroundImage, SoundEntry backgroundMusic) : base(game, backgroundImage, backgroundMusic) { //Remove the define at the top of the file to play the tutorial version bool tutorialVersion = false; #if TutorialVersion tutorialVersion = true; #endif if (tutorialVersion) { board = new TutorialGameBoard(this.Game); } else { board = new GameBoard(this.Game); } }
private void _ListSoundDB_ItemAdded(object sender, EventHandlers.ListEntryArgs e) { SoundEntry sEntry = e.ListEntry as SoundEntry; if (sEntry != null) { foreach (SoundDBStageSoundEntry sSoundDBStageSoundEntry in _CurrentSoundDBStage.SoundEntries) { if (sEntry.SoundID == sSoundDBStageSoundEntry.SoundEntry.SoundID) { MessageBox.Show(Strings.ERROR_SOUND_ADD, Strings.CAPTION_ERROR); return; } } _CurrentSoundDBStage.SoundEntries.Add(new SoundDBStageSoundEntry(SoundEntryCollection, sEntry.SoundID)); //Check if bgms need to be added bool needAdd = false; List <BGMEntry> myMusicEntryBGMs = new List <BGMEntry>(); foreach (MyMusicStageBGM myMusicStageBGM in _CurrentMyMusicStage.BGMs) { myMusicEntryBGMs.Add(myMusicStageBGM.BGMEntry); } foreach (SoundEntryBGM sEntryBGM in sEntry.BGMFiles) { if (myMusicEntryBGMs.Find(p => p.BGMID == sEntryBGM.BGMID) == null) { needAdd = true; break; } } if (needAdd && MessageBox.Show(Strings.WARNING_COPY_SOUND, Strings.CAPTION_WARNING, MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (SoundEntryBGM sEntryBGM in sEntry.BGMFiles) { if (myMusicEntryBGMs.Find(p => p.BGMID == sEntryBGM.BGMID) == null) { MyMusicStageBGM myMusicStageBGM = SoundEntryCollection.CreateMyMusicStageBGM(sEntryBGM.BGMID, (ushort)_CurrentMyMusicStage.BGMs.Count); _CurrentMyMusicStage.BGMs.Add(myMusicStageBGM); } } _ListMyMusic.RefreshItems(); } } }
public void PlayClip(string clipName) { if (_soundEntries.ContainsKey(clipName) && _cooldowns[clipName] <= 0) { AudioSource source = findAvailableAudioSource(); if (source != null) { SoundEntry sfx = _soundEntries[clipName]; source.clip = sfx.Clip; source.volume = sfx.Volume; source.Play(); _cooldowns[clipName] = sfx.MinFramesBetweenPlays; if (!_currentCooldowns.Contains(clipName)) { _currentCooldowns.Add(clipName); } } } }
public void PlaySound(string identifier, float volume = 1, float pitch = 1) { SoundEntry s = Array.Find(m_SfxLibrary, sound => sound.m_Identifier == identifier); if (s == null) { Debug.LogWarning("The requested sound \"" + identifier + "\" does not exist!"); return; } GameObject tempSoundPlayer = Instantiate(s.m_Source.gameObject); AudioSource audioSource = tempSoundPlayer.GetComponent <AudioSource>(); audioSource.volume *= volume; audioSource.pitch *= pitch; audioSource.spatialBlend = 0.0f; // Important audioSource.Play(); Destroy(tempSoundPlayer, s.m_Clip.length); }
public void Init() { if (GlobalStuff.FindSetting("isNew") == "1") { MessageBox.Show("Please initialize the database in Misc > Database with Scan"); this.BeginInvoke(new MethodInvoker(Close)); return; } Sounds = new List <SoundEntry>(); SQLiteConnection con = Database.GetConnection(); con.Open(); SQLiteDataReader reader = new SQLiteCommand("SELECT * FROM langtocfiles WHERE path LIKE '%\\loc\\%' ORDER BY path ", con).ExecuteReader(); toolStripComboBox1.Items.Clear(); Languages = new List <string>(); while (reader.Read()) { Languages.Add(reader.GetString(0)); } foreach (string l in Languages) { toolStripComboBox1.Items.Add(Path.GetFileName(l)); } langTOC = new TOCFile(Languages[0]); LoadTOC(); toolStripComboBox1.SelectedIndex = 0; reader = new SQLiteCommand("SELECT DISTINCT name FROM ebx WHERE type = 'SoundWaveAsset' ORDER BY name ", con).ExecuteReader(); while (reader.Read()) { SoundEntry e = new SoundEntry(); e.path = reader.GetString(0); Sounds.Add(e); } con.Close(); MakeTree(); init = true; }
private double GetSample() { double absoluteTime = _sample * _rateConversion; ++_sample; double frequency = 0; var currentSound = Volatile.Read(ref _currentSound); if (currentSound != null) { if (absoluteTime > currentSound.Start + currentSound.Sound.Duration) { Interlocked.CompareExchange(ref _currentSound, null, currentSound); _currentSound = null; } else if (currentSound.Start <= absoluteTime) { var relativeTime = absoluteTime - currentSound.Start; frequency = Math.Max(frequency, currentSound.Sound.GetFrequency(relativeTime)); } } if (!Volatile.Read(ref _isDisposing)) { _counter += _rateConversion * frequency; _counter %= 1.0; } var targetValue = _counter < 0.5 ? -1.0 : 1.0; _value = targetValue * _mixToTargetValue + _value * (1 - _mixToTargetValue); _correctionToZero = _value * _mixToZero + _correctionToZero * (1 - _mixToZero); return(_value - _correctionToZero); }
/// <summary> /// Initializes a new instance of the <see cref="TitleScreen"/> class. /// </summary> /// <param name="game">The game object to use</param> /// <param name="backgroundImage">The background image to use when this is /// visible</param> /// <param name="backgroundMusic">The background music to play when this is /// visible</param> public TitleScreen(Game game, string backgroundImage, SoundEntry backgroundMusic) : base(game, backgroundImage, backgroundMusic) { }
public SoundEntry(string k, string d, SoundEntry p) { key = k; desc = d; parent = p; }
/// <summary> /// Plays a sound /// </summary> /// <param name="sound">Which sound to play</param> /// <returns>XACT cue to be used if you want to stop this particular looped /// sound. Can be ignored for one shot sounds</returns> public static void Play(SoundEntry sound) { Play(cueNames[(int)sound]); }
private void PopulateInfo(SoundEntry sEntry) { _LoadingSound = true; VGMStreamPlayer.StopCurrentVGMStreamPlayback(); ClearBindings(this); _CurrentSoundEntry = sEntry; if (SoundEntryCollectionBackup.SoundEntriesPerID.ContainsKey(sEntry.SoundID)) { _CurrentSoundEntryOriginal = SoundEntryCollectionBackup.SoundEntriesPerID[sEntry.SoundID]; btnRestoreDBFile.Visible = true; btnRestoreMSBT.Visible = true; } else { _CurrentSoundEntryOriginal = null; btnRestoreDBFile.Visible = false; btnRestoreMSBT.Visible = false; } for (int i = 1; i <= 5; i++) { TextBox txtBGM = (TextBox)(this.Controls.Find("txtBGM" + i, true)[0]); if (sEntry.BGMFiles.Count >= i) { txtBGM.Text = sEntry.BGMFiles[i - 1].BGMEntry.BGMTitle; } else { txtBGM.Text = string.Empty; } } ddlSoundSource.SelectedItem = _EnumSoundSource.FirstOrDefault(p => p.Value == (int)sEntry.SoundSource); ddlSoundMixType.SelectedItem = _EnumSoundMixType.FirstOrDefault(p => p.Value == (int)sEntry.SoundMixType); ddlBackRotationBehavior.SelectedItem = _EnumBackgroundBehavior.FirstOrDefault(p => p.Value == (int)sEntry.SoundTestBackImageBehavior); ddlGroupStageCreation.SelectedItem = _EnumIcons.FirstOrDefault(p => p.Value == (int)sEntry.StageCreationGroupID); if (ddlGroupStageCreation.SelectedItem == null) { ddlGroupStageCreation.SelectedIndex = 0; } ddlSoundIconID.SelectedItem = _EnumIcons.FirstOrDefault(p => p.Value == (int)sEntry.IconID); if (ddlSoundIconID.SelectedItem == null) { ddlSoundIconID.SelectedIndex = 0; } listCharacterBackgroundRotation.Items.Clear(); foreach (string chara in sEntry.AssociatedFightersName) { listCharacterBackgroundRotation.Items.Add(chara); } txtOrderSoundTest.Text = sEntry.SoundTestOrder.ToString(); txtOrderStageCreation.Text = sEntry.StageCreationOrder.ToString(); //Properties supporting binding txtTitle.DataBindings.Add("Text", sEntry, "Title"); txtTitleSoundTest.DataBindings.Add("Text", sEntry, "SoundTestTitle"); txtDescription.DataBindings.Add("Text", sEntry, "Description"); txtDescription2.DataBindings.Add("Text", sEntry, "Description2"); txtSource.DataBindings.Add("Text", sEntry, "Source"); txtShort17.DataBindings.Add("Text", sEntry, "Int17"); chkInSoundTest.DataBindings.Add("Checked", sEntry, "InSoundTest"); chkUnknownByte2.DataBindings.Add("Checked", sEntry, "Byte2"); chkUnknownByte3.DataBindings.Add("Checked", sEntry, "Byte3"); chkUnknownByte4.DataBindings.Add("Checked", sEntry, "Byte4"); chkRegionJPN.DataBindings.Add("Checked", sEntry, "InRegionJPN"); chkRegionUSEUR.DataBindings.Add("Checked", sEntry, "InRegionEUUS"); _LoadingSound = false; }
/// <summary> /// Default constructor /// </summary> /// <param name="game">The game object</param> /// <param name="backgroundImage">The background image to use when this is /// visible</param> /// <param name="backgroundMusic">The background music to play when this is /// visible</param> public Screen(Game game, string backgroundImage, SoundEntry backgroundMusic) : base(game) { this.backgroundImage = backgroundImage; this.backgroundMusic = backgroundMusic; }
public static SoundEffectInstance PlayMusic(SoundEntry sound) { SoundEffectInstance instance = soundEffects[(int)sound].CreateInstance(); instance.IsLooped = (sound == SoundEntry.MusicGame); instance.Play(); return instance; }
public static void Play(SoundEntry sound) { soundEffects[(int)sound].Play(); }
/// <summary> /// Plays a sound /// </summary> /// <param name="sound">Which sound to play</param> /// <returns>XACT cue to be used if you want to stop this particular looped /// sound. Can be ignored for one shot sounds</returns> public static Cue Play(SoundEntry sound) { return(Play(cueNames[(int)sound])); }
/// <summary> /// Plays a sound /// </summary> /// <param name="sound">Which sound to play</param> /// <returns>XACT cue to be used if you want to stop this particular looped /// sound. Can be ignored for one shot sounds</returns> public static Cue Play(SoundEntry sound) { return Play(cueNames[(int)sound]); }
public SoundBox(SoundEntry entry) : this(entry.Samples) { }