1919using Melanchall . DryWetMidi . Interaction ;
2020using Melanchall . DryWetMidi . Multimedia ;
2121using QuickLook . Common . Annotations ;
22- using QuickLook . Common . Helpers ;
2322using QuickLook . Common . Plugin ;
2423using System ;
2524using System . ComponentModel ;
@@ -43,7 +42,6 @@ internal class MidiPlayer : IDisposable, INotifyPropertyChanged
4342 private OutputDevice _outputDevice ;
4443 private Playback _playback ;
4544 private TimeSpan _duration ;
46- private MethodInfo _setShouldLoop ; // Reflection to invoke `_vp.set_ShouldLoop()`
4745
4846 private long _currentTicks = 0L ;
4947
@@ -64,6 +62,7 @@ public MidiPlayer(ViewerPanel panle, ContextObject context)
6462 {
6563 _vp = panle ;
6664 _context = context ;
65+ _outputDevice = OutputDevice . GetByName ( "Microsoft GS Wavetable Synth" ) ;
6766 }
6867
6968 public void Dispose ( )
@@ -84,7 +83,6 @@ public void LoadAndPlay(string path, MediaInfoLib info)
8483 _vp . metaArtists . Text = _midiFile . OriginalFormat . ToString ( ) ;
8584 _vp . metaAlbum . Text = _midiFile . TimeDivision . ToString ( ) ;
8685
87- _outputDevice = OutputDevice . GetByName ( "Microsoft GS Wavetable Synth" ) ;
8886 _playback = _midiFile . GetPlayback ( _outputDevice ) ;
8987
9088 if ( _playback . GetDuration ( TimeSpanType . Metric ) is MetricTimeSpan metricTimeSpan )
@@ -123,15 +121,8 @@ public void LoadAndPlay(string path, MediaInfoLib info)
123121 }
124122 } ;
125123
126- if ( _vp . GetType ( ) . GetProperty ( "ShouldLoop" , BindingFlags . Instance | BindingFlags . Public ) is PropertyInfo propertyShouldLoop )
127- {
128- _setShouldLoop = propertyShouldLoop . GetSetMethod ( nonPublic : true ) ;
129- _setShouldLoop . Invoke ( _vp , [ SettingHelper . Get ( "ShouldLoop" , false , "QuickLook.Plugin.VideoViewer" ) ] ) ;
130- }
131-
132124 _vp . buttonLoop . Click += ( _ , _ ) =>
133125 {
134- _setShouldLoop . Invoke ( _vp , [ ! _vp . ShouldLoop ] ) ;
135126 _playback . Loop = _vp . ShouldLoop ;
136127 } ;
137128
0 commit comments