Exemplo n.º 1
0
 public void TestInitialize()
 {
     Synth.SoundFontPath = "../data/OmegaGMGS2.sf2";
     Synth.MidiFilePath  = "../data/Cmon_v1.mid";
     Synth.Playbacking  += (IntPtr data, IntPtr evt) => {
         return(Synth.HandleEvent(data, evt));
     };
     Synth.Started += () => {
     };
     Synth.Ended   += () => {
     };
     Synth.Updated += (object sender, PropertyChangedEventArgs e) => {
     };
     playSong();
     Sleep(3000);
 }
Exemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////////////////////////////
        // EventHandler

        void MainForm_Load(object sender, EventArgs e)
        {
            Conf.Load();
            initializeControl();

            Synth.Playbacking += (IntPtr data, IntPtr evt) => {
                return(Synth.HandleEvent(data, evt));
            };

            Synth.Started += () => {
                Log.Info("Started called.");
                Invoke((MethodInvoker)(() => {
                    Text = $"MidiPlayer: {Synth.MidiFilePath.ToFileName()} {Synth.SoundFontPath.ToFileName()}";
                    listView.Items.Clear();
                    Enumerable.Range(0, Synth.TrackCount).ToList().ForEach(x => {
                        listView.Items.Add(new ListViewItem(new string[] { "  ●", "--", "--", "--", "--", "--" }));
                    });
                }));
            };

            Synth.Ended += () => {
                Log.Info("Ended called.");
                if (!playList.Ready)
                {
                    Synth.Stop();
                    Synth.Start();
                }
                else
                {
                    Synth.Stop();
                    Synth.MidiFilePath = playList.Next;
                    Synth.Start();
                }
            };

            Synth.Updated += (object sender, PropertyChangedEventArgs e) => {
                var _track = (Synth.Track)sender;
                Invoke(updateList(_track));
            };
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            requestPermissions();
            Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            initializeComponent();
            Conf.Load();

            Synth.Playbacking += (IntPtr data, IntPtr evt) => {
                return(Synth.HandleEvent(data, evt));
            };

            Synth.Started += () => {
                Log.Info("Started called.");
                MainThread.BeginInvokeOnMainThread(() => {
                    Title = $"MidiPlayer: {Synth.MidiFilePath.ToFileName()} {Synth.SoundFontPath.ToFileName()}";
                });
            };

            Synth.Ended += () => {
                Log.Info("Ended called.");
                if (!playList.Ready)
                {
                    Synth.Stop();
                    Synth.Start();
                }
                else
                {
                    Synth.Stop();
                    Synth.MidiFilePath = playList.Next;
                    Synth.Start();
                }
            };
        }