mixer: removed mixer_configure(), configure mixer in mixer_new()
Allocate the mixer object when it is configured. Merged mixer_configure() into mixer_new(). mixer_new() was quite useless anyway.
This commit is contained in:
parent
763dd8c1dd
commit
8695b94232
@ -38,11 +38,13 @@ void mixer_finish(struct mixer *mixer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct mixer *
|
struct mixer *
|
||||||
mixer_new(const struct mixer_plugin *plugin)
|
mixer_new(const struct mixer_plugin *plugin, const struct config_param *param)
|
||||||
{
|
{
|
||||||
struct mixer *mixer = g_new(struct mixer, 1);
|
struct mixer *mixer = g_new(struct mixer, 1);
|
||||||
|
|
||||||
mixer_init(mixer, plugin);
|
mixer_init(mixer, plugin);
|
||||||
|
plugin->configure(mixer->data, param);
|
||||||
|
|
||||||
return mixer;
|
return mixer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,12 +55,6 @@ mixer_free(struct mixer *mixer)
|
|||||||
g_free(mixer);
|
g_free(mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mixer_configure(struct mixer *mixer, const struct config_param *param)
|
|
||||||
{
|
|
||||||
assert(mixer != NULL && mixer->plugin != NULL);
|
|
||||||
mixer->plugin->configure(mixer->data, param);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mixer_open(struct mixer *mixer)
|
bool mixer_open(struct mixer *mixer)
|
||||||
{
|
{
|
||||||
assert(mixer != NULL && mixer->plugin != NULL);
|
assert(mixer != NULL && mixer->plugin != NULL);
|
||||||
|
@ -73,12 +73,11 @@ void mixer_init(struct mixer *mixer, const struct mixer_plugin *plugin);
|
|||||||
void mixer_finish(struct mixer *mixer);
|
void mixer_finish(struct mixer *mixer);
|
||||||
|
|
||||||
struct mixer *
|
struct mixer *
|
||||||
mixer_new(const struct mixer_plugin *plugin);
|
mixer_new(const struct mixer_plugin *plugin, const struct config_param *param);
|
||||||
|
|
||||||
void
|
void
|
||||||
mixer_free(struct mixer *mixer);
|
mixer_free(struct mixer *mixer);
|
||||||
|
|
||||||
void mixer_configure(struct mixer *mixer, const struct config_param *param);
|
|
||||||
bool mixer_open(struct mixer *mixer);
|
bool mixer_open(struct mixer *mixer);
|
||||||
bool mixer_control(struct mixer *mixer, int cmd, void *arg);
|
bool mixer_control(struct mixer *mixer, int cmd, void *arg);
|
||||||
void mixer_close(struct mixer *mixer);
|
void mixer_close(struct mixer *mixer);
|
||||||
|
@ -89,9 +89,6 @@ alsa_data_new(void)
|
|||||||
ret->pcm = NULL;
|
ret->pcm = NULL;
|
||||||
ret->writei = snd_pcm_writei;
|
ret->writei = snd_pcm_writei;
|
||||||
|
|
||||||
//use alsa mixer by default
|
|
||||||
ret->mixer = mixer_new(&alsa_mixer);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,10 +143,7 @@ alsa_init(G_GNUC_UNUSED struct audio_output *ao,
|
|||||||
}
|
}
|
||||||
|
|
||||||
alsa_configure(ad, param);
|
alsa_configure(ad, param);
|
||||||
|
ad->mixer = mixer_new(&alsa_mixer, param);
|
||||||
if (param) {
|
|
||||||
mixer_configure(ad->mixer, param);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ad;
|
return ad;
|
||||||
}
|
}
|
||||||
|
@ -278,8 +278,6 @@ static OssData *newOssData(void)
|
|||||||
supportParam(ret, SNDCTL_DSP_CHANNELS, 2);
|
supportParam(ret, SNDCTL_DSP_CHANNELS, 2);
|
||||||
supportParam(ret, SNDCTL_DSP_SAMPLESIZE, 16);
|
supportParam(ret, SNDCTL_DSP_SAMPLESIZE, 16);
|
||||||
|
|
||||||
ret->mixer = mixer_new(&oss_mixer);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,7 +355,7 @@ static void *oss_open_default(const struct config_param *param)
|
|||||||
if (ret[i] == 0) {
|
if (ret[i] == 0) {
|
||||||
OssData *od = newOssData();
|
OssData *od = newOssData();
|
||||||
od->device = default_devices[i];
|
od->device = default_devices[i];
|
||||||
mixer_configure(od->mixer, param);
|
od->mixer = mixer_new(&oss_mixer, param);
|
||||||
return od;
|
return od;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,7 +396,7 @@ oss_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
|
|||||||
if (device != NULL) {
|
if (device != NULL) {
|
||||||
OssData *od = newOssData();
|
OssData *od = newOssData();
|
||||||
od->device = device;
|
od->device = device;
|
||||||
mixer_configure(od->mixer, param);
|
od->mixer = mixer_new(&oss_mixer, param);
|
||||||
return od;
|
return od;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user