|
1
|
1 #import "stdafx.h"
|
|
|
2 #import "fooSampleDSPView.h"
|
|
|
3 #import "dsp_sample.h"
|
|
|
4
|
|
|
5 @interface fooSampleDSPView ()
|
|
|
6 @property (nonatomic) dsp_preset_edit_callback_v2::ptr callback;
|
|
|
7 @property (nonatomic) NSNumber * gain;
|
|
|
8 @end
|
|
|
9
|
|
|
10 @implementation fooSampleDSPView
|
|
|
11
|
|
|
12 - (instancetype)init {
|
|
|
13 // IMPORTANT: feed OUR NSBundle, bundleForClass works well for this
|
|
|
14 return [self initWithNibName: @"fooSampleDSPView" bundle:[NSBundle bundleForClass: [self class]]];
|
|
|
15 }
|
|
|
16
|
|
|
17 - (void)viewDidLoad {
|
|
|
18 [super viewDidLoad];
|
|
|
19 // Do view setup here.
|
|
|
20
|
|
|
21 dsp_preset_impl preset;
|
|
|
22 _callback->get_preset(preset);
|
|
|
23 self.gain = [NSNumber numberWithFloat: parse_preset(preset)];
|
|
|
24 }
|
|
|
25
|
|
|
26 - (IBAction)onEdit:(id)sender {
|
|
|
27 [self apply];
|
|
|
28 }
|
|
|
29
|
|
|
30 - (void) apply {
|
|
|
31 dsp_preset_impl preset;
|
|
|
32 make_preset( self.gain.floatValue , preset);
|
|
|
33 _callback->set_preset( preset );
|
|
|
34 }
|
|
|
35 @end
|
|
|
36
|
|
|
37 service_ptr ConfigureSampleDSP( fb2k::hwnd_t parent, dsp_preset_edit_callback_v2::ptr callback ) {
|
|
|
38 fooSampleDSPView * dialog = [fooSampleDSPView new];
|
|
|
39 dialog.callback = callback;
|
|
|
40 return fb2k::wrapNSObject( dialog );
|
|
|
41 }
|