Revert code which got mixed in 782ebbdf93

* Sorry about that.
This commit is contained in:
Dario Casalinuovo 2015-10-12 13:12:36 +02:00
parent 782ebbdf93
commit 46098852b4
3 changed files with 0 additions and 121 deletions

View File

@ -35,9 +35,6 @@ hda_open(const char* name, uint32 flags, void** cookie)
atomic_add(&controller->opened, 1);
*cookie = controller;
get_settings_from_file(); // optional user-settable sample rate, buffer frames and count
return B_OK;
}

View File

@ -375,7 +375,6 @@ void hda_codec_delete(hda_codec* codec);
/* hda_multi_audio.c */
status_t multi_audio_control(void* cookie, uint32 op, void* arg, size_t length);
void get_settings_from_file();
/* hda_controller.c: Basic controller support */
status_t hda_hw_init(hda_controller* controller);

View File

@ -8,8 +8,6 @@
*/
#include <driver_settings.h>
#include "hmulti_audio.h"
#include "driver.h"
@ -71,103 +69,6 @@ format2size(uint32 format)
}
#define HDA_SETTINGS "hda.settings"
static struct {
int32 play_sample_rate;
int32 play_buffer_frames;
int32 play_buffer_count;
int32 record_sample_rate;
int32 record_buffer_frames;
int32 record_buffer_count;
} requested_settings;
static uint32
fps_to_ratecode(uint32 fps)
{
switch (fps) {
case 8000:
return B_SR_8000;
case 11025:
return B_SR_11025;
case 16000:
return B_SR_16000;
case 22050:
return B_SR_22050;
case 32000:
return B_SR_32000;
case 44100:
return B_SR_44100;
case 48000:
return B_SR_48000;
case 88200:
return B_SR_88200;
case 96000:
return B_SR_96000;
case 176400:
return B_SR_176400;
case 192000:
return B_SR_192000;
case 384000:
return B_SR_384000;
}
return 0;
}
void
get_settings_from_file()
{
const char *item;
char *end;
uint32 value;
memset(&requested_settings, 0, sizeof(requested_settings));
dprintf("looking for settings file\n");
void *settings_handle = load_driver_settings(HDA_SETTINGS);
if (settings_handle == NULL)
return;
item = get_driver_parameter (settings_handle, "play_sample_rate", "0", "192000");
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0')
requested_settings.play_sample_rate = value ? fps_to_ratecode(value) : 0;
}
item = get_driver_parameter (settings_handle, "play_buffer_frames", "0", "10240");
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0')
requested_settings.play_buffer_frames = value;
}
item = get_driver_parameter (settings_handle, "play_buffer_count", "0", "4");
value = strtoul (item, &end, 0);
if (*end == '\0')
requested_settings.play_buffer_count = value;
item = get_driver_parameter (settings_handle, "record_sample_rate", "0", "192000");
value = strtoul (item, &end, 0);
if (*end == '\0')
requested_settings.record_sample_rate = value ? fps_to_ratecode(value) : 0;
item = get_driver_parameter (settings_handle, "record_buffer_frames", "0", "10240");
value = strtoul (item, &end, 0);
if (*end == '\0')
requested_settings.record_buffer_frames = value;
item = get_driver_parameter (settings_handle, "record_buffer_count", "0", "4");
value = strtoul (item, &end, 0);
if (*end == '\0')
requested_settings.record_buffer_count = value;
unload_driver_settings(settings_handle);
}
static status_t
get_description(hda_audio_group* audioGroup, multi_description* data)
{
@ -206,9 +107,6 @@ get_description(hda_audio_group* audioGroup, multi_description* data)
data->output_rates = 0;
data->output_formats = 0;
}
if (requested_settings.play_sample_rate != 0)
data->output_rates = requested_settings.play_sample_rate;
if (audioGroup->record_stream != NULL) {
data->input_rates = audioGroup->record_stream->sample_rate;
@ -218,9 +116,6 @@ get_description(hda_audio_group* audioGroup, multi_description* data)
data->input_formats = 0;
}
if (requested_settings.record_sample_rate != 0)
data->input_rates = requested_settings.record_sample_rate;
// force existance of 48kHz if variable rates are not supported
if (data->output_rates == 0)
data->output_rates = B_SR_48000;
@ -970,18 +865,6 @@ default_buffer_length_for_rate(uint32 rate)
static status_t
get_buffers(hda_audio_group* audioGroup, multi_buffer_list* data)
{
if (requested_settings.play_buffer_frames != 0)
data->request_playback_buffer_size = requested_settings.play_buffer_frames;
if (requested_settings.play_buffer_count != 0)
data->request_playback_buffers = requested_settings.play_buffer_count;
if (requested_settings.record_buffer_frames != 0)
data->request_record_buffer_size = requested_settings.record_buffer_frames;
if (requested_settings.record_buffer_count != 0)
data->request_record_buffers = requested_settings.record_buffer_count;
TRACE("playback: %ld buffers, %ld channels, %ld samples\n",
data->request_playback_buffers, data->request_playback_channels,
data->request_playback_buffer_size);