@@ -4143,7 +4143,7 @@ def __init__(self, parent, ID, app_dir, settings, options):
4143
4143
4144
4144
self .play_timer = wx .Timer (self )
4145
4145
self .Bind (wx .EVT_TIMER , self .OnPlayTimer , self .play_timer )
4146
- self .play_timer .Start (50 ) #FAU:MIDIPLAY: Todo need to check if this is still needed
4146
+ self .play_timer .Start (50 )
4147
4147
self .music_update_thread .start ()
4148
4148
self .update_multi_tunes_menu_items ()
4149
4149
@@ -4492,12 +4492,15 @@ def OnMouseWheel(self, evt):
4492
4492
evt .Skip ()
4493
4493
4494
4494
def play (self ):
4495
+ self .play_timer .Start (50 )
4495
4496
if self .settings .get ('follow_score' , False ) and self .current_page_index != 0 :
4496
4497
self .select_page (0 )
4497
4498
wx .CallAfter (self .mc .Play )
4498
4499
4499
4500
def stop_playing (self ):
4500
4501
self .mc .Stop ()
4502
+ #FAU:remove highlighted notes
4503
+ self .music_pane .draw_notes_highlighted (None )
4501
4504
#FAU:MIDIPLAY: play timer can be stopped no need to update progress slider
4502
4505
self .play_timer .Stop ()
4503
4506
self .play_button .SetBitmap (self .play_bitmap )
@@ -4573,11 +4576,12 @@ def do_load_media_file(self, path):
4573
4576
self .mc .Play () # does not start playing but triggers OnMediaLoaded event
4574
4577
#FAU:MIDIPLAY: added support for playback for Mac with SMF player For now kept apart from Windows
4575
4578
#FAU:MIDIPLAY: %%TODO%% verify if can be merged with preceeding if
4576
- elif wx .Platform == "__WXMAC__" :
4577
- self .mc .Play ()
4579
+ #FAU:MIDIPLAY: 20250125 Not needed as correctly started based on OnMediaLoaded
4580
+ #elif wx.Platform == "__WXMAC__":
4581
+ # self.mc.Play()
4578
4582
#FAU:MIDIPLAY: Start timer to be able to have progress bar updated
4579
- self .play_timer .Start (20 )
4580
- self .play_button .SetBitmap (self .pause_bitmap )
4583
+ # self.play_timer.Start(20)
4584
+ # self.play_button.SetBitmap(self.pause_bitmap)
4581
4585
else :
4582
4586
wx .MessageBox (_ ("Unable to load %s: Unsupported format?" ) % path ,
4583
4587
_ ("Error" ), wx .ICON_ERROR | wx .OK )
@@ -4588,7 +4592,7 @@ def play():
4588
4592
# time.sleep(0.3) # 1.3.6.4 [JWDJ] on Mac the first note is skipped the first time. hope this helps
4589
4593
# self.mc.Seek(self.play_start_offset, wx.FromStart)
4590
4594
self .play_button .SetBitmap (self .pause_bitmap )
4591
- self .progress_slider .SetRange (0 , self .mc .Length ())
4595
+ self .progress_slider .SetRange (0 , int ( self .mc .Length ())) #FAU:MIDIPLAY: mplay might return a float. thus forcing an int
4592
4596
self .progress_slider .SetValue (0 )
4593
4597
self .OnBpmSlider (None )
4594
4598
self .update_playback_rate ()
@@ -4600,10 +4604,16 @@ def play():
4600
4604
wx .CallAfter (play )
4601
4605
4602
4606
def OnAfterStop (self ):
4607
+ self .set_loop_midi_playback (False )
4603
4608
# 1.3.6.3 [SS] 2015-05-04
4604
4609
self .stop_playing ()
4605
- self .reset_BpmSlider ()
4606
- self .flip_tempobox (False )
4610
+ #FAU preserve latest bpm choice
4611
+ #self.reset_BpmSlider()
4612
+ #FAU20250125: Do not hide it if supported
4613
+ if self .settings ['midiplayer_path' ]:
4614
+ self .flip_tempobox (False )
4615
+ if wx .Platform != "__WXMSW__" :
4616
+ self .toolbar .Realize () # 1.3.6.4 [JWDJ] fixes toolbar repaint bug for Windows
4607
4617
4608
4618
def OnToolRecord (self , evt ):
4609
4619
if self .record_thread and self .record_thread .is_running :
@@ -4622,22 +4632,24 @@ def OnToolRecord(self, evt):
4622
4632
self .record_thread .start ()
4623
4633
4624
4634
def OnToolStop (self , evt ):
4625
- self .set_loop_midi_playback (False )
4626
- self .stop_playing ()
4635
+ #FAU 20250125: Cleaning, trying to centralised what is common to Stop avoiding of mon to Stop instead of multiple call
4636
+ self .OnAfterStop ()
4637
+ #self.set_loop_midi_playback(False)
4638
+ #self.stop_playing()
4627
4639
# 1.3.6.3 [SS] 2015-04-03
4628
4640
#self.play_panel.Show(False)
4629
- self .flip_tempobox (False )
4630
- self .progress_slider .SetValue (0 )
4641
+ # self.flip_tempobox(False)
4642
+ # self.progress_slider.SetValue(0)
4631
4643
# self.reset_BpmSlider() #[EPO] 2018-11-20 make sticky - this is new functionality
4632
- if wx .Platform != "__WXMSW__" :
4633
- self .toolbar .Realize () # 1.3.6.4 [JWDJ] fixes toolbar repaint bug for Windows
4644
+ # if wx.Platform != "__WXMSW__":
4645
+ # self.toolbar.Realize() # 1.3.6.4 [JWDJ] fixes toolbar repaint bug for Windows
4634
4646
if self .record_thread and self .record_thread .is_running :
4635
4647
self .OnToolRecord (None )
4636
- if self .uses_fluidsynth :
4637
- self .OnAfterStop ()
4648
+ # if self.uses_fluidsynth:
4649
+ # self.OnAfterStop()
4638
4650
4639
4651
def OnSeek (self , evt ):
4640
- self .mc .Seek (self .progress_slider .GetValue ()) #FAU:MIDIPLAY: %%TODO%% verify on Mac if strange behavior still present
4652
+ self .mc .Seek (self .progress_slider .GetValue ())
4641
4653
4642
4654
def OnZoomSlider (self , evt ):
4643
4655
old_factor = self .zoom_factor
@@ -4660,26 +4672,28 @@ def OnPlayTimer(self, evt):
4660
4672
4661
4673
if wx .Platform == "__WXMAC__" : #FAU:MIDIPLAY: Used to give the hand to MIDI player
4662
4674
delta = self .mc .IdlePlay ()
4675
+ #print(self.mc.get_songinfo)
4663
4676
if delta == 0 :
4664
4677
if self .loop_midi_playback :
4665
4678
self .mc .Seek (0 )
4666
4679
else :
4667
- self .stop_playing ()
4668
-
4680
+ self .mc . is_play_started = False
4681
+
4669
4682
offset = self .mc .Tell ()
4670
4683
if offset >= self .progress_slider .Max :
4671
4684
length = self .mc .Length ()
4672
4685
self .progress_slider .SetRange (0 , int (length )) #FAU:MIDIPLAY: mplay might return a float. thus forcing an int
4673
-
4686
+
4674
4687
if self .settings .get ('follow_score' , False ):
4675
4688
self .queue_number_follow_score += 1
4676
4689
queue_number = self .queue_number_follow_score
4677
- wx .CallLater (1 , self .FollowScore , offset , queue_number ) #[EPO] 2018-11-20 first arg 0 causes exception
4678
-
4690
+ #wx.CallLater(1, self.FollowScore, offset, queue_number) #[EPO] 2018-11-20 first arg 0 causes exception
4691
+ self .FollowScore (offset , queue_number )
4692
+
4679
4693
self .progress_slider .SetValue (offset )
4680
- elif self .started_playing and self . uses_fluidsynth and not self .mc .is_paused :
4694
+ elif self .started_playing and not self .mc .is_paused : #and self.uses_fluidsynth
4681
4695
self .started_playing = False
4682
- self . OnToolStop ( None )
4696
+ wx . CallLater ( 500 , self . OnAfterStop )
4683
4697
4684
4698
def FollowScore (self , offset , queue_number ):
4685
4699
if self .queue_number_follow_score != queue_number :
0 commit comments