Debian Codegraph @

iOS/Csound iOS Swift Examples/Csound iOS SwiftExamples/csound-iOS/classes/bindings/ui/CsoundUI.m

raw
1 /*
2
3 CsoundUI.m:
4
5 Copyright (C) 2014 Steven Yi, Victor Lazzarini, Aurelius Prochazka
6
7 This file is part of Csound iOS Examples.
8
9 The Csound for iOS Library is free software; you can redistribute it
10 and/or modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 Csound is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with Csound; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 02111-1307 USA
23
24 */
25
26 #import "CsoundUI.h"
27
28 #import "CsoundButtonBinding.h"
29 #import "CsoundLabelBinding.h"
30 #import "CsoundMomentaryButtonBinding.h"
31 #import "CsoundSliderBinding.h"
32 #import "CsoundSwitchBinding.h"
33
34 @interface CsoundUI () {
35 CsoundObj *csoundObj;
36 }
37 @end
38
39 @implementation CsoundUI
40
41 - (instancetype)initWithCsoundObj:(CsoundObj *)csound {
42 self = [super init];
43 if (self) {
44 csoundObj = csound;
45 }
46 return self;
47 }
48
49 - (void)addLabel:(UILabel *)uiLabel
50 forChannelName:(NSString *)channelName
51 {
52 CsoundLabelBinding *labelBinding;
53 labelBinding = [[CsoundLabelBinding alloc] initLabel:uiLabel
54 channelName:channelName];
55 if(!_labelPrecision) {
56 _labelPrecision = 8;
57 }
58
59 labelBinding.precision = _labelPrecision;
60
61 [csoundObj addBinding:labelBinding];
62 }
63
64
65 - (void)addButton:(UIButton *)uiButton forChannelName:(NSString *)channelName
66 {
67 CsoundButtonBinding *buttonBinding;
68 buttonBinding = [[CsoundButtonBinding alloc] initButton:uiButton
69 channelName:channelName];
70 [csoundObj addBinding:buttonBinding];
71 }
72
73 - (void)addSlider:(UISlider *)uiSlider forChannelName:(NSString *)channelName
74 {
75 CsoundSliderBinding *sliderBinding;
76 sliderBinding = [[CsoundSliderBinding alloc] initSlider:uiSlider
77 channelName:channelName];
78 [csoundObj addBinding:sliderBinding];
79 }
80
81 - (void)addSwitch:(UISwitch *)uiSwitch forChannelName:(NSString *)channelName
82 {
83 CsoundSwitchBinding *switchBinding;
84 switchBinding = [[CsoundSwitchBinding alloc] initSwitch:uiSwitch
85 channelName:channelName];
86 [csoundObj addBinding:switchBinding];
87 }
88
89 - (void)addMomentaryButton:(UIButton *)uiButton forChannelName:(NSString *)channelName
90 {
91 CsoundMomentaryButtonBinding *momentaryButtonBinding;
92 momentaryButtonBinding = [[CsoundMomentaryButtonBinding alloc] initButton:uiButton
93 channelName:channelName];
94 [csoundObj addBinding:momentaryButtonBinding];
95 }
96
97
98 @end