* some style improvements again (ie lower case variables as pointed by Axel)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29238 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2009-02-16 23:05:54 +00:00
parent 79d4b99e40
commit 5076aaf050
11 changed files with 174 additions and 174 deletions
@@ -387,12 +387,12 @@ auich_create_controls_list(multi_dev *multi)
static status_t static status_t
auich_get_mix(auich_dev *card, multi_mix_value_info * MMVI) auich_get_mix(auich_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i, id; int32 i, id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for (i=0; i<MMVI->item_count; i++) { for (i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("auich_get_mix : invalid control id requested : %li\n", id)); PRINT(("auich_get_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -404,22 +404,22 @@ auich_get_mix(auich_dev *card, multi_mix_value_info * MMVI)
float values[2]; float values[2];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
MMVI->values[i].u.gain = values[0]; mmvi->values[i].u.gain = values[0];
else else
MMVI->values[i].u.gain = values[1]; mmvi->values[i].u.gain = values[1];
} }
} }
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) {
float values[1]; float values[1];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
MMVI->values[i].u.enable = (values[0] == 1.0); mmvi->values[i].u.enable = (values[0] == 1.0);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
float values[1]; float values[1];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
MMVI->values[i].u.mux = (int32)values[0]; mmvi->values[i].u.mux = (int32)values[0];
} }
} }
return B_OK; return B_OK;
@@ -427,12 +427,12 @@ auich_get_mix(auich_dev *card, multi_mix_value_info * MMVI)
static status_t static status_t
auich_set_mix(auich_dev *card, multi_mix_value_info * MMVI) auich_set_mix(auich_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i, id; int32 i, id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for (i=0; i<MMVI->item_count; i++) { for (i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("auich_set_mix : invalid control id requested : %li\n", id)); PRINT(("auich_set_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -441,8 +441,8 @@ auich_set_mix(auich_dev *card, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_GAIN) { if (control->mix_control.flags & B_MULTI_MIX_GAIN) {
multi_mixer_control *control2 = NULL; multi_mixer_control *control2 = NULL;
if (i+1<MMVI->item_count) { if (i+1<mmvi->item_count) {
id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("auich_set_mix : invalid control id requested : %li\n", id)); PRINT(("auich_set_mix : invalid control id requested : %li\n", id));
} else { } else {
@@ -458,12 +458,12 @@ auich_set_mix(auich_dev *card, multi_mix_value_info * MMVI)
values[1] = 0.0; values[1] = 0.0;
if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
values[0] = MMVI->values[i].u.gain; values[0] = mmvi->values[i].u.gain;
else else
values[1] = MMVI->values[i].u.gain; values[1] = mmvi->values[i].u.gain;
if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID)
values[1] = MMVI->values[i+1].u.gain; values[1] = mmvi->values[i+1].u.gain;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
@@ -475,14 +475,14 @@ auich_set_mix(auich_dev *card, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) {
float values[1]; float values[1];
values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0; values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
float values[1]; float values[1];
values[0] = (float)MMVI->values[i].u.mux; values[0] = (float)mmvi->values[i].u.mux;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
} }
@@ -491,22 +491,22 @@ auich_set_mix(auich_dev *card, multi_mix_value_info * MMVI)
static status_t static status_t
auich_list_mix_controls(auich_dev *card, multi_mix_control_info * MMCI) auich_list_mix_controls(auich_dev *card, multi_mix_control_info * mmci)
{ {
multi_mix_control *MMC; multi_mix_control *mmc;
int32 i; int32 i;
MMC = MMCI->controls; mmc = mmci->controls;
if (MMCI->control_count < 24) if (mmci->control_count < 24)
return B_ERROR; return B_ERROR;
if (auich_create_controls_list(&card->multi) < B_OK) if (auich_create_controls_list(&card->multi) < B_OK)
return B_ERROR; return B_ERROR;
for (i = 0; i < card->multi.control_count; i++) { for (i = 0; i < card->multi.control_count; i++) {
MMC[i] = card->multi.controls[i].mix_control; mmc[i] = card->multi.controls[i].mix_control;
} }
MMCI->control_count = card->multi.control_count; mmci->control_count = card->multi.control_count;
return B_OK; return B_OK;
} }
@@ -386,12 +386,12 @@ auvia_create_controls_list(multi_dev *multi)
} }
static status_t static status_t
auvia_get_mix(auvia_dev *card, multi_mix_value_info * MMVI) auvia_get_mix(auvia_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i, id; int32 i, id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for(i=0; i<MMVI->item_count; i++) { for(i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
if(id < 0 || id >= card->multi.control_count) { if(id < 0 || id >= card->multi.control_count) {
PRINT(("auvia_get_mix : invalid control id requested : %li\n", id)); PRINT(("auvia_get_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -403,34 +403,34 @@ auvia_get_mix(auvia_dev *card, multi_mix_value_info * MMVI)
float values[2]; float values[2];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
MMVI->values[i].u.gain = values[0]; mmvi->values[i].u.gain = values[0];
else else
MMVI->values[i].u.gain = values[1]; mmvi->values[i].u.gain = values[1];
} }
} }
if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) {
float values[1]; float values[1];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
MMVI->values[i].u.enable = (values[0] == 1.0); mmvi->values[i].u.enable = (values[0] == 1.0);
} }
if(control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { if(control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
float values[1]; float values[1];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
MMVI->values[i].u.mux = (int32)values[0]; mmvi->values[i].u.mux = (int32)values[0];
} }
} }
return B_OK; return B_OK;
} }
static status_t static status_t
auvia_set_mix(auvia_dev *card, multi_mix_value_info * MMVI) auvia_set_mix(auvia_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i, id; int32 i, id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for(i=0; i<MMVI->item_count; i++) { for(i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
if(id < 0 || id >= card->multi.control_count) { if(id < 0 || id >= card->multi.control_count) {
PRINT(("auvia_set_mix : invalid control id requested : %li\n", id)); PRINT(("auvia_set_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -439,8 +439,8 @@ auvia_set_mix(auvia_dev *card, multi_mix_value_info * MMVI)
if(control->mix_control.flags & B_MULTI_MIX_GAIN) { if(control->mix_control.flags & B_MULTI_MIX_GAIN) {
multi_mixer_control *control2 = NULL; multi_mixer_control *control2 = NULL;
if(i+1<MMVI->item_count) { if(i+1<mmvi->item_count) {
id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
if(id < 0 || id >= card->multi.control_count) { if(id < 0 || id >= card->multi.control_count) {
PRINT(("auvia_set_mix : invalid control id requested : %li\n", id)); PRINT(("auvia_set_mix : invalid control id requested : %li\n", id));
} else { } else {
@@ -456,12 +456,12 @@ auvia_set_mix(auvia_dev *card, multi_mix_value_info * MMVI)
values[1] = 0.0; values[1] = 0.0;
if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
values[0] = MMVI->values[i].u.gain; values[0] = mmvi->values[i].u.gain;
else else
values[1] = MMVI->values[i].u.gain; values[1] = mmvi->values[i].u.gain;
if(control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) if(control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID)
values[1] = MMVI->values[i+1].u.gain; values[1] = mmvi->values[i+1].u.gain;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
@@ -473,14 +473,14 @@ auvia_set_mix(auvia_dev *card, multi_mix_value_info * MMVI)
if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) {
float values[1]; float values[1];
values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0; values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
if(control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { if(control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
float values[1]; float values[1];
values[0] = (float)MMVI->values[i].u.mux; values[0] = (float)mmvi->values[i].u.mux;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
} }
@@ -488,22 +488,22 @@ auvia_set_mix(auvia_dev *card, multi_mix_value_info * MMVI)
} }
static status_t static status_t
auvia_list_mix_controls(auvia_dev *card, multi_mix_control_info * MMCI) auvia_list_mix_controls(auvia_dev *card, multi_mix_control_info * mmci)
{ {
multi_mix_control *MMC; multi_mix_control *mmc;
int32 i; int32 i;
MMC = MMCI->controls; mmc = mmci->controls;
if(MMCI->control_count < 24) if(mmci->control_count < 24)
return B_ERROR; return B_ERROR;
if(auvia_create_controls_list(&card->multi) < B_OK) if(auvia_create_controls_list(&card->multi) < B_OK)
return B_ERROR; return B_ERROR;
for(i = 0; i < card->multi.control_count; i++) { for(i = 0; i < card->multi.control_count; i++) {
MMC[i] = card->multi.controls[i].mix_control; mmc[i] = card->multi.controls[i].mix_control;
} }
MMCI->control_count = card->multi.control_count; mmci->control_count = card->multi.control_count;
return B_OK; return B_OK;
} }
@@ -525,19 +525,19 @@ create_controls_list(geode_multi *multi)
static status_t static status_t
list_mix_controls(geode_controller* controller, multi_mix_control_info* MMCI) list_mix_controls(geode_controller* controller, multi_mix_control_info* mmci)
{ {
multi_mix_control* MMC = MMCI->controls; multi_mix_control* mmc = mmci->controls;
if (MMCI->control_count < 24) if (mmci->control_count < 24)
return B_ERROR; return B_ERROR;
if (create_controls_list(controller->multi) < B_OK) if (create_controls_list(controller->multi) < B_OK)
return B_ERROR; return B_ERROR;
for (uint32 i = 0; i < controller->multi->control_count; i++) { for (uint32 i = 0; i < controller->multi->control_count; i++) {
MMC[i] = controller->multi->controls[i].mix_control; mmc[i] = controller->multi->controls[i].mix_control;
} }
MMCI->control_count = controller->multi->control_count; mmci->control_count = controller->multi->control_count;
return B_OK; return B_OK;
} }
@@ -559,10 +559,10 @@ list_mix_channels(geode_controller* controller, multi_mix_channel_info *data)
static status_t static status_t
get_mix(geode_controller *controller, multi_mix_value_info * MMVI) get_mix(geode_controller *controller, multi_mix_value_info * mmvi)
{ {
for (int32 i = 0; i < MMVI->item_count; i++) { for (int32 i = 0; i < mmvi->item_count; i++) {
uint32 id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; uint32 id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= controller->multi->control_count) { if (id < 0 || id >= controller->multi->control_count) {
dprintf("geode_get_mix : invalid control id requested : %li\n", id); dprintf("geode_get_mix : invalid control id requested : %li\n", id);
continue; continue;
@@ -574,22 +574,22 @@ get_mix(geode_controller *controller, multi_mix_value_info * MMVI)
float values[2]; float values[2];
control->get(controller, control->cookie, control->type, values); control->get(controller, control->cookie, control->type, values);
if (control->mix_control.master == MULTI_CONTROL_MASTERID) if (control->mix_control.master == MULTI_CONTROL_MASTERID)
MMVI->values[i].gain = values[0]; mmvi->values[i].gain = values[0];
else else
MMVI->values[i].gain = values[1]; mmvi->values[i].gain = values[1];
} }
} }
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) {
float values[1]; float values[1];
control->get(controller, control->cookie, control->type, values); control->get(controller, control->cookie, control->type, values);
MMVI->values[i].enable = (values[0] == 1.0); mmvi->values[i].enable = (values[0] == 1.0);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
float values[1]; float values[1];
control->get(controller, control->cookie, control->type, values); control->get(controller, control->cookie, control->type, values);
MMVI->values[i].mux = (int32)values[0]; mmvi->values[i].mux = (int32)values[0];
} }
} }
return B_OK; return B_OK;
@@ -597,11 +597,11 @@ get_mix(geode_controller *controller, multi_mix_value_info * MMVI)
static status_t static status_t
set_mix(geode_controller *controller, multi_mix_value_info * MMVI) set_mix(geode_controller *controller, multi_mix_value_info * mmvi)
{ {
geode_multi *multi = controller->multi; geode_multi *multi = controller->multi;
for (int32 i = 0; i < MMVI->item_count; i++) { for (int32 i = 0; i < mmvi->item_count; i++) {
uint32 id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; uint32 id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= multi->control_count) { if (id < 0 || id >= multi->control_count) {
dprintf("geode_set_mix : invalid control id requested : %li\n", id); dprintf("geode_set_mix : invalid control id requested : %li\n", id);
continue; continue;
@@ -610,8 +610,8 @@ set_mix(geode_controller *controller, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_GAIN) { if (control->mix_control.flags & B_MULTI_MIX_GAIN) {
multi_mixer_control *control2 = NULL; multi_mixer_control *control2 = NULL;
if (i+1<MMVI->item_count) { if (i+1<mmvi->item_count) {
id = MMVI->values[i + 1].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= multi->control_count) { if (id < 0 || id >= multi->control_count) {
dprintf("geode_set_mix : invalid control id requested : %li\n", id); dprintf("geode_set_mix : invalid control id requested : %li\n", id);
} else { } else {
@@ -627,12 +627,12 @@ set_mix(geode_controller *controller, multi_mix_value_info * MMVI)
values[1] = 0.0; values[1] = 0.0;
if (control->mix_control.master == MULTI_CONTROL_MASTERID) if (control->mix_control.master == MULTI_CONTROL_MASTERID)
values[0] = MMVI->values[i].gain; values[0] = mmvi->values[i].gain;
else else
values[1] = MMVI->values[i].gain; values[1] = mmvi->values[i].gain;
if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID)
values[1] = MMVI->values[i+1].gain; values[1] = mmvi->values[i+1].gain;
control->set(controller, control->cookie, control->type, values); control->set(controller, control->cookie, control->type, values);
} }
@@ -644,14 +644,14 @@ set_mix(geode_controller *controller, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) {
float values[1]; float values[1];
values[0] = MMVI->values[i].enable ? 1.0 : 0.0; values[0] = mmvi->values[i].enable ? 1.0 : 0.0;
control->set(controller, control->cookie, control->type, values); control->set(controller, control->cookie, control->type, values);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
float values[1]; float values[1];
values[0] = (float)MMVI->values[i].mux; values[0] = (float)mmvi->values[i].mux;
control->set(controller, control->cookie, control->type, values); control->set(controller, control->cookie, control->type, values);
} }
} }
+23 -23
View File
@@ -247,13 +247,13 @@ echo_create_controls_list(multi_dev *multi)
} }
static status_t static status_t
echo_get_mix(echo_dev *card, multi_mix_value_info * MMVI) echo_get_mix(echo_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i; int32 i;
uint32 id; uint32 id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for (i=0; i<MMVI->item_count; i++) { for (i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("echo_get_mix : invalid control id requested : %li\n", id)); PRINT(("echo_get_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -265,22 +265,22 @@ echo_get_mix(echo_dev *card, multi_mix_value_info * MMVI)
float values[2]; float values[2];
control->get(card, control->channel, control->type, values); control->get(card, control->channel, control->type, values);
if (control->mix_control.master == MULTI_CONTROL_MASTERID) if (control->mix_control.master == MULTI_CONTROL_MASTERID)
MMVI->values[i].gain = values[0]; mmvi->values[i].gain = values[0];
else else
MMVI->values[i].gain = values[1]; mmvi->values[i].gain = values[1];
} }
} }
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) {
float values[1]; float values[1];
control->get(card, control->channel, control->type, values); control->get(card, control->channel, control->type, values);
MMVI->values[i].enable = (values[0] == 1.0); mmvi->values[i].enable = (values[0] == 1.0);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
float values[1]; float values[1];
control->get(card, control->channel, control->type, values); control->get(card, control->channel, control->type, values);
MMVI->values[i].mux = (int32)values[0]; mmvi->values[i].mux = (int32)values[0];
} }
} }
return B_OK; return B_OK;
@@ -288,13 +288,13 @@ echo_get_mix(echo_dev *card, multi_mix_value_info * MMVI)
static status_t static status_t
echo_set_mix(echo_dev *card, multi_mix_value_info * MMVI) echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i; int32 i;
uint32 id; uint32 id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for (i=0; i<MMVI->item_count; i++) { for (i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("echo_set_mix : invalid control id requested : %li\n", id)); PRINT(("echo_set_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -303,8 +303,8 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_GAIN) { if (control->mix_control.flags & B_MULTI_MIX_GAIN) {
multi_mixer_control *control2 = NULL; multi_mixer_control *control2 = NULL;
if (i+1<MMVI->item_count) { if (i+1<mmvi->item_count) {
id = MMVI->values[i + 1].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("echo_set_mix : invalid control id requested : %li\n", id)); PRINT(("echo_set_mix : invalid control id requested : %li\n", id));
} else { } else {
@@ -320,12 +320,12 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * MMVI)
values[1] = 0.0; values[1] = 0.0;
if (control->mix_control.master == MULTI_CONTROL_MASTERID) if (control->mix_control.master == MULTI_CONTROL_MASTERID)
values[0] = MMVI->values[i].gain; values[0] = mmvi->values[i].gain;
else else
values[1] = MMVI->values[i].gain; values[1] = mmvi->values[i].gain;
if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID)
values[1] = MMVI->values[i+1].gain; values[1] = mmvi->values[i+1].gain;
control->set(card, control->channel, control->type, values); control->set(card, control->channel, control->type, values);
} }
@@ -337,14 +337,14 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) {
float values[1]; float values[1];
values[0] = MMVI->values[i].enable ? 1.0 : 0.0; values[0] = mmvi->values[i].enable ? 1.0 : 0.0;
control->set(card, control->channel, control->type, values); control->set(card, control->channel, control->type, values);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
float values[1]; float values[1];
values[0] = (float)MMVI->values[i].mux; values[0] = (float)mmvi->values[i].mux;
control->set(card, control->channel, control->type, values); control->set(card, control->channel, control->type, values);
} }
} }
@@ -353,22 +353,22 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * MMVI)
static status_t static status_t
echo_list_mix_controls(echo_dev *card, multi_mix_control_info * MMCI) echo_list_mix_controls(echo_dev *card, multi_mix_control_info * mmci)
{ {
multi_mix_control *MMC; multi_mix_control *mmc;
uint32 i; uint32 i;
MMC = MMCI->controls; mmc = mmci->controls;
if (MMCI->control_count < 24) if (mmci->control_count < 24)
return B_ERROR; return B_ERROR;
if (echo_create_controls_list(&card->multi) < B_OK) if (echo_create_controls_list(&card->multi) < B_OK)
return B_ERROR; return B_ERROR;
for (i = 0; i < card->multi.control_count; i++) { for (i = 0; i < card->multi.control_count; i++) {
MMC[i] = card->multi.controls[i].mix_control; mmc[i] = card->multi.controls[i].mix_control;
} }
MMCI->control_count = card->multi.control_count; mmci->control_count = card->multi.control_count;
return B_OK; return B_OK;
} }
+23 -23
View File
@@ -520,13 +520,13 @@ emuxki_create_controls_list(multi_dev *multi)
} }
static status_t static status_t
emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * MMVI) emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i; int32 i;
uint32 id; uint32 id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for (i=0; i<MMVI->item_count; i++) { for (i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("emuxki_get_mix : invalid control id requested : %li\n", id)); PRINT(("emuxki_get_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -538,35 +538,35 @@ emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
float values[2]; float values[2];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
MMVI->values[i].u.gain = values[0]; mmvi->values[i].u.gain = values[0];
else else
MMVI->values[i].u.gain = values[1]; mmvi->values[i].u.gain = values[1];
} }
} }
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) {
float values[1]; float values[1];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
MMVI->values[i].u.enable = (values[0] == 1.0); mmvi->values[i].u.enable = (values[0] == 1.0);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
float values[1]; float values[1];
control->get(card, control->cookie, control->type, values); control->get(card, control->cookie, control->type, values);
MMVI->values[i].u.mux = (int32)values[0]; mmvi->values[i].u.mux = (int32)values[0];
} }
} }
return B_OK; return B_OK;
} }
static status_t static status_t
emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI) emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * mmvi)
{ {
int32 i; int32 i;
uint32 id; uint32 id;
multi_mixer_control *control = NULL; multi_mixer_control *control = NULL;
for (i=0; i<MMVI->item_count; i++) { for (i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("emuxki_set_mix : invalid control id requested : %li\n", id)); PRINT(("emuxki_set_mix : invalid control id requested : %li\n", id));
continue; continue;
@@ -575,8 +575,8 @@ emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_GAIN) { if (control->mix_control.flags & B_MULTI_MIX_GAIN) {
multi_mixer_control *control2 = NULL; multi_mixer_control *control2 = NULL;
if (i+1<MMVI->item_count) { if (i+1<mmvi->item_count) {
id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) { if (id < 0 || id >= card->multi.control_count) {
PRINT(("emuxki_set_mix : invalid control id requested : %li\n", id)); PRINT(("emuxki_set_mix : invalid control id requested : %li\n", id));
} else { } else {
@@ -592,12 +592,12 @@ emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
values[1] = 0.0; values[1] = 0.0;
if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
values[0] = MMVI->values[i].u.gain; values[0] = mmvi->values[i].u.gain;
else else
values[1] = MMVI->values[i].u.gain; values[1] = mmvi->values[i].u.gain;
if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID)
values[1] = MMVI->values[i+1].u.gain; values[1] = mmvi->values[i+1].u.gain;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
@@ -609,14 +609,14 @@ emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) {
float values[1]; float values[1];
values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0; values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
float values[1]; float values[1];
values[0] = (float)MMVI->values[i].u.mux; values[0] = (float)mmvi->values[i].u.mux;
control->set(card, control->cookie, control->type, values); control->set(card, control->cookie, control->type, values);
} }
} }
@@ -624,22 +624,22 @@ emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
} }
static status_t static status_t
emuxki_list_mix_controls(emuxki_dev *card, multi_mix_control_info * MMCI) emuxki_list_mix_controls(emuxki_dev *card, multi_mix_control_info * mmci)
{ {
multi_mix_control *MMC; multi_mix_control *mmc;
uint32 i; uint32 i;
MMC = MMCI->controls; mmc = mmci->controls;
if (MMCI->control_count < EMU_MULTICONTROLSNUM) if (mmci->control_count < EMU_MULTICONTROLSNUM)
return B_ERROR; return B_ERROR;
if (emuxki_create_controls_list(&card->multi) < B_OK) if (emuxki_create_controls_list(&card->multi) < B_OK)
return B_ERROR; return B_ERROR;
for (i = 0; i < card->multi.control_count; i++) { for (i = 0; i < card->multi.control_count; i++) {
MMC[i] = card->multi.controls[i].mix_control; mmc[i] = card->multi.controls[i].mix_control;
} }
MMCI->control_count = card->multi.control_count; mmci->control_count = card->multi.control_count;
return B_OK; return B_OK;
} }
@@ -459,19 +459,19 @@ hda_create_controls_list(hda_multi *multi)
static status_t static status_t
list_mix_controls(hda_audio_group* audioGroup, multi_mix_control_info* MMCI) list_mix_controls(hda_audio_group* audioGroup, multi_mix_control_info* mmci)
{ {
multi_mix_control *MMC = MMCI->controls; multi_mix_control *mmc = mmci->controls;
if (MMCI->control_count < 24) if (mmci->control_count < 24)
return B_ERROR; return B_ERROR;
if (hda_create_controls_list(audioGroup->multi) < B_OK) if (hda_create_controls_list(audioGroup->multi) < B_OK)
return B_ERROR; return B_ERROR;
for (uint32 i = 0; i < audioGroup->multi->control_count; i++) { for (uint32 i = 0; i < audioGroup->multi->control_count; i++) {
MMC[i] = audioGroup->multi->controls[i].mix_control; mmc[i] = audioGroup->multi->controls[i].mix_control;
} }
MMCI->control_count = audioGroup->multi->control_count; mmci->control_count = audioGroup->multi->control_count;
return B_OK; return B_OK;
} }
@@ -511,12 +511,12 @@ get_control_gain_mute(hda_audio_group* audioGroup, hda_multi_mixer_control *cont
static status_t static status_t
get_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI) get_mix(hda_audio_group* audioGroup, multi_mix_value_info * mmvi)
{ {
uint32 id; uint32 id;
hda_multi_mixer_control *control = NULL; hda_multi_mixer_control *control = NULL;
for (int32 i = 0; i < MMVI->item_count; i++) { for (int32 i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= audioGroup->multi->control_count) { if (id < 0 || id >= audioGroup->multi->control_count) {
dprintf("hda: get_mix : invalid control id requested : %li\n", id); dprintf("hda: get_mix : invalid control id requested : %li\n", id);
continue; continue;
@@ -527,17 +527,17 @@ get_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
uint32 resp[2]; uint32 resp[2];
get_control_gain_mute(audioGroup, control, resp); get_control_gain_mute(audioGroup, control, resp);
if (control->mix_control.flags & B_MULTI_MIX_ENABLE) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE) {
MMVI->values[i].enable = (resp[0] & AMP_MUTE) != 0; mmvi->values[i].enable = (resp[0] & AMP_MUTE) != 0;
TRACE("get_mix: %ld mute: %d\n", control->nid, MMVI->values[i].enable); TRACE("get_mix: %ld mute: %d\n", control->nid, mmvi->values[i].enable);
} else if (control->mix_control.flags & B_MULTI_MIX_GAIN) { } else if (control->mix_control.flags & B_MULTI_MIX_GAIN) {
uint32 value; uint32 value;
if (control->mix_control.master == MULTI_CONTROL_MASTERID) if (control->mix_control.master == MULTI_CONTROL_MASTERID)
value = resp[0] & AMP_GAIN_MASK; value = resp[0] & AMP_GAIN_MASK;
else else
value = resp[1] & AMP_GAIN_MASK; value = resp[1] & AMP_GAIN_MASK;
MMVI->values[i].gain = (0.0 + value - AMP_CAP_OFFSET(control->capabilities)) mmvi->values[i].gain = (0.0 + value - AMP_CAP_OFFSET(control->capabilities))
* AMP_CAP_STEP_SIZE(control->capabilities); * AMP_CAP_STEP_SIZE(control->capabilities);
TRACE("get_mix: %ld gain: %f (%ld)\n", control->nid, MMVI->values[i].gain, value); TRACE("get_mix: %ld gain: %f (%ld)\n", control->nid, mmvi->values[i].gain, value);
} }
@@ -546,7 +546,7 @@ get_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
/*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { /*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
float values[1]; float values[1];
control->get(audioGroup, control, values); control->get(audioGroup, control, values);
MMVI->values[i].mux = (int32)values[0]; mmvi->values[i].mux = (int32)values[0];
}*/ }*/
} }
return B_OK; return B_OK;
@@ -554,12 +554,12 @@ get_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
static status_t static status_t
set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI) set_mix(hda_audio_group* audioGroup, multi_mix_value_info * mmvi)
{ {
uint32 id; uint32 id;
hda_multi_mixer_control *control = NULL; hda_multi_mixer_control *control = NULL;
for (int32 i = 0; i < MMVI->item_count; i++) { for (int32 i = 0; i < mmvi->item_count; i++) {
id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= audioGroup->multi->control_count) { if (id < 0 || id >= audioGroup->multi->control_count) {
dprintf("set_mix : invalid control id requested : %li\n", id); dprintf("set_mix : invalid control id requested : %li\n", id);
continue; continue;
@@ -567,7 +567,7 @@ set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
control = &audioGroup->multi->controls[id]; control = &audioGroup->multi->controls[id];
if (control->mix_control.flags & B_MULTI_MIX_ENABLE) { if (control->mix_control.flags & B_MULTI_MIX_ENABLE) {
control->mute = (MMVI->values[i].enable ? AMP_MUTE : 0); control->mute = (mmvi->values[i].enable ? AMP_MUTE : 0);
TRACE("set_mix: %ld mute: %lx\n", control->nid, control->mute); TRACE("set_mix: %ld mute: %lx\n", control->nid, control->mute);
uint32 resp[2]; uint32 resp[2];
get_control_gain_mute(audioGroup, control, resp); get_control_gain_mute(audioGroup, control, resp);
@@ -601,8 +601,8 @@ set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
hda_send_verbs(audioGroup->codec, verb, NULL, 2); hda_send_verbs(audioGroup->codec, verb, NULL, 2);
} else if (control->mix_control.flags & B_MULTI_MIX_GAIN) { } else if (control->mix_control.flags & B_MULTI_MIX_GAIN) {
hda_multi_mixer_control *control2 = NULL; hda_multi_mixer_control *control2 = NULL;
if (i+1<MMVI->item_count) { if (i+1<mmvi->item_count) {
id = MMVI->values[i + 1].id - MULTI_CONTROL_FIRSTID; id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= audioGroup->multi->control_count) { if (id < 0 || id >= audioGroup->multi->control_count) {
dprintf("set_mix : invalid control id requested : %li\n", id); dprintf("set_mix : invalid control id requested : %li\n", id);
} else { } else {
@@ -613,11 +613,11 @@ set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
} }
if (control->mix_control.master == MULTI_CONTROL_MASTERID) if (control->mix_control.master == MULTI_CONTROL_MASTERID)
control->gain = (uint32)(MMVI->values[i].gain / AMP_CAP_STEP_SIZE(control->capabilities) control->gain = (uint32)(mmvi->values[i].gain / AMP_CAP_STEP_SIZE(control->capabilities)
+ AMP_CAP_OFFSET(control->capabilities)); + AMP_CAP_OFFSET(control->capabilities));
if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID)
control2->gain = (uint32)(MMVI->values[i+1].gain / AMP_CAP_STEP_SIZE(control2->capabilities) control2->gain = (uint32)(mmvi->values[i+1].gain / AMP_CAP_STEP_SIZE(control2->capabilities)
+ AMP_CAP_OFFSET(control2->capabilities)); + AMP_CAP_OFFSET(control2->capabilities));
TRACE("set_mix: %ld gain: %lx and %ld gain: %lx\n", TRACE("set_mix: %ld gain: %lx and %ld gain: %lx\n",
control->nid, control->gain, control2->nid, control2->gain); control->nid, control->gain, control2->nid, control2->gain);
@@ -664,7 +664,7 @@ set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI)
/*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { /*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
float values[1]; float values[1];
values[0] = (float)MMVI->values[i].mux; values[0] = (float)mmvi->values[i].mux;
control->set(card, control->channel, control->type, values); control->set(card, control->channel, control->type, values);
}*/ }*/
} }