Skip to content

Commit

Permalink
Fixed AppleMIDI interaction with remote connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Kelly committed May 18, 2019
1 parent 644766a commit af84b1f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion raveloxmidi/include/net_response.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ net_response_t * net_response_create( void );
void net_response_destroy( net_response_t **response );

net_response_t *net_response_inv( uint32_t ssrc, uint32_t initiator, char *name);
net_response_t *net_response_sync( uint32_t send_ssrc );
net_response_t *net_response_sync( uint32_t send_ssrc , long start_time);

#endif
2 changes: 1 addition & 1 deletion raveloxmidi/src/applemidi_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ net_response_t * applemidi_ok_responder( char *ip_address, uint16_t port, void *
ctx->status = NET_CTX_STATUS_SECOND_INV;
break;
case NET_CTX_STATUS_SECOND_INV:
response = net_response_sync( ctx->send_ssrc );
response = net_response_sync( ctx->send_ssrc , ctx->start );
net_ctx_send( ctx, response->buffer, response->len, USE_CONTROL_PORT );
hex_dump( response->buffer, response->len );
net_response_destroy( &response );
Expand Down
2 changes: 1 addition & 1 deletion raveloxmidi/src/net_applemidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ net_applemidi_sync * net_applemidi_sync_create( void )

if( sync )
{
memset( sync, 0 , sizeof( net_applemidi_sync ) );
memset( sync, 0, sizeof( net_applemidi_sync ) );
}

return sync;
Expand Down
8 changes: 4 additions & 4 deletions raveloxmidi/src/net_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ net_response_t *net_response_inv( uint32_t ssrc, uint32_t initiator, char *name
return NULL;
}

net_response_t *net_response_sync( uint32_t send_ssrc )
net_response_t *net_response_sync( uint32_t send_ssrc , long start_time )
{
net_applemidi_sync *sync = NULL;
net_response_t *response = NULL;
Expand All @@ -140,9 +140,9 @@ net_response_t *net_response_sync( uint32_t send_ssrc )

sync->ssrc = send_ssrc;
sync->count = 0;
sync->timestamp1 = time(NULL);
sync->timestamp2 = 0;
sync->timestamp3 = 0;
sync->timestamp1 = time_in_microseconds() - start_time;
sync->timestamp2 = random_number();
sync->timestamp3 = random_number();

cmd = net_applemidi_cmd_create( NET_APPLEMIDI_CMD_SYNC );

Expand Down
2 changes: 1 addition & 1 deletion raveloxmidi/src/remote_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static void *remote_connect_sync_thread( void *data )
logging_printf(LOGGING_DEBUG, "remote_connect_sync_thread: shutdown received during poll\n");
break;
}
response = net_response_sync( ctx->send_ssrc );
response = net_response_sync( ctx->send_ssrc , ctx->start );
net_ctx_send( ctx, response->buffer, response->len, USE_CONTROL_PORT );
hex_dump( response->buffer, response->len );
net_response_destroy( &response );
Expand Down

0 comments on commit af84b1f

Please sign in to comment.