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.º 2
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.º 3
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.º 4
0
 public void Dispose()
 {
     driver.Dispose();
     synth.Dispose();
 }