diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c index 7d5ce4298a..cf5d27f569 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c @@ -721,30 +721,13 @@ init_driver(void) void *settings_handle; pci_info info; num_cards = 0; - + PRINT(("init_driver()\n")); // get driver settings - settings_handle = load_driver_settings("auich.settings"); + settings_handle = load_driver_settings(AUICH_SETTINGS); if (settings_handle != NULL) { - const char *item; - char *end; - uint32 value; - - item = get_driver_parameter (settings_handle, "sample_rate", "48000", "48000"); - value = strtoul (item, &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') current_settings.buffer_frames = value; - - item = get_driver_parameter (settings_handle, "buffer_count", "4", "4"); - value = strtoul (item, &end, 0); - if (*end == '\0') current_settings.buffer_count = value; - current_settings.use_thread = get_driver_boolean_parameter (settings_handle, "use_thread", false, false); - unload_driver_settings (settings_handle); } diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h index 9fdc15a55e..5ef89b069e 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.h @@ -167,6 +167,8 @@ typedef struct _auich_dev { } auich_dev; +#define AUICH_SETTINGS "auich.settings" + typedef struct { uint32 sample_rate; uint32 buffer_frames; diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c b/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c index 9f950d04fe..3a7047bd00 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c @@ -29,6 +29,7 @@ * */ +#include #include #include #include @@ -43,6 +44,7 @@ #include "util.h" #include "io.h" + static void auich_ac97_get_mix(void *card, const void *cookie, int32 type, float *values) { auich_dev *dev = (auich_dev*)card; @@ -1011,6 +1013,7 @@ static status_t auich_open(const char *name, uint32 flags, void** cookie) { auich_dev *card = NULL; + void *settings_handle; int ix; LOG(("open()\n")); @@ -1039,6 +1042,31 @@ auich_open(const char *name, uint32 flags, void** cookie) *cookie = card; card->multi.card = card; + // get driver settings + settings_handle = load_driver_settings(AUICH_SETTINGS); + if (settings_handle != NULL) { + const char *item; + char *end; + uint32 value; + + item = get_driver_parameter (settings_handle, "sample_rate", "48000", "48000"); + value = strtoul (item, &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') + current_settings.buffer_frames = value; + + item = get_driver_parameter (settings_handle, "buffer_count", "4", "4"); + value = strtoul (item, &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);