///////////////////////////////////////////////////////////////////////////////////////////////
        // private Methods [verb, verb phrases]

        async void playSong()
        {
            try {
                await Task.Run(() => Synth.Start());
            } catch (Exception ex) {
                Log.Error(ex.Message);
            }
        }
Exemple #2
0
        static void InitSynth()
        {
            if (settings != null)
            {
                Synth.settings = settings.GetPlatformSettings();
                if (Synth.settings.GetSynthEnum() == Synth.SynthEnum.Bass24)
                {
#if UNITY_ANDROID || UNITY_WSA
                    BASS24NETSynth.Register(settings.userName, settings.password);
#endif
                }
                Synth.Start();
            }
            else
            {
                Debug.LogError("InitSynth : MIDISettings NULL");
            }
        }
Exemple #3
0
        ///////////////////////////////////////////////////////////////////////////////////////////////
        // private Methods [verb, verb phrases]

        async void playSong()
        {
            try {
                await Task.Run(() => {
                    if (!playList.Ready)
                    {
                        Synth.MidiFilePath = midiFilePath;
                        Synth.Start();
                    }
                    else
                    {
                        Synth.MidiFilePath = playList.Next;
                        Synth.Start();
                    }
                });
            } catch (Exception ex) {
                Log.Error(ex.Message);
            }
        }
Exemple #4
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));
            };
        }
Exemple #5
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();
                }
            };
        }