private void listEntries_ItemAdded(object sender, EventArgs e) { SoundEntry sEntry = SoundEntryCollection.CreateSoundEntry(); listEntries.RefreshList(); listEntries.SelectItem(sEntry); }
private void PopulateInfoStageBGM(MyMusicStageBGM myMusicStageBGM) { this.groupMusicStageBGM.Visible = myMusicStageBGM != null; if (myMusicStageBGM == null) { return; } _CurrentMyMusicStageBGM = myMusicStageBGM; _CurrentMyMusicStageBGMOriginal = _CurrentMyMusicStageOriginal.BGMs.Find(p => p.BGMID == myMusicStageBGM.BGMID); this.btnRestoreMyMusicProperties.Visible = _CurrentMyMusicStageBGMOriginal != null; BGMEntry sEntryBGM = SoundEntryCollection.SoundEntriesBGMsPerID[myMusicStageBGM.BGMID]; lblBGMIDValue.Text = myMusicStageBGM.BGMID.ToString(); lblBGMNameValue.Text = sEntryBGM.BGMTitle; _ListMyMusic.VGMStreamFile = SoundEntryCollection.GetBGMFullPath(sEntryBGM.BGMFilename); //Properties supporting binding ClearBindings(this); txtBGMIndex.DataBindings.Add("Text", myMusicStageBGM, "Index"); txtBGMSubIndex.DataBindings.Add("Text", myMusicStageBGM, "SubIndex"); txtRarity.DataBindings.Add("Text", myMusicStageBGM, "Rarity"); txtUnk3.DataBindings.Add("Text", myMusicStageBGM, "Unk3"); txtUnk4.DataBindings.Add("Text", myMusicStageBGM, "Unk4"); txtPlayDelay.DataBindings.Add("Text", myMusicStageBGM, "PlayDelay"); txtUnk6.DataBindings.Add("Text", myMusicStageBGM, "Unk6"); txtUnk7.DataBindings.Add("Text", myMusicStageBGM, "Unk7"); txtUnk8.DataBindings.Add("Text", myMusicStageBGM, "Unk8"); txtUnk9.DataBindings.Add("Text", myMusicStageBGM, "Unk9"); }
private void _ListMyMusic_ItemAdded(object sender, EventHandlers.ListEntryArgs e) { BGMEntry sEntryBGM = e.ListEntry as BGMEntry; if (sEntryBGM != null) { MyMusicStageBGM myMusicStageBGM = SoundEntryCollection.CreateMyMusicStageBGM(sEntryBGM.BGMID, (ushort)_CurrentMyMusicStage.BGMs.Count); _CurrentMyMusicStage.BGMs.Add(myMusicStageBGM); if (_CurrentSoundDBStage != null) { foreach (SoundDBStageSoundEntry sDBStageSoundEntry in _CurrentSoundDBStage.SoundEntries) { if (sDBStageSoundEntry.SoundEntry.BGMFiles.Find(p => p.BGMEntry == sEntryBGM) != null) { return; } } if (MessageBox.Show(Strings.WARNING_COPY_MYMUSIC, Strings.CAPTION_WARNING, MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (SoundEntry sEntry in SoundEntryCollection.SoundEntries) { if (sEntry.BGMFiles.Find(p => p.BGMID == sEntryBGM.BGMID) != null) { _CurrentSoundDBStage.SoundEntries.Add(new SoundDBStageSoundEntry(SoundEntryCollection, sEntry.SoundID)); break; } } _ListSoundDB.RefreshItems(); } } } }
private void txtBGM_TextChanged(object sender, EventArgs e) { TextBox textAreaBGM = (TextBox)sender; string nameBGM = textAreaBGM.Text; int index = Convert.ToInt32(textAreaBGM.Name.Replace("txtBGM", string.Empty)); string file = "snd_bgm_" + nameBGM + ".nus3bank"; VGMStreamPlayer vgmStreamPlayer = ((VGMStreamPlayer)(this.Controls.Find("playerBGM" + index, true)[0])); if (VGMStreamPlayer.CurrentVGMStreamPlayer == vgmStreamPlayer) { VGMStreamPlayer.StopCurrentVGMStreamPlayback(); } Button buttonBGMAdvanced = (Button)(this.Controls.Find("btnBGMAdv" + index, true)[0]); file = SoundEntryCollection.GetBGMFullPath(file); if (!string.IsNullOrEmpty(file) && SoundEntryCollection.SoundEntriesBGMsPerName.ContainsKey(nameBGM)) { vgmStreamPlayer.File = file; textAreaBGM.Tag = SoundEntryCollection.SoundEntriesBGMsPerName[nameBGM]; if (textAreaBGM.Tag == null) { throw new Exception("Problem finding SoundEntryBGM"); } buttonBGMAdvanced.Enabled = true; } else { vgmStreamPlayer.File = null; vgmStreamPlayer.Enabled = false; buttonBGMAdvanced.Enabled = false; textAreaBGM.Tag = null; } if (_LoadingSound) { return; } //Update BGMFiles SoundEntryBGM mainBGM = _CurrentSoundEntry.BGMFiles[0]; _CurrentSoundEntry.BGMFiles.Clear(); for (int i = 1; i <= 5; i++) { TextBox txtBGM = (TextBox)(this.Controls.Find("txtBGM" + i, true)[0]); if (txtBGM.Tag != null) { _CurrentSoundEntry.BGMFiles.Add(new SoundEntryBGM(SoundEntryCollection, _CurrentSoundEntry, ((BGMEntry)txtBGM.Tag).BGMID)); } else if (i == 1) { _CurrentSoundEntry.BGMFiles.Add(mainBGM); } } }
private void _Main_XMLLoaded(object sender, EventArgs e) { _SoundEntryCollection = _Main.SoundEntryCollection; _PropertyFile.SoundEntryCollection = _SoundEntryCollection; _MyMusicFile.SoundEntryCollection = _SoundEntryCollection; _UISoundDBFile.SoundEntryCollection = _SoundEntryCollection; foreach (SoundMSBTFile msbtFile in _SoundMSBTFiles) { msbtFile.SoundEntryCollection = _SoundEntryCollection; } }
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(); } }
private void _ListSoundDB_ItemSelected(object sender, EventHandlers.ListEntryArgs e) { SoundDBStageSoundEntry sSoundDBStageSoundEntry = e.ListEntry as SoundDBStageSoundEntry; if (sSoundDBStageSoundEntry != null && sSoundDBStageSoundEntry.SoundEntry != null) { _ListSoundDB.VGMStreamFile = SoundEntryCollection.GetBGMFullPath(sSoundDBStageSoundEntry.SoundEntry.BGMFiles[0].BGMEntry.BGMFilename); } else { _ListSoundDB.VGMStreamFile = null; } }
public static void WriteDebugBGMEntriesCSV(SoundEntryCollection soundCollection, string pathToSave) { List <string> bgmsLines = new List <string>(); bgmsLines.Add("BGMID,Title,unk1,unk2,unk3,unk4,MenuCheckPoint1,MenuCheckPoint2,MenuCheckPoint3,MenuCheckPoint4,LoopStartTime,LoopEndTime,LoopStartSample,LoopEndSample,StreamTotalDuration,StreamTotalSamples"); foreach (BGMEntry eBGM in soundCollection.SoundEntriesBGMs) { bgmsLines.Add(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}", eBGM.BGMID, eBGM.BGMTitle, eBGM.BGMUnk1, eBGM.BGMUnk2, eBGM.BGMUnk3, eBGM.BGMUnk4, eBGM.MenuCheckPoint1, eBGM.MenuCheckPoint2, eBGM.MenuCheckPoint3, eBGM.MenuCheckPoint4, eBGM.LoopStartTime, eBGM.LoopEndTime, eBGM.LoopStartSample, eBGM.LoopEndSample, eBGM.StreamTotalDuration, eBGM.StreamTotalSamples)); } File.WriteAllLines(pathToSave, bgmsLines); }
public void Initialize() { //Init sound files refreshBGMFilesListToolStripMenuItem_Click(this, new EventArgs()); SoundEntryCollection sEntryCollectionOriginal = (SoundEntryCollection)_SoundEntryCollection.Clone(); _BGMManagement.SoundEntryCollection = _SoundEntryCollection; _BGMManagement.SoundEntryCollectionBackup = sEntryCollectionOriginal; _MyMusicManagement.SoundEntryCollection = _SoundEntryCollection; _MyMusicManagement.SoundEntryCollectionBackup = sEntryCollectionOriginal; _BGMManagement.Initialize(sm4shProject); _MyMusicManagement.Initialize(sm4shProject); }
private void Initialize() { //Init sound files RefreshBGMFilesList(); SoundEntryCollection sEntryCollectionOriginal = (SoundEntryCollection)_SoundEntryCollection.Clone(); _BGMManagement.SoundEntryCollection = _SoundEntryCollection; _BGMManagement.SoundEntryCollectionBackup = sEntryCollectionOriginal; _MyMusicManagement.SoundEntryCollection = _SoundEntryCollection; _MyMusicManagement.SoundEntryCollectionBackup = sEntryCollectionOriginal; _BGMManagement.Initialize(_SmashProjectManager); _MyMusicManagement.Initialize(_SmashProjectManager); }
public static void WriteDebugMyMusicCSV(SoundEntryCollection soundCollection, string pathToSave) { List <string> myMusicLines = new List <string>(); myMusicLines.Add("StageMyMusicID,StageSoundDBID,StageName,Index,BGMID,BGMTitle,SubIndex,Rarity,SaveMyMusic,unk4,PlayDelay,unk6,unk7,unk8,unk9"); foreach (MyMusicStage myMusicStage in soundCollection.MyMusicStages) { foreach (MyMusicStageBGM musicStageBGM in myMusicStage.BGMs) { myMusicLines.Add(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14}", myMusicStage.MyMusicStageID, myMusicStage.BGMStage.BGMDBID, myMusicStage.BGMStage.Label, musicStageBGM.Index, musicStageBGM.BGMEntry.BGMID, musicStageBGM.BGMEntry.BGMTitle, musicStageBGM.SubIndex, musicStageBGM.Rarity, musicStageBGM.SaveMyMusic, musicStageBGM.Unk4, musicStageBGM.PlayDelay, musicStageBGM.Unk6, musicStageBGM.Unk7, musicStageBGM.Unk8, musicStageBGM.Unk9)); } } File.WriteAllLines(pathToSave, myMusicLines); }
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 static void WriteDebugSoundMSBTCSV(SoundEntryCollection soundCollection, string pathToSave) { List <string> soundDBLines = new List <string>(); soundDBLines.Add("ID,SoundLabel,BGM1,BGM2,BGM3,BGM4,BGM5,InSoundTest,byte2,byte3,byte4,InRegionJPN,InRegionEUUS,SoundSource,SoundMixType,IconID,SoundTestBackImageBehavior,AssociatedFighters,SoundTestOrder,StageCreationOrder,StageCreationGroup,short17,Title,SoundTestTitle,Description1,Description2,Source"); foreach (SoundEntry sEntry in soundCollection.SoundEntries) { string[] files = new string[5]; for (int i = 0; i < sEntry.BGMFiles.Count; i++) { files[i] = sEntry.BGMFiles[i].BGMEntry.BGMTitle; } soundDBLines.Add(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26}", sEntry.SoundID, sEntry.SoundLabel, files[0], files[1], files[2], files[3], files[4], sEntry.InSoundTest, sEntry.Byte2, sEntry.Byte3, sEntry.Byte4, sEntry.InRegionJPN, sEntry.InRegionEUUS, sEntry.SoundSource, sEntry.SoundMixType, sEntry.IconName, sEntry.SoundTestBackImageBehavior, string.Join(" | ", sEntry.AssociatedFightersName), sEntry.SoundTestOrder, sEntry.StageCreationOrder, sEntry.StageCreationGroupName, sEntry.Int17, StringToCSVCell(sEntry.Title), StringToCSVCell(sEntry.SoundTestTitle), StringToCSVCell(sEntry.Description), StringToCSVCell(sEntry.Description2), StringToCSVCell(sEntry.Source))); } File.WriteAllLines(pathToSave, soundDBLines); }
private void Load() { _SoundEntryCollection = new SoundEntryCollection(); BGMFilesDB.InitializeBGMDB(_SmashProjectManager.CurrentProject.GameVersion, _SmashProjectManager.CurrentProject.IsSwitch); BGMStageDB.InitializeBGMMyMusicDB(_SmashProjectManager.CurrentProject.GameVersion, _SmashProjectManager.CurrentProject.IsSwitch); _PropertyFile = new PropertyFile(_SmashProjectManager, _SoundEntryCollection, "data/sound/config/bgm_property.mpb"); _SoundEntryCollection.GenerateSoundEntriesBGMDictionary(); _UISoundDBFile = new UISoundDBFile(_SmashProjectManager, _SoundEntryCollection, "data/param/ui/ui_sound_db.bin"); _SoundEntryCollection.GenerateSoundEntriesDictionary(); _MyMusicFile = new MyMusicFile(_SmashProjectManager, _SoundEntryCollection, "data/sound/config/bgm_mymusic.mmb"); //Generation SoundMSBT dictionaries _SoundMSBTFiles = new List <SoundMSBTFile>(); foreach (ResourceCollection resCol in _SmashProjectManager.ResourceDataCollection) { if (!resCol.CachedFilteredResources.ContainsKey("ui/message/sound.msbt")) { continue; } SoundMSBTFile soundMSBTFile = new SoundMSBTFile(_SmashProjectManager, _SoundEntryCollection, resCol.PartitionName + "/ui/message/sound.msbt"); _SoundMSBTFiles.Add(soundMSBTFile); } //Generate Dictionaries _SoundEntryCollection.GenerateStagesDictionaries(); //Check stage sound integrity between MyMusic Stages and SoundDB Stages. //General rule: All BGMS present in MyMusic stages must be in SoundDB, the opposite isnt true. foreach (MyMusicStage myMusicStage in _SoundEntryCollection.MyMusicStages) { if (myMusicStage.BGMStage.BGMDBID != null) { //From MyMusic List <BGMEntry> bgmsMyMusic = new List <BGMEntry>(); foreach (MyMusicStageBGM myMusicStageBGM in myMusicStage.BGMs) { //if(myMusicStageBGM.unk4 == 0x0) //Filter songs bgmsMyMusic.Add(myMusicStageBGM.BGMEntry); } //From SoundDB List <BGMEntry> bgmsSoundDB = new List <BGMEntry>(); foreach (SoundDBStageSoundEntry sDBStageSoundEntry in _SoundEntryCollection.SoundDBStagesPerID[(int)myMusicStage.BGMStage.BGMDBID].SoundEntries) { if (sDBStageSoundEntry.SoundEntry == null) { LogHelper.Warning(string.Format("SOUNDID '{0}' have an issue with one of its associated stages.", sDBStageSoundEntry.SoundID)); continue; } foreach (SoundEntryBGM sEntryBGM in sDBStageSoundEntry.SoundEntry.BGMFiles) { bgmsSoundDB.Add(sEntryBGM.BGMEntry); } } //HACK FOR KK foreach (SoundEntry sEntry in _SoundEntryCollection.SoundEntries) { if (!sEntry.InSoundTest) { foreach (SoundEntryBGM sEntryBGM in sEntry.BGMFiles) { if (sEntryBGM.BGMEntry != null) { bgmsSoundDB.Add(sEntryBGM.BGMEntry); } } } } //Compare foreach (BGMEntry sEntryBGM in bgmsMyMusic) { if (!bgmsSoundDB.Contains(sEntryBGM)) { //throw new Exception(string.Format("Error sound integrity between MyMusic Stages and SoundDB Stages for stage '{0}': '{1}' was not present.", myMusicStage.BGMStage.Label, sEntryBGM.BGMTitle)); LogHelper.Error(string.Format("Error sound integrity between MyMusic Stages and SoundDB Stages for stage '{0}': '{1}' was not present.", myMusicStage.BGMStage.Label, sEntryBGM.BGMTitle)); } } } } Initialize(); }
public void LoadConfiguration() { OpenFileDialog open = new OpenFileDialog(); open.Filter = "XML files|*.xml"; open.DefaultExt = "xml"; open.FileName = "sm4shsound_config.xml"; if (open.ShowDialog() == DialogResult.OK) { string pathToOpen = open.FileName; SoundEntryCollection = (SoundEntryCollection)Serializer.DeserializeXmlToObject <SoundEntryCollection>(pathToOpen).Clone(); //Hack for textarea try { foreach (SoundEntry sEntry in SoundEntryCollection.SoundEntries) { if (!string.IsNullOrEmpty(sEntry.Title)) { sEntry.Title = sEntry.Title.Replace("\n", Environment.NewLine); } else { sEntry.Title = string.Empty; } if (!string.IsNullOrEmpty(sEntry.SoundTestTitle)) { sEntry.SoundTestTitle = sEntry.SoundTestTitle.Replace("\n", Environment.NewLine); } else { sEntry.SoundTestTitle = string.Empty; } if (!string.IsNullOrEmpty(sEntry.Description)) { sEntry.Description = sEntry.Description.Replace("\n", Environment.NewLine); } else { sEntry.Description = string.Empty; } if (!string.IsNullOrEmpty(sEntry.Description2)) { sEntry.Description2 = sEntry.Description2.Replace("\n", Environment.NewLine); } else { sEntry.Description2 = string.Empty; } if (!string.IsNullOrEmpty(sEntry.Source)) { sEntry.Source = sEntry.Source.Replace("\n", Environment.NewLine); } else { sEntry.Source = string.Empty; } } } catch { LogHelper.Error("Error parsing string variables."); } LogHelper.Info(string.Format("Sm4shMusic: Configuration '{0}' loaded.", pathToOpen)); Initialize(); } }
private void loadConfigurationToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog.Filter = "XML files|*.xml"; openFileDialog.DefaultExt = "xml"; openFileDialog.FileName = "sm4shsound_config.xml"; if (openFileDialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { string pathToOpen = openFileDialog.FileName; SoundEntryCollection = (SoundEntryCollection)Serializer.DeserializeXmlToObject <SoundEntryCollection>(pathToOpen).Clone(); //Hack for textarea try { foreach (SoundEntry sEntry in SoundEntryCollection.SoundEntries) { if (!string.IsNullOrEmpty(sEntry.Title)) { sEntry.Title = sEntry.Title.Replace("\n", Environment.NewLine); } else { sEntry.Title = string.Empty; } if (!string.IsNullOrEmpty(sEntry.SoundTestTitle)) { sEntry.SoundTestTitle = sEntry.SoundTestTitle.Replace("\n", Environment.NewLine); } else { sEntry.SoundTestTitle = string.Empty; } if (!string.IsNullOrEmpty(sEntry.Description)) { sEntry.Description = sEntry.Description.Replace("\n", Environment.NewLine); } else { sEntry.Description = string.Empty; } if (!string.IsNullOrEmpty(sEntry.Description2)) { sEntry.Description2 = sEntry.Description2.Replace("\n", Environment.NewLine); } else { sEntry.Description2 = string.Empty; } if (!string.IsNullOrEmpty(sEntry.Source)) { sEntry.Source = sEntry.Source.Replace("\n", Environment.NewLine); } else { sEntry.Source = string.Empty; } } } catch (Exception ex) { LogHelper.Error("Error parsing string variables."); } if (XMLLoaded != null) { this.XMLLoaded(this, new EventArgs()); } LogHelper.Info(string.Format("Sm4shMusic: Configuration '{0}' loaded.", pathToOpen)); Initialize(_SmashProjectManager); } }