1

我正在尝试解析收到的 midi 值并以以下格式显示它:

酒吧:节拍:部门:滴答声

我有以下代码:

unsigned short CombineBytes(unsigned char First, unsigned char Second) 
{ 
    unsigned short _14bit;

    _14bit = (unsigned short)Second; 
    _14bit<<=7; 
    _14bit|=(unsigned short)First; 
    return(_14bit); 
}

-(void) midiSource:(PGMidiSource *)input midiReceived:(const MIDIPacketList *)packetList{

    const MIDIPacket *packet = &packetList->packet[0];
    for (int i = 0; i < packetList->numPackets; ++i)
    {

        Byte statusByte = packet->data[0];
        Byte status = statusByte >= 0xf0 ? statusByte : statusByte >> 4 << 4;

        if (status == 0xF2){

            NSLog(@"%i", CombineBytes(packet->data[1], packet->data[2]));
        }
    }
}

基本上,当 Logic Pro 或 Ableton Live 发送歌曲位置信号时,我会收到 404、405 等值...

例如:404= 026:02:01 其中 026 = 小节,02= 节拍,01 - 分度。这部分对我来说很清楚......

但是怎么买票呢?这就是问题所在,这要么是我不明白的事情。或者应该是不同的midi信号。但我看了看 Midi Monitor 并没有看到其他东西。

4

1 回答 1

0

根据 MIDI 标准,1 个节拍 = 6 个时钟。后者通过定时时钟消息(0xF8)发送。

于 2014-03-29T10:40:23.960 回答