【问题标题】:CoreMidi parse MIDI Song PositionCoreMidi 解析 MIDI 歌曲位置
【发布时间】:2012-08-25 22:47:35
【问题描述】:

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

bars:beats:divisions:ticks

我有以下代码:

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 并没有看到其他东西。

【问题讨论】:

    标签: position midi coremidi


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多