Exemplo n.º 1
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
         if (Synth != null)
         {
             Synth.Dispose(); Synth = null;
         }
     }
     base.Dispose(disposing);
 }
        protected override void Dispose(bool disposing)
        {
#if MIDI_MANAGER
#else
            if (disposing)
            {
                if (asset_sfloader != null)
                {
                    asset_sfloader.Dispose();
                }
                adriver.Dispose();
                syn.Dispose();
                IsDisposed = true;
            }
#endif
            base.Dispose(disposing);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Renders the currently applied settings to a MIDI file (in memory) and then sets up a player
        /// </summary>
        bool setupPlayerForPlayback()
        {
            if (drv != null)
            {
                drv.Dispose();
            }
            if (player != null)
            {
                player.Dispose();
            }
            if (syn != null)
            {
                syn.Dispose();
            }
            var soundfontFile = @"Soundbanks\ExtractedSoundbank_" + (NLSTChoice + 10).ToString("X2") + ".dls";

            if (!File.Exists(soundfontFile))
            {
                MessageBox.Show("A required soundbank file is missing - Please see the Github on how to extract soundbanks from your ROM.");
                return(false);
            }
            var settings = new Settings();

            settings[ConfigurationKeys.SynthAudioChannels].IntValue = 2;
            syn      = new Synth(settings);
            syn.Gain = 0.5f;
            syn.LoadSoundFont(soundfontFile, true);
            for (int i = 0; i < 16; i++)
            {
                syn.SoundFontSelect(i, 1);
            }

            player = new Player(syn);
            var mid = exportMIDBytes();

            player.AddMem(mid, 0, mid.Length);
            drv = new AudioDriver(settings, syn);
            return(true);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 음악 출력 장치를 끄고 타이머를 멈춥니다.
 /// </summary>
 public static void Dispose()
 {
     if (HasStart)
     {
         for (int i = 0; i <= 8; i++)
         {
             StopPlaying(i);
         }
         timer.Stop();
         //outDevice.Close();
         adriver.Dispose();
         //playback.Stop();
         //outputDevice.Stop();
         //outputDevice.Dispose();
         //reverb.Dispose();
         syn.Dispose();
         settings.Dispose();
         mgmt.Stop();
         HasStart = false;
         IsReady  = false;
     }
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     Synth.Dispose();
 }
Exemplo n.º 6
0
 public override void onRemovedFromEntity()
 {
     _synth.Dispose();
     _synth = null;
 }