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;
|
bool done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
double row = bass_get_row(stream);
|
double row = bass_get_row(stream);
|
||||||
sync_update(rocket, row);
|
sync_update(rocket, (int)floor(row));
|
||||||
|
|
||||||
/* draw */
|
/* draw */
|
||||||
|
|
||||||
|
|||||||
@ -234,7 +234,7 @@ static int purge_and_rerequest(struct sync_device *d)
|
|||||||
return 0;
|
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) {
|
if (d->sock == INVALID_SOCKET) {
|
||||||
d->sock = server_connect(REMOTE_HOST, REMOTE_PORT);
|
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)) {
|
if (d->cb && d->cb->is_playing && d->cb->is_playing(d->cb_param)) {
|
||||||
int nrow = (int)floor(row);
|
if (d->row != row && d->sock != INVALID_SOCKET) {
|
||||||
if (d->row != nrow && d->sock != INVALID_SOCKET) {
|
|
||||||
unsigned char cmd = SET_ROW;
|
unsigned char cmd = SET_ROW;
|
||||||
int ret = send(d->sock, (char*)&cmd, 1, 0);
|
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)
|
if (ret != sizeof(int) + 1)
|
||||||
goto sockerr;
|
goto sockerr;
|
||||||
d->row = nrow;
|
d->row = row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ struct sync_cb {
|
|||||||
void sync_set_callbacks(struct sync_device *, struct sync_cb *, void *);
|
void sync_set_callbacks(struct sync_device *, struct sync_cb *, void *);
|
||||||
#endif /* !defined(SYNC_PLAYER) */
|
#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 *);
|
const struct sync_track *sync_get_track(struct sync_device *, const char *);
|
||||||
float sync_get_val(const struct sync_track *, double);
|
float sync_get_val(const struct sync_track *, double);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user