@@ -104,10 +104,13 @@ pub(crate) fn make_actuate_gui(instance: &mut Actuate, _async_executor: AsyncExe
104104 let browse_preset_active: Arc < AtomicBool > = Arc :: clone ( & instance. browsing_presets ) ;
105105 let import_preset_active: Arc < AtomicBool > = Arc :: clone ( & instance. importing_presets ) ;
106106 let export_preset_active: Arc < AtomicBool > = Arc :: clone ( & instance. exporting_presets ) ;
107+ let export_last_sound: Arc < AtomicBool > = Arc :: clone ( & instance. export_last_sound ) ;
107108 let safety_clip_output: Arc < Mutex < bool > > = Arc :: clone ( & instance. safety_clip_output ) ;
109+ let hq_mode: Arc < AtomicBool > = Arc :: clone ( & instance. hq_mode ) ;
108110 let AM1 : Arc < Mutex < AudioModule > > = Arc :: clone ( & instance. audio_module_1 ) ;
109111 let AM2 : Arc < Mutex < AudioModule > > = Arc :: clone ( & instance. audio_module_2 ) ;
110112 let AM3 : Arc < Mutex < AudioModule > > = Arc :: clone ( & instance. audio_module_3 ) ;
113+ let recorder: Arc < Mutex < crate :: recorder:: Recorder > > = Arc :: clone ( & instance. recorder ) ;
111114
112115 let update_current_preset: Arc < AtomicBool > = Arc :: clone ( & instance. update_current_preset ) ;
113116 let filter_select_outside: Arc < Mutex < UIBottomSelection > > =
@@ -175,6 +178,10 @@ pub(crate) fn make_actuate_gui(instance: &mut Actuate, _async_executor: AsyncExe
175178 let ext = Some ( OsStr :: new ( "actuate" ) ) ;
176179 move |path : & Path | -> bool { path. extension ( ) == ext }
177180 } ) ;
181+ let export_filter = Box :: new ( {
182+ let ext = Some ( OsStr :: new ( "wav" ) ) ;
183+ move |path : & Path | -> bool { path. extension ( ) == ext }
184+ } ) ;
178185 let sample_filter = Box :: new ( {
179186 let ext = Some ( OsStr :: new ( "wav" ) ) ;
180187 move |path : & Path | -> bool { path. extension ( ) == ext }
@@ -218,6 +225,25 @@ pub(crate) fn make_actuate_gui(instance: &mut Actuate, _async_executor: AsyncExe
218225 }
219226 )
220227 ) ;
228+ let export_wav_dialog_main: Arc < Mutex < FileDialog > > = Arc :: new (
229+ Mutex :: new (
230+ if PathBuf :: from ( ( * default_dir. lock ( ) . unwrap ( ) . clone ( ) ) . to_string ( ) ) . exists ( ) {
231+ FileDialog :: save_file ( Some ( PathBuf :: from ( ( * default_dir. lock ( ) . unwrap ( ) . clone ( ) ) . to_string ( ) ) ) )
232+ //.current_pos([(WIDTH/4) as f32, 10.0])
233+ . show_files_filter ( export_filter)
234+ . keep_on_top ( true )
235+ . show_new_folder ( false )
236+ . show_rename ( false )
237+ } else {
238+ FileDialog :: save_file ( Some ( home_dir. clone ( ) ) )
239+ //.current_pos([(WIDTH/4) as f32, 10.0])
240+ . show_files_filter ( export_filter)
241+ . keep_on_top ( true )
242+ . show_new_folder ( false )
243+ . show_rename ( false )
244+ }
245+ )
246+ ) ;
221247
222248 let load_sample_dialog: Arc < Mutex < FileDialog > > = Arc :: new (
223249 Mutex :: new (
@@ -348,6 +374,8 @@ pub(crate) fn make_actuate_gui(instance: &mut Actuate, _async_executor: AsyncExe
348374 }
349375 if params. filter_cutoff_link . value ( ) {
350376 setter. set_parameter ( & params. filter_cutoff_2 , params. filter_cutoff . value ( ) ) ;
377+ // This is set again here so it doesn't mess up FL Automation when linked after modifying
378+ setter. set_parameter ( & params. filter_cutoff , params. filter_cutoff . value ( ) ) ;
351379 }
352380
353381 // Assign default colors
@@ -992,8 +1020,8 @@ pub(crate) fn make_actuate_gui(instance: &mut Actuate, _async_executor: AsyncExe
9921020 export_preset_active. store ( true , Ordering :: SeqCst ) ;
9931021 }
9941022 if export_preset_active. load ( Ordering :: SeqCst ) {
995- let save_dialock = save_dialog_main . clone ( ) ;
996- let mut save_dialog = save_dialock . lock ( ) . unwrap ( ) ;
1023+ let export_dialock = export_wav_dialog_main . clone ( ) ;
1024+ let mut save_dialog = export_dialock . lock ( ) . unwrap ( ) ;
9971025 save_dialog. open ( ) ;
9981026 let mut dvar = Some ( save_dialog) ;
9991027 if let Some ( s_dialog) = & mut dvar {
@@ -1016,6 +1044,42 @@ pub(crate) fn make_actuate_gui(instance: &mut Actuate, _async_executor: AsyncExe
10161044 }
10171045 }
10181046 ui. checkbox ( & mut safety_clip_output. lock ( ) . unwrap ( ) , "Safety Clip" ) . on_hover_text ( "Clip the output at 0dB to save your ears/speakers" ) ;
1047+ let hq_check = slim_checkbox:: AtomicSlimCheckbox :: new ( & hq_mode, "HQ Rendering" ) ;
1048+ ui. add ( hq_check) ;
1049+ let export_last_note_button = ui. button ( RichText :: new ( "Export Last Note" )
1050+ . font ( SMALLER_FONT )
1051+ . background_color ( DARK_GREY_UI_COLOR )
1052+ . color ( TEAL_GREEN )
1053+ ) ;
1054+ if export_last_note_button. clicked ( ) {
1055+ export_last_sound. store ( true , Ordering :: SeqCst ) ;
1056+ }
1057+ if export_last_sound. load ( Ordering :: SeqCst ) {
1058+ let save_dialock = save_dialog_main. clone ( ) ;
1059+ let mut save_dialog = save_dialock. lock ( ) . unwrap ( ) ;
1060+ save_dialog. open ( ) ;
1061+ let mut dvar = Some ( save_dialog) ;
1062+ if let Some ( s_dialog) = & mut dvar {
1063+ if s_dialog. show ( egui_ctx) . selected ( ) {
1064+ if let Some ( file) = s_dialog. path ( ) {
1065+ let saved_file = Some ( file. to_path_buf ( ) ) ;
1066+ let mut str_path = saved_file. unwrap_or_default ( ) . as_path ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
1067+ if !str_path. contains ( ".wav" ) {
1068+ str_path = str_path + ".wav"
1069+ }
1070+ let _ = recorder. lock ( ) . unwrap ( ) . export ( & str_path) ;
1071+ export_last_sound. store ( false , Ordering :: SeqCst ) ;
1072+ }
1073+ }
1074+
1075+ match s_dialog. state ( ) {
1076+ State :: Cancelled | State :: Closed => {
1077+ export_last_sound. store ( false , Ordering :: SeqCst ) ;
1078+ } ,
1079+ _ => { }
1080+ }
1081+ }
1082+ }
10191083 } ) ;
10201084 const KNOB_SIZE : f32 = 28.0 ;
10211085 const TEXT_SIZE : f32 = 11.0 ;
0 commit comments