Lines 53-58
Link Here
|
53 |
|
53 |
|
54 |
static int broken_pause; |
54 |
static int broken_pause; |
55 |
|
55 |
|
|
|
56 |
static size_t bytes_per_sample; |
57 |
|
56 |
LIBAO_EXTERN(pulse) |
58 |
LIBAO_EXTERN(pulse) |
57 |
|
59 |
|
58 |
#define GENERIC_ERR_MSG(ctx, str) \ |
60 |
#define GENERIC_ERR_MSG(ctx, str) \ |
Lines 201-206
Link Here
|
201 |
} |
203 |
} |
202 |
|
204 |
|
203 |
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA); |
205 |
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA); |
|
|
206 |
bytes_per_sample = af_fmt2bits(ao_data.format) / 8; |
207 |
bytes_per_sample *= ao_data.channels; |
204 |
ao_data.bps = pa_bytes_per_second(&ss); |
208 |
ao_data.bps = pa_bytes_per_second(&ss); |
205 |
|
209 |
|
206 |
if (!(mainloop = pa_threaded_mainloop_new())) { |
210 |
if (!(mainloop = pa_threaded_mainloop_new())) { |
Lines 297-302
Link Here
|
297 |
|
301 |
|
298 |
/** Play the specified data to the pulseaudio server */ |
302 |
/** Play the specified data to the pulseaudio server */ |
299 |
static int play(void* data, int len, int flags) { |
303 |
static int play(void* data, int len, int flags) { |
|
|
304 |
//Align length to frame size |
305 |
len=len - (len % bytes_per_sample); |
306 |
if (len==0) { |
307 |
return 0; |
308 |
} |
300 |
pa_threaded_mainloop_lock(mainloop); |
309 |
pa_threaded_mainloop_lock(mainloop); |
301 |
if (pa_stream_write(stream, data, len, NULL, 0, PA_SEEK_RELATIVE) < 0) { |
310 |
if (pa_stream_write(stream, data, len, NULL, 0, PA_SEEK_RELATIVE) < 0) { |
302 |
GENERIC_ERR_MSG(context, "pa_stream_write() failed"); |
311 |
GENERIC_ERR_MSG(context, "pa_stream_write() failed"); |