[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Reopen libao device handles when audio parameters change.
From: |
Andrei Kholodnyi |
Subject: |
[PATCH] Reopen libao device handles when audio parameters change. |
Date: |
Tue, 31 Aug 2010 22:49:19 +0200 |
Hi Chris,
here are my comments.
> +int current_bits = -1;
> +int current_channels = -1;
> +int current_rate = -1;
static int?
probably we even could use ao_sample_format instead?
> +static void libao_open_handle(int rate, int channels, int bits)
> +{
> + ?ao_sample_format format = AO_FORMAT_INITIALIZER;
> +
> + ?format.channels = channels;
> + ?format.rate = rate;
> + ?format.bits = bits;
> + ?format.byte_format = AO_FMT_NATIVE;
> + ?device = ao_open_live (default_driver, &format, NULL);
> +
> + ?if (device != NULL)
> + ? ?{
> + ? ? ?current_rate = rate;
> + ? ? ?current_channels = channels;
> + ? ? ?current_bits = bits;
> + ? ?}
> +}
> +static void libao_close_handle(void)
> +{
> + ?ao_close(device);
> + ?device = NULL;
> +}
I'm wondering why do you need these 2 functions?
they are called only once (ok, close called twice :D) and contain
nothing but ao_open and ao_close?
You called your function libao_open_handle, but in really it does more
then just open, it also keeps track on current format.
Andrei.