rename 'Timer' to 'struct timer'
This commit is contained in:
parent
4428894aba
commit
310895f060
|
@ -102,7 +102,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
|
||||||
fluid_player_t *player;
|
fluid_player_t *player;
|
||||||
char *path_dup;
|
char *path_dup;
|
||||||
int ret;
|
int ret;
|
||||||
Timer *timer;
|
struct timer *timer;
|
||||||
enum decoder_command cmd;
|
enum decoder_command cmd;
|
||||||
|
|
||||||
soundfont_path =
|
soundfont_path =
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct fifo_data {
|
||||||
int input;
|
int input;
|
||||||
int output;
|
int output;
|
||||||
bool created;
|
bool created;
|
||||||
Timer *timer;
|
struct timer *timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,10 +65,10 @@ struct httpd_output {
|
||||||
GMutex *mutex;
|
GMutex *mutex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A #Timer object to synchronize this output with the
|
* A #timer object to synchronize this output with the
|
||||||
* wallclock.
|
* wallclock.
|
||||||
*/
|
*/
|
||||||
Timer *timer;
|
struct timer *timer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The listener socket.
|
* The listener socket.
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
struct null_data {
|
struct null_data {
|
||||||
bool sync;
|
bool sync;
|
||||||
|
|
||||||
Timer *timer;
|
struct timer *timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -82,7 +82,7 @@ null_play(void *data, G_GNUC_UNUSED const void *chunk, size_t size,
|
||||||
G_GNUC_UNUSED GError **error)
|
G_GNUC_UNUSED GError **error)
|
||||||
{
|
{
|
||||||
struct null_data *nd = data;
|
struct null_data *nd = data;
|
||||||
Timer *timer = nd->timer;
|
struct timer *timer = nd->timer;
|
||||||
|
|
||||||
if (!nd->sync)
|
if (!nd->sync)
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct openal_data {
|
||||||
const char *device_name;
|
const char *device_name;
|
||||||
ALCdevice *device;
|
ALCdevice *device;
|
||||||
ALCcontext *context;
|
ALCcontext *context;
|
||||||
Timer *timer;
|
struct timer *timer;
|
||||||
ALuint buffers[NUM_BUFFERS];
|
ALuint buffers[NUM_BUFFERS];
|
||||||
int filled;
|
int filled;
|
||||||
ALuint source;
|
ALuint source;
|
||||||
|
|
16
src/timer.c
16
src/timer.c
|
@ -37,9 +37,9 @@ static uint64_t now(void)
|
||||||
return ((uint64_t)tv.tv_sec * 1000000) + tv.tv_usec;
|
return ((uint64_t)tv.tv_sec * 1000000) + tv.tv_usec;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer *timer_new(const struct audio_format *af)
|
struct timer *timer_new(const struct audio_format *af)
|
||||||
{
|
{
|
||||||
Timer *timer = g_new(Timer, 1);
|
struct timer *timer = g_new(struct timer, 1);
|
||||||
timer->time = 0;
|
timer->time = 0;
|
||||||
timer->started = 0;
|
timer->started = 0;
|
||||||
timer->rate = af->sample_rate * audio_format_frame_size(af);
|
timer->rate = af->sample_rate * audio_format_frame_size(af);
|
||||||
|
@ -47,24 +47,24 @@ Timer *timer_new(const struct audio_format *af)
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_free(Timer *timer)
|
void timer_free(struct timer *timer)
|
||||||
{
|
{
|
||||||
g_free(timer);
|
g_free(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_start(Timer *timer)
|
void timer_start(struct timer *timer)
|
||||||
{
|
{
|
||||||
timer->time = now();
|
timer->time = now();
|
||||||
timer->started = 1;
|
timer->started = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_reset(Timer *timer)
|
void timer_reset(struct timer *timer)
|
||||||
{
|
{
|
||||||
timer->time = 0;
|
timer->time = 0;
|
||||||
timer->started = 0;
|
timer->started = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_add(Timer *timer, int size)
|
void timer_add(struct timer *timer, int size)
|
||||||
{
|
{
|
||||||
assert(timer->started);
|
assert(timer->started);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ void timer_add(Timer *timer, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
timer_delay(const Timer *timer)
|
timer_delay(const struct timer *timer)
|
||||||
{
|
{
|
||||||
int64_t delay = (int64_t)(timer->time - now()) / 1000;
|
int64_t delay = (int64_t)(timer->time - now()) / 1000;
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
|
@ -84,7 +84,7 @@ timer_delay(const Timer *timer)
|
||||||
return delay / 1000;
|
return delay / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_sync(Timer *timer)
|
void timer_sync(struct timer *timer)
|
||||||
{
|
{
|
||||||
int64_t sleep_duration;
|
int64_t sleep_duration;
|
||||||
|
|
||||||
|
|
18
src/timer.h
18
src/timer.h
|
@ -24,28 +24,28 @@
|
||||||
|
|
||||||
struct audio_format;
|
struct audio_format;
|
||||||
|
|
||||||
typedef struct _Timer {
|
struct timer {
|
||||||
uint64_t time;
|
uint64_t time;
|
||||||
int started;
|
int started;
|
||||||
int rate;
|
int rate;
|
||||||
} Timer;
|
};
|
||||||
|
|
||||||
Timer *timer_new(const struct audio_format *af);
|
struct timer *timer_new(const struct audio_format *af);
|
||||||
|
|
||||||
void timer_free(Timer *timer);
|
void timer_free(struct timer *timer);
|
||||||
|
|
||||||
void timer_start(Timer *timer);
|
void timer_start(struct timer *timer);
|
||||||
|
|
||||||
void timer_reset(Timer *timer);
|
void timer_reset(struct timer *timer);
|
||||||
|
|
||||||
void timer_add(Timer *timer, int size);
|
void timer_add(struct timer *timer, int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds to sleep to get back to sync.
|
* Returns the number of milliseconds to sleep to get back to sync.
|
||||||
*/
|
*/
|
||||||
unsigned
|
unsigned
|
||||||
timer_delay(const Timer *timer);
|
timer_delay(const struct timer *timer);
|
||||||
|
|
||||||
void timer_sync(Timer *timer);
|
void timer_sync(struct timer *timer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue