我正在IRTcmix(iphone / ipad的RTcmix版本)中构建一个简单的步进音序器,使用UI按钮控制序列中打开或关闭的音符。
我一直在处理其他应用程序的一组RTcmix示例,并尝试将自己拼凑在一起,但我不确定如何使用切换样式更改.sco(得分文件)中变量的值的UIButton。
以下是来自正在使用的RTcmix应用程序的一些代码:
来自RTcmix经理.h:
@interface RTcmixManager : RTcmixPlayer {
RTcmixScore *polyScore;
}
@property (nonatomic, retain) RTcmixScore *polyScore;
- (void)noteOn:(int)note;
- (void)noteOff:(int)note;
@end
和RTcmix经理.m
- (void)noteOn:(int)note {
[polyScore.mainScoreParameters replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:note]];
[polyScore.mainScoreParameters replaceObjectAtIndex:1 withObject:[NSNumber numberWithInt:1]];
[self parseScoreWithRTcmixScore:polyScore];
polyScore.setupIsActive = YES;
}
- (void)noteOff:(int)note {
[polyScore.mainScoreParameters replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:note]];
[polyScore.mainScoreParameters replaceObjectAtIndex:1 withObject:[NSNumber numberWithInt:0]];
[self parseScoreWithRTcmixScore:polyScore];
}
viewcontroller .h:
@interface RTPolyphonyViewController : UIViewController {
RTcmixManager *rtcmixManager;
}
- (IBAction)keyDown:(UIButton *)sender;
- (IBAction)keyUp:(UIButton *)sender;
@end
viewcontroller .m:
- (IBAction)keyDown:(UIButton *)sender {
[rtcmixManager noteOn:sender.tag];
}
- (IBAction)keyUp:(UIButton *)sender {
[rtcmixManager noteOff:sender.tag];
}
和.sco文件的片段(“%@”是用户输入更改的变量):
NoteNumber = %@
NoteVelocity = %@
alreadySounding = note_exists(oscNotes[NoteNumber])
MAXMESSAGE(0, alreadySounding)
我对目标C和xcode很新,我想知道如何在分数文件中使用UI按钮切换两个值(像开关一样),例如,当切换时按钮产生NoteNumber的值(在分数文件)设置为1,而当切换为关闭时值为0。因为我是Xcode(和目标C)的初学者,我不确定使按钮能够打开和关闭的正确语法,我也不确定如何将所述按钮与我的.sco文件连接,就像我看一下示例代码一样,我似乎无法弄清楚它们是如何连接的。