Author: stippi Date: 2010-01-13 12:23:12 +0100 (Wed, 13 Jan 2010) New Revision: 35045 Changeset: http://dev.haiku-os.org/changeset/35045/haiku Ticket: http://dev.haiku-os.org/ticket/5169 Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/ac97.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_multi.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/ich/distro/install.sh haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/ichaudio/ichaudio.c haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/mux.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/ac97.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/ice1712/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/null/null_multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/sis7018/ac97.c haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp Log: Patch by Humdinger: Changed various labels in audio drivers to sentence case. This is case-audio-drivers.diff from #5169. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/ac97.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/ac97.c 2010-01-13 10:58:34 UTC (rev 35044) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/ac97.c 2010-01-13 11:23:12 UTC (rev 35045) @@ -982,13 +982,13 @@ { "Recording", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO|B_MIX_RECORDMUX, 100, AC97_RECORD_GAIN, 0x8000, 4, 0, 1, 0, 0.0, 22.5, 1.5 }, { "Master", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 101, AC97_MASTER_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 }, //{ "Bass/Treble", B_MIX_GAIN|B_MIX_STEREO, 102, AC97_MASTER_TONE, 0x0f0f, 4, 0, 1, 1,-12.0, 10.5, 1.5 }, - //{ "Aux Out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 103, AC97_AUX_OUT_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 }, - { "PCM Out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 104, AC97_PCM_OUT_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, + //{ "Aux out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 103, AC97_AUX_OUT_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 }, + { "PCM out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 104, AC97_PCM_OUT_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, { "CD", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 105, AC97_CD_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, { "Aux In", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 106, AC97_AUX_IN_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, { "TAD", B_MIX_GAIN|B_MIX_MUTE|B_MIX_MONO, 107, AC97_PHONE_VOLUME, 0x8008, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, { "Mic", B_MIX_GAIN|B_MIX_MUTE|B_MIX_MONO|B_MIX_MICBOOST, 108, AC97_MIC_VOLUME, 0x8008, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, - { "Line In", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 109, AC97_LINE_IN_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, + { "Line in", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 109, AC97_LINE_IN_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 }, //{ "Center/Lfe", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 111, AC97_CENTER_LFE_VOLUME, 0x8080, 5, 0, 1, 1,-46.5, 0.0, 1.5 }, { "Center/Lfe" /* should be "Surround" but no */, B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 110, AC97_SURR_VOLUME, 0x8080, 5, 0, 1, 1,-46.5, 0.0, 1.5 } }; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c 2010-01-13 10:58:34 UTC (rev 35044) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c 2010-01-13 11:23:12 UTC (rev 35045) @@ -7,24 +7,24 @@ * Copyright (c) 2002, Marcus Overhagen <marcus@xxxxxxxxxxxx> * * All rights reserved. - * Redistribution and use in source and binary forms, with or without modification, + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * - * - Redistributions of source code must retain the above copyright notice, + * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation + * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ @@ -45,13 +45,13 @@ #include "io.h" -static void +static void auich_ac97_get_mix(void *card, const void *cookie, int32 type, float *values) { auich_dev *dev = (auich_dev*)card; ac97_source_info *info = (ac97_source_info *)cookie; uint16 value, mask; float gain; - + switch(type) { case B_MIX_GAIN: value = auich_codec_read(&dev->config, info->reg); @@ -63,7 +63,7 @@ values[0] = info->max_gain - gain; else values[0] = gain - info->min_gain; - + mask = ((1 << (info->bits + 1)) - 1); gain = (value & mask) * info->granularity; if (info->polarity == 1) @@ -104,26 +104,26 @@ } -static void +static void auich_ac97_set_mix(void *card, const void *cookie, int32 type, float *values) { auich_dev *dev = (auich_dev*)card; ac97_source_info *info = (ac97_source_info *)cookie; uint16 value, mask; float gain; - + switch(type) { case B_MIX_GAIN: value = auich_codec_read(&dev->config, info->reg); if (info->type & B_MIX_STEREO) { mask = ((1 << (info->bits + 1)) - 1) << 8; value &= ~mask; - + if (info->polarity == 1) gain = info->max_gain - values[0]; else gain = values[0] - info->min_gain; value |= ((uint16)(gain / info->granularity) << 8) & mask; - + mask = ((1 << (info->bits + 1)) - 1); value &= ~mask; if (info->polarity == 1) @@ -178,7 +178,7 @@ static int32 -auich_create_group_control(multi_dev *multi, int32 *index, int32 parent, +auich_create_group_control(multi_dev *multi, int32 *index, int32 parent, int32 string, const char* name) { int32 i = *index; (*index)++; @@ -189,7 +189,7 @@ multi->controls[i].mix_control.string = string; if (name) strcpy(multi->controls[i].mix_control.name, name); - + return multi->controls[i].mix_control.id; } @@ -201,17 +201,17 @@ const ac97_source_info *info; /* AC97 Mixer */ - parent = auich_create_group_control(multi, &index, 0, 0, "AC97 Mixer"); - + parent = auich_create_group_control(multi, &index, 0, 0, "AC97 mixer"); + count = source_info_size; //Note that we ignore first item in source_info //It's for recording, but do match this with ac97.c's source_info for (i = 1; i < count ; i++) { info = &source_info[i]; PRINT(("name : %s\n", info->name)); - + parent2 = auich_create_group_control(multi, &index, parent, 0, info->name); - + if (info->type & B_MIX_GAIN) { if (info->type & B_MIX_MUTE) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; @@ -225,7 +225,7 @@ multi->controls[index].set = &auich_ac97_set_mix; index++; } - + multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN; multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID; @@ -240,7 +240,7 @@ multi->controls[index].set = &auich_ac97_set_mix; id = multi->controls[index].mix_control.id; index++; - + if (info->type & B_MIX_STEREO) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN; @@ -256,7 +256,7 @@ multi->controls[index].set = &auich_ac97_set_mix; index++; } - + if (info->type & B_MIX_MICBOOST) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_ENABLE; @@ -274,12 +274,12 @@ /* AC97 Record */ parent = auich_create_group_control(multi, &index, 0, 0, "Recording"); - + info = &source_info[0]; PRINT(("name : %s\n", info->name)); - + parent2 = auich_create_group_control(multi, &index, parent, 0, info->name); - + if (info->type & B_MIX_GAIN) { if (info->type & B_MIX_MUTE) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; @@ -293,7 +293,7 @@ multi->controls[index].set = &auich_ac97_set_mix; index++; } - + multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN; multi->controls[index].mix_control.master = EMU_MULTI_CONTROL_MASTERID; @@ -308,7 +308,7 @@ multi->controls[index].set = &auich_ac97_set_mix; id = multi->controls[index].mix_control.id; index++; - + if (info->type & B_MIX_STEREO) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_GAIN; @@ -324,19 +324,19 @@ multi->controls[index].set = &auich_ac97_set_mix; index++; } - + if (info->type & B_MIX_RECORDMUX) { multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX; multi->controls[index].mix_control.parent = parent2; - strcpy(multi->controls[index].mix_control.name, "Record Mux"); + strcpy(multi->controls[index].mix_control.name, "Record mux"); multi->controls[index].cookie = info; multi->controls[index].type = B_MIX_MUX; multi->controls[index].get = &auich_ac97_get_mix; multi->controls[index].set = &auich_ac97_set_mix; parent3 = multi->controls[index].mix_control.id; index++; - + multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX_VALUE; multi->controls[index].mix_control.parent = parent3; @@ -345,22 +345,22 @@ multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX_VALUE; multi->controls[index].mix_control.parent = parent3; - strcpy(multi->controls[index].mix_control.name, "CD In"); + strcpy(multi->controls[index].mix_control.name, "CD in"); index++; multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX_VALUE; multi->controls[index].mix_control.parent = parent3; - strcpy(multi->controls[index].mix_control.name, "Video In"); + strcpy(multi->controls[index].mix_control.name, "Video in"); index++; multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX_VALUE; multi->controls[index].mix_control.parent = parent3; - strcpy(multi->controls[index].mix_control.name, "Aux In"); + strcpy(multi->controls[index].mix_control.name, "Aux in"); index++; multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX_VALUE; multi->controls[index].mix_control.parent = parent3; - strcpy(multi->controls[index].mix_control.name, "Line In"); + strcpy(multi->controls[index].mix_control.name, "Line in"); index++; multi->controls[index].mix_control.id = EMU_MULTI_CONTROL_FIRSTID + index; multi->controls[index].mix_control.flags = B_MULTI_MIX_MUX_VALUE; @@ -378,15 +378,15 @@ strcpy(multi->controls[index].mix_control.name, "TAD"); index++; } - } - + } + multi->control_count = index; PRINT(("multi->control_count %lu\n", multi->control_count)); return B_OK; } -static status_t +static status_t auich_get_mix(auich_dev *card, multi_mix_value_info * mmvi) { int32 i, id; @@ -398,7 +398,7 @@ continue; } control = &card->multi.controls[id]; - + if (control->mix_control.flags & B_MULTI_MIX_GAIN) { if (control->get) { float values[2]; @@ -407,15 +407,15 @@ mmvi->values[i].u.gain = values[0]; else mmvi->values[i].u.gain = values[1]; - } + } } - + if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); mmvi->values[i].u.enable = (values[0] == 1.0); } - + if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); @@ -426,7 +426,7 @@ } -static status_t +static status_t auich_set_mix(auich_dev *card, multi_mix_value_info * mmvi) { int32 i, id; @@ -438,7 +438,7 @@ continue; } control = &card->multi.controls[id]; - + if (control->mix_control.flags & B_MULTI_MIX_GAIN) { multi_mixer_control *control2 = NULL; if (i+1<mmvi->item_count) { @@ -461,27 +461,27 @@ values[0] = mmvi->values[i].u.gain; else values[1] = mmvi->values[i].u.gain; - + if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) values[1] = mmvi->values[i+1].u.gain; - + control->set(card, control->cookie, control->type, values); } - + if (control2) - i++; + i++; } - + if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { float values[1]; - + values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0; control->set(card, control->cookie, control->type, values); } - + if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { float values[1]; - + values[0] = (float)mmvi->values[i].u.mux; control->set(card, control->cookie, control->type, values); } @@ -490,35 +490,35 @@ } -static status_t +static status_t auich_list_mix_controls(auich_dev *card, multi_mix_control_info * mmci) { multi_mix_control *mmc; int32 i; - + mmc = mmci->controls; if (mmci->control_count < 24) return B_ERROR; - + if (auich_create_controls_list(&card->multi) < B_OK) return B_ERROR; for (i = 0; i < card->multi.control_count; i++) { 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; } -static status_t +static status_t auich_list_mix_connections(auich_dev *card, multi_mix_connection_info * data) { return B_ERROR; } -static status_t +static status_t auich_list_mix_channels(auich_dev *card, multi_mix_channel_info *data) { return B_ERROR; @@ -571,21 +571,21 @@ B_CHANNEL_CENTER, B_CHANNEL_SUB }; - + chans = multi->chans; index = 0; - for (mode=AUICH_USE_PLAY; mode!=-1; + for (mode=AUICH_USE_PLAY; mode!=-1; mode = (mode == AUICH_USE_PLAY) ? AUICH_USE_RECORD : -1) { LIST_FOREACH(stream, &((auich_dev*)multi->card)->streams, next) { if ((stream->use & mode) == 0) continue; - + if (stream->channels == 2) designations = B_CHANNEL_STEREO_BUS; else designations = B_CHANNEL_SURROUND_BUS; - + for (i = 0; i < stream->channels; i++) { chans[index].channel_id = index; chans[index].kind = (mode == AUICH_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL; @@ -594,49 +594,49 @@ index++; } } - + if (mode==AUICH_USE_PLAY) { multi->output_channel_count = index; } else { multi->input_channel_count = index - multi->output_channel_count; } } - + chans[index].channel_id = index; chans[index].kind = B_MULTI_OUTPUT_BUS; chans[index].designations = B_CHANNEL_LEFT | B_CHANNEL_STEREO_BUS; chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO; index++; - + chans[index].channel_id = index; chans[index].kind = B_MULTI_OUTPUT_BUS; chans[index].designations = B_CHANNEL_RIGHT | B_CHANNEL_STEREO_BUS; chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO; index++; - - multi->output_bus_channel_count = index - multi->output_channel_count + + multi->output_bus_channel_count = index - multi->output_channel_count - multi->input_channel_count; - + chans[index].channel_id = index; chans[index].kind = B_MULTI_INPUT_BUS; chans[index].designations = B_CHANNEL_LEFT | B_CHANNEL_STEREO_BUS; chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO; index++; - + chans[index].channel_id = index; chans[index].kind = B_MULTI_INPUT_BUS; chans[index].designations = B_CHANNEL_RIGHT | B_CHANNEL_STEREO_BUS; chans[index].connectors = B_CHANNEL_MINI_JACK_STEREO; index++; - - multi->input_bus_channel_count = index - multi->output_channel_count + + multi->input_bus_channel_count = index - multi->output_channel_count - multi->input_channel_count - multi->output_bus_channel_count; - + multi->aux_bus_channel_count = 0; } -static status_t +static status_t auich_get_description(auich_dev *card, multi_description *data) { uint32 size; @@ -658,7 +658,7 @@ strncpy(data->friendly_name, FRIENDLY_NAME_AMD, 32); break; } - + strcpy(data->vendor_info, AUTHOR); /*data->output_channel_count = 6; @@ -666,21 +666,21 @@ data->output_bus_channel_count = 2; data->input_bus_channel_count = 2; data->aux_bus_channel_count = 0;*/ - + data->output_channel_count = card->multi.output_channel_count; data->input_channel_count = card->multi.input_channel_count; data->output_bus_channel_count = card->multi.output_bus_channel_count; data->input_bus_channel_count = card->multi.input_bus_channel_count; data->aux_bus_channel_count = card->multi.aux_bus_channel_count; - + size = card->multi.output_channel_count + card->multi.input_channel_count + card->multi.output_bus_channel_count + card->multi.input_bus_channel_count + card->multi.aux_bus_channel_count; - - // for each channel, starting with the first output channel, - // then the second, third..., followed by the first input + + // for each channel, starting with the first output channel, + // then the second, third..., followed by the first input // channel, second, third, ..., followed by output bus - // channels and input bus channels and finally auxillary channels, + // channels and input bus channels and finally auxillary channels, LOG(("request_channel_count = %d\n",data->request_channel_count)); if (data->request_channel_count >= size) { @@ -708,7 +708,7 @@ } -static status_t +static status_t auich_get_enabled_channels(auich_dev *card, multi_channel_enable *data) { B_SET_CHANNEL(data->enable_bits, 0, true); @@ -726,7 +726,7 @@ } -static status_t +static status_t auich_set_enabled_channels(auich_dev *card, multi_channel_enable *data) { PRINT(("set_enabled_channels 0 : %s\n", B_TEST_CHANNEL(data->enable_bits, 0) ? "enabled": "disabled")); @@ -737,14 +737,14 @@ } -static status_t +static status_t auich_get_global_format(auich_dev *card, multi_format_info *data) { data->output_latency = 0; data->input_latency = 0; data->timecode_kind = 0; switch (current_settings.sample_rate) { - case 48000: + case 48000: data->input.rate = data->output.rate = B_SR_48000; data->input.cvsr = data->output.cvsr = 48000; break; @@ -758,11 +758,11 @@ } -static status_t +static status_t auich_get_buffers(auich_dev *card, multi_buffer_list *data) { uint8 i, j, pchannels, rchannels, bufcount; - + LOG(("flags = %#x\n",data->flags)); LOG(("request_playback_buffers = %#x\n",data->request_playback_buffers)); LOG(("request_playback_channels = %#x\n",data->request_playback_channels)); @@ -770,10 +770,10 @@ LOG(("request_record_buffers = %#x\n",data->request_record_buffers)); LOG(("request_record_channels = %#x\n",data->request_record_channels)); LOG(("request_record_buffer_size = %#x\n",data->request_record_buffer_size)); - + pchannels = card->pstream->channels; rchannels = card->rstream->channels; - + if (data->request_playback_buffers < current_settings.buffer_count || data->request_playback_channels < (pchannels) || data->request_record_buffers < current_settings.buffer_count || @@ -782,10 +782,10 @@ } ASSERT(current_settings.buffer_count == 2); - + data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD; // XXX ??? // data->flags = 0; - + data->return_playback_buffers = current_settings.buffer_count; /* playback_buffers[b][] */ data->return_playback_channels = pchannels; /* playback_buffers[][c] */ data->return_playback_buffer_size = current_settings.buffer_frames; /* frames */ @@ -796,24 +796,24 @@ for (i = 0; i < bufcount; i++) for (j=0; j<pchannels; j++) - auich_stream_get_nth_buffer(card->pstream, j, i, + auich_stream_get_nth_buffer(card->pstream, j, i, &data->playback_buffers[i][j].base, &data->playback_buffers[i][j].stride); - + data->return_record_buffers = current_settings.buffer_count; data->return_record_channels = rchannels; data->return_record_buffer_size = current_settings.buffer_frames; /* frames */ - + bufcount = current_settings.buffer_count; if (bufcount > data->request_record_buffers) bufcount = data->request_record_buffers; for (i = 0; i < bufcount; i++) for (j=0; j<rchannels; j++) - auich_stream_get_nth_buffer(card->rstream, j, i, + auich_stream_get_nth_buffer(card->rstream, j, i, &data->record_buffers[i][j].base, &data->record_buffers[i][j].stride); - + return B_OK; } @@ -823,17 +823,17 @@ { auich_stream *stream = (auich_stream *)inthparams; //int32 count; - + acquire_spinlock(&slock); stream->real_time = system_time(); stream->frames_count += current_settings.buffer_frames; - stream->buffer_cycle = (stream->trigblk + stream->buffer_cycle = (stream->trigblk + stream->blkmod - 1) % stream->blkmod; stream->update_needed = true; release_spinlock(&slock); - + TRACE(("auich_play_inth : cycle : %d\n", stream->buffer_cycle)); - + //get_sem_count(stream->card->buffer_ready_sem, &count); //if (count <= 0) release_sem_etc(stream->card->buffer_ready_sem, 1, B_DO_NOT_RESCHEDULE); @@ -845,30 +845,30 @@ { auich_stream *stream = (auich_stream *)inthparams; //int32 count; - + acquire_spinlock(&slock); stream->real_time = system_time(); stream->frames_count += current_settings.buffer_frames; - stream->buffer_cycle = (stream->trigblk + stream->buffer_cycle = (stream->trigblk + stream->blkmod - 1) % stream->blkmod; stream->update_needed = true; release_spinlock(&slock); - + TRACE(("auich_record_inth : cycle : %d\n", stream->buffer_cycle)); - + //get_sem_count(stream->card->buffer_ready_sem, &count); //if (count <= 0) release_sem_etc(stream->card->buffer_ready_sem, 1, B_DO_NOT_RESCHEDULE); } -static status_t +static status_t auich_buffer_exchange(auich_dev *card, multi_buffer_info *data) { cpu_status status; auich_stream *pstream, *rstream; multi_buffer_info buffer_info; - + #ifdef __HAIKU__ if (user_memcpy(&buffer_info, data, sizeof(buffer_info)) < B_OK) return B_BAD_ADDRESS; @@ -877,48 +877,48 @@ #endif buffer_info.flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD; - + if (!(card->pstream->state & AUICH_STATE_STARTED)) auich_stream_start(card->pstream, auich_play_inth, card->pstream); - + if (!(card->rstream->state & AUICH_STATE_STARTED)) auich_stream_start(card->rstream, auich_record_inth, card->rstream); - + if (acquire_sem_etc(card->buffer_ready_sem, 1, B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, 50000) == B_TIMED_OUT) { LOG(("buffer_exchange timeout ff\n")); } - + status = lock(); - + LIST_FOREACH(pstream, &card->streams, next) { - if ((pstream->use & AUICH_USE_PLAY) == 0 || + if ((pstream->use & AUICH_USE_PLAY) == 0 || (pstream->state & AUICH_STATE_STARTED) == 0) continue; - if (pstream->update_needed) + if (pstream->update_needed) break; } - + LIST_FOREACH(rstream, &card->streams, next) { if ((rstream->use & AUICH_USE_RECORD) == 0 || (rstream->state & AUICH_STATE_STARTED) == 0) continue; - if (rstream->update_needed) + if (rstream->update_needed) break; } - + if (!pstream) pstream = card->pstream; if (!rstream) rstream = card->rstream; - + /* do playback */ buffer_info.playback_buffer_cycle = pstream->buffer_cycle; buffer_info.played_real_time = pstream->real_time; buffer_info.played_frames_count = pstream->frames_count; buffer_info._reserved_0 = pstream->first_channel; pstream->update_needed = false; - + /* do record */ buffer_info.record_buffer_cycle = rstream->buffer_cycle; buffer_info.recorded_frames_count = rstream->frames_count; @@ -933,13 +933,13 @@ #else memcpy(data, &buffer_info, sizeof(buffer_info)); #endif - + //TRACE(("buffer_exchange ended\n")); return B_OK; } -static status_t +static status_t auich_buffer_force_stop(auich_dev *card) { //auich_voice_halt(card->pvoice); @@ -947,13 +947,13 @@ } -static status_t +static status_t auich_multi_control(void *cookie, uint32 op, void *data, size_t length) { auich_dev *card = (auich_dev *)cookie; switch (op) { - case B_MULTI_GET_DESCRIPTION: + case B_MULTI_GET_DESCRIPTION: LOG(("B_MULTI_GET_DESCRIPTION\n")); return auich_get_description(card, (multi_description *)data); case B_MULTI_GET_EVENT_INFO: @@ -976,7 +976,7 @@ return auich_get_global_format(card, (multi_format_info *)data); case B_MULTI_SET_GLOBAL_FORMAT: LOG(("B_MULTI_SET_GLOBAL_FORMAT\n")); - return B_OK; /* XXX BUG! we *MUST* return B_OK, returning B_ERROR will prevent + return B_OK; /* XXX BUG! we *MUST* return B_OK, returning B_ERROR will prevent * BeOS to accept the format returned in B_MULTI_GET_GLOBAL_FORMAT */ case B_MULTI_GET_CHANNEL_FORMATS: @@ -1047,33 +1047,33 @@ auich_dev *card = NULL; void *settings_handle; int ix; - + LOG(("open()\n")); - + for (ix=0; ix<num_cards; ix++) { if (!strcmp(cards[ix].name, name)) { card = &cards[ix]; } } - + if (card == NULL) { LOG(("open() card not found %s\n", name)); for (ix=0; ix<num_cards; ix++) { - LOG(("open() card available %s\n", cards[ix].name)); + LOG(("open() card available %s\n", cards[ix].name)); } return B_ERROR; } - + LOG(("open() got card\n")); - + if (card->pstream !=NULL) return B_ERROR; if (card->rstream !=NULL) return B_ERROR; - + *cookie = card; card->multi.card = card; - + // get driver settings settings_handle = load_driver_settings(AUICH_SETTINGS); if (settings_handle != NULL) { @@ -1083,42 +1083,42 @@ item = get_driver_parameter (settings_handle, "sample_rate", "48000", "48000"); value = strtoul (item, &end, 0); - if (*end == '\0') + if (*end == '\0') current_settings.sample_rate = value; item = get_driver_parameter (settings_handle, "buffer_frames", "256", "256"); value = strtoul (item, &end, 0); - if (*end == '\0') + if (*end == '\0') current_settings.buffer_frames = value; item = get_driver_parameter (settings_handle, "buffer_count", "4", "4"); value = strtoul (item, &end, 0); - if (*end == '\0') + if (*end == '\0') current_settings.buffer_count = value; unload_driver_settings(settings_handle); } - + LOG(("stream_new\n")); - + card->rstream = auich_stream_new(card, AUICH_USE_RECORD, current_settings.buffer_frames, current_settings.buffer_count); card->pstream = auich_stream_new(card, AUICH_USE_PLAY, current_settings.buffer_frames, current_settings.buffer_count); - + card->buffer_ready_sem = create_sem(0, "pbuffer ready"); - + LOG(("stream_setaudio\n")); - + auich_stream_set_audioparms(card->pstream, 2, true, current_settings.sample_rate); auich_stream_set_audioparms(card->rstream, 2, true, current_settings.sample_rate); - + card->pstream->first_channel = 0; card->rstream->first_channel = 2; - + auich_stream_commit_parms(card->pstream); auich_stream_commit_parms(card->rstream); - + auich_create_channels_list(&card->multi); - + return B_OK; } @@ -1128,7 +1128,7 @@ { //auich_dev *card = cookie; LOG(("close()\n")); - + return B_OK; } @@ -1139,21 +1139,21 @@ auich_dev *card = cookie; auich_stream *stream; LOG(("free()\n")); - + if (card->buffer_ready_sem > B_OK) delete_sem(card->buffer_ready_sem); - + LIST_FOREACH(stream, &card->streams, next) { auich_stream_halt(stream); } - + while (!LIST_EMPTY(&card->streams)) { auich_stream_delete(LIST_FIRST(&card->streams)); } card->pstream = NULL; card->rstream = NULL; - + return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c 2010-01-13 10:58:34 UTC (rev 35044) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c 2010-01-13 11:23:12 UTC (rev 35045) @@ -7,24 +7,24 @@ * Copyright (c) 2002, Marcus Overhagen <marcus@xxxxxxxxxxxx> * * All rights reserved. - * Redistribution and use in source and binary forms, with or without modification, + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * - * - Redistributions of source code must retain the above copyright notice, + * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation + * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ @@ -43,13 +43,13 @@ #include "util.h" #include "io.h" -static void +static void auvia_ac97_get_mix(void *card, const void *cookie, int32 type, float *values) { auvia_dev *dev = (auvia_dev*)card; ac97_source_info *info = (ac97_source_info *)cookie; uint16 value, mask; float gain; - + switch(type) { case B_MIX_GAIN: value = auvia_codec_read(&dev->config, info->reg); @@ -61,7 +61,7 @@ values[0] = info->max_gain - gain; else values[0] = gain - info->min_gain; - + [... truncated: 2909 lines follow ...]