player: pass row as integer to sync_update
There's no point in passing the row as a double to sync_update, which only cares about the integer-part.
This commit is contained in:
parent
99e2489e89
commit
2a44eff473
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
double row = bass_get_row(stream);
|
||||
sync_update(rocket, row);
|
||||
sync_update(rocket, (int)floor(row));
|
||||
|
||||
/* draw */
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ static int purge_and_rerequest(struct sync_device *d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sync_update(struct sync_device *d, double row)
|
||||
void sync_update(struct sync_device *d, int row)
|
||||
{
|
||||
if (d->sock == INVALID_SOCKET) {
|
||||
d->sock = server_connect(REMOTE_HOST, REMOTE_PORT);
|
||||
@ -280,14 +280,13 @@ void sync_update(struct sync_device *d, double row)
|
||||
}
|
||||
|
||||
if (d->cb && d->cb->is_playing && d->cb->is_playing(d->cb_param)) {
|
||||
int nrow = (int)floor(row);
|
||||
if (d->row != nrow && d->sock != INVALID_SOCKET) {
|
||||
if (d->row != row && d->sock != INVALID_SOCKET) {
|
||||
unsigned char cmd = SET_ROW;
|
||||
int ret = send(d->sock, (char*)&cmd, 1, 0);
|
||||
ret += send(d->sock, (char*)&nrow, sizeof(int), 0);
|
||||
ret += send(d->sock, (char*)&row, sizeof(int), 0);
|
||||
if (ret != sizeof(int) + 1)
|
||||
goto sockerr;
|
||||
d->row = nrow;
|
||||
d->row = row;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@ -24,7 +24,7 @@ struct sync_cb {
|
||||
void sync_set_callbacks(struct sync_device *, struct sync_cb *, void *);
|
||||
#endif /* !defined(SYNC_PLAYER) */
|
||||
|
||||
void sync_update(struct sync_device *, double);
|
||||
void sync_update(struct sync_device *, int);
|
||||
const struct sync_track *sync_get_track(struct sync_device *, const char *);
|
||||
float sync_get_val(const struct sync_track *, double);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user