내 문제 : 나는 잭 MID 프록시 클라이언트를 구현하고잭 MIDI 클라이언트는 MIDI 메시지를 보낼 것으로 보인다 반복
- 내 MIDI 키보드와 요시미의 음소거 기능을 제어 할 수 있습니다.
So : MIDI 컨트롤러가 내 프록시에 "연결"되어 있고 프록시가 yoshimi의 MIDI 입력에 "연결"되어 있습니다.
코드가 올바르게 작동합니다. 음소거 버튼 메시지가 가로 채고, 데이터 채널이 바뀌고, 요시미가 명령을 무시하고 있습니다.하지만 컨트롤러의 (노트) 버튼 누름/릴리스 이벤트가 이벤트 당 한 번 수신되고 (전달 된 경우에도) 되풀이된다. 예를 들어 컨트롤러의 음표 키를 누르면 요시미가 초당 10 번씩 키를 누르거나 눌렀다는 소리를냅니다.하지만 컨트롤러가 요시미에 직접 연결되어 있으면 모두 소리가납니다.
MIDI 메시지가 process_callback 기능에서 처리 중입니다. 메인 루프 내에서 처리를 시도했지만 결과는 동일합니다.
무엇이 잘못 되었나요?
이 처리 기능 :
int res = 0;
int i,j;
//get events
void* in_port_buf = jack_port_get_buffer(input_port, nframes);
jack_nframes_t n = jack_midi_get_event_count(in_port_buf);
if(n==0)
return 0;
jack_midi_event_t jev;
printf("%i: Data arrived!\n", cnt);
for(i = 0;i<n;i++){
res = jack_midi_event_get(&jev,in_port_buf,i);
if(res == 0){
printf("Got event, %i bytes!\n",jev.size);
for(j=0;j<jev.size;j++)
printf("%i: %i\n",j,jev.buffer[j]);
} else{
printf("ERROR getting event!\n");
return 0;
}
//first button: mute yoshimi volume, port 120, all sound off
if(jev.buffer[0]==176 && jev.buffer[1] == 97){
jev.buffer[1] = 120;
}
//transmit data
cnt++;
void* port_buf = jack_port_get_buffer(output_port, nframes);
jack_midi_clear_buffer(port_buf);
res = jack_midi_event_write(port_buf, jev.time, jev.buffer, jev.size);
if(res == 0)
printf("Data sent!\n");
else
printf("Error: %i\n",res);
}
return 0;