public void CreateTrackAndNotes() { using (Transaction transaction = new Transaction(TrackEditorViewModel.Sequence)) // This is important, without using a transaction your modifications won't be applied immediately { try { // Create the new track and set its effect block WIVSMMidiTrack track = TrackEditorViewModel.AddTrack(VSMTrackType.Midi) as WIVSMMidiTrack; App.EffectEngine.SetEffectBlock(track); // Now create the VOCALOID part and set its effect block WIVSMMidiPart part = track.InsertPart(VSMAbsTick.Zero, new VSMRelTick(7680), "Created by ExamplePlugin"); App.EffectEngine.SetEffectBlock(part); // We need to assign a voicebank to the VOCALOID part as well as a style, we'll use the default voicebank and the default style part.SetVoiceBankID(DefaultVoicebank.CompID); part.EffectManager.InsertVoiceDefaultStyleEffects(DefaultVoicebank); Style voiceDefaultStyle = part.EffectManager.GetVoiceDefaultStyle(App.DatabaseManager.DefaultVoiceBank); part.StyleName = voiceDefaultStyle.Name; // Now let's insert the notes ! part.InsertNote(new VSMRelTick(0), new VSMNoteEvent(1000, 60, 100), part.GetDefaultNoteExpression(), "he", "h e", true); part.InsertNote(new VSMRelTick(1001), new VSMNoteEvent(1000, 62, 100), part.GetDefaultNoteExpression(), "ro", "4 o", true); } catch (Exception ex) // Don't forget to catch errors if you don't want the whole software to crash in case of an error { MessageBoxDeliverer.GeneralError("An error occurred while adding the track !"); MessageBoxDeliverer.GeneralError(ex.GetType().ToString() + " : " + ex.Message); } } }
public static void Main(string[] args) { Assembly.LoadFrom("VOCALOID5.exe"); Betterloid betterloid = new Betterloid(); betterloid.Initialize(); betterloid.InitializePlugins(); App app = new App(); app.InitializeComponent(); bool started = false; app.Activated += (object sender, EventArgs arg) => { if (started) { return; } started = true; foreach (Plugin plugin in Instance.StartupPlugins) { try { plugin.Instance.Startup(); } catch { MessageBoxDeliverer.GeneralWarning("An error occurred while starting the plugin : " + plugin.Config.PluginName); } App.DoEvents(); } }; app.Run(); }
public void Startup() { string info = "Betterloid " + Betterloid.Betterloid.Instance.Config.Version + " By SeleDreams."; info += "\n" + "Startup Plugins : " + Betterloid.Betterloid.Instance.StartupPlugins.Count; info += "\n" + "Editor Plugins : " + Betterloid.Betterloid.Instance.EditorPlugins.Count; MessageBoxDeliverer.GeneralInformation(info); }
public void RenameSelectedNotes() { using (Transaction transaction = new Transaction(TrackEditorViewModel.Sequence)) { WIVSMMidiPart activePart = MusicalEditor.ActivePart; if (activePart == null) { MessageBoxDeliverer.GeneralError("No active part selected !"); return; } foreach (WIVSMNote note in activePart.Notes) { if (note.IsSelected) { note.Lyric = "la"; note.SetPhonemes("4 a", true); } } } }