小编800*_*464的帖子

CoreMidi:将收到的midi消息记录到NSTextField

对不起,我不会说英语(我正在使用谷歌翻译).

我对Xcode很新.我正在尝试编写一个应用程序,可以收听收到的midi消息并将其显示在NSTextField(就像midi监视器).

我使用CoreMidi,我能够将应用程序连接到所需的输入并接收Midi消息(我可以使用它打印NSLog).我怎样才能输出这些消息(我能读到的消息NSLog)NSTextField

我设置了一个属性,@synthesize并在接口生成器中连接了NSTextField,但是从midi回调函数我无法访问它(它表示"未声明").

这里是MyDocument.h中的代码

@property (retain,nonatomic) IBOutlet NSTextField *test_messages;
Run Code Online (Sandbox Code Playgroud)

这里是MyDocument.m中的代码

@synthesize test_messages;

void midiInputCallback (const MIDIPacketList *list, void *procRef, void *srcRef) {   
id POOL = [[NSAutoreleasePool alloc] init];
UInt16 nBytes;
NSString *ric;
const MIDIPacket *packet = &list->packet[0];
for (unsigned int i = 0; i < list->numPackets; i++) {
    nBytes = packet->length;
    UInt16 iByte, size;

    iByte = 0;
    while (iByte < nBytes) {
        size = 0;
        unsigned char …
Run Code Online (Sandbox Code Playgroud)

xcode cocoa coremidi

2
推荐指数
1
解决办法
4783
查看次数

标签 统计

cocoa ×1

coremidi ×1

xcode ×1