使用AudioToolbox AudioUnit samplerUnit

时间:2016-07-15 18:31:21

标签: xcode coremidi

此" Pitch Transposing"测试代码不适用于AudioUnit samplerUnit。 通过MIDI Out向外部声音模块发送相同的MIDI信息,它完美无缺。我错了什么我无法使用" Pitch Bend"对于这种情况。是控制器" 0x06"最终没有在API中实现?

- (void) demoTranspose {

    [at0 setInstrument :0x11 :0x00];

    [at0 midiEvent :0xB0 :0x65 :0x00];
    [at0 midiEvent :0xB0 :0x64 :0x02];

    [at0 midiEvent :0x90 :0x3C :0x7F]; // Note ON
    usleep(1000000);

    [at0 midiEvent :0xB0 :0x06 :0x40+6];  // 40: center, +6 semi tones higher
    usleep(1000000);

    [at0 midiEvent :0xB0 :0x06 :0x40+12];  // 40: center, +12 semi tones higher
    usleep(1000000);

    [at0 midiEvent :0x90 :0x3C :0x00]; // Note OFF

    [at0 midiEvent :0xB0 :0x06 :0x40]; // reset to center

}

- (void) midiEvent :(Byte)statusInfoA :(Byte)param1A :(Byte)param2A {
    MusicDeviceMIDIEvent (self.samplerUnit, statusInfoA, param1A, param2A, 0);
}

0 个答案:

没有答案