fixed handling of parameters

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22788 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-11-01 18:01:10 +00:00
parent 23b6ac7e15
commit d284de3249
2 changed files with 59 additions and 34 deletions

View File

@ -532,25 +532,40 @@ init_driver(void)
char *end;
uint32 value;
item = get_driver_parameter (settings_handle, "channels", "0", "0");
item = get_driver_parameter (settings_handle, "channels", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.channels = value;
}
PRINT(("channels %lu\n", current_settings.channels));
item = get_driver_parameter (settings_handle, "bitsPerSample", "0", "0");
item = get_driver_parameter (settings_handle, "bitsPerSample", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.bitsPerSample = value;
}
PRINT(("bitsPerSample %lu\n", current_settings.bitsPerSample));
item = get_driver_parameter (settings_handle, "sample_rate", "0", "0");
item = get_driver_parameter (settings_handle, "sample_rate", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.sample_rate = value;
}
PRINT(("sample_rate %lu\n", current_settings.sample_rate));
item = get_driver_parameter (settings_handle, "buffer_frames", "0", "0");
item = get_driver_parameter (settings_handle, "buffer_frames", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.buffer_frames = value;
}
PRINT(("buffer_frames %lu\n", current_settings.buffer_frames));
item = get_driver_parameter (settings_handle, "buffer_count", "0", "0");
item = get_driver_parameter (settings_handle, "buffer_count", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.buffer_count = value;
}
PRINT(("buffer_count %lu\n", current_settings.buffer_count));
unload_driver_settings (settings_handle);
}

View File

@ -2751,25 +2751,35 @@ init_driver(void)
char *end;
uint32 value;
item = get_driver_parameter (settings_handle, "channels", "0", "0");
item = get_driver_parameter (settings_handle, "channels", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.channels = value;
}
item = get_driver_parameter (settings_handle, "bitsPerSample", "0", "0");
item = get_driver_parameter (settings_handle, "bitsPerSample", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.bitsPerSample = value;
}
item = get_driver_parameter (settings_handle, "sample_rate", "0", "0");
item = get_driver_parameter (settings_handle, "sample_rate", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.sample_rate = value;
}
item = get_driver_parameter (settings_handle, "buffer_frames", "0", "0");
item = get_driver_parameter (settings_handle, "buffer_frames", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.buffer_frames = value;
}
item = get_driver_parameter (settings_handle, "buffer_count", "0", "0");
item = get_driver_parameter (settings_handle, "buffer_count", NULL, NULL);
if (item) {
value = strtoul (item, &end, 0);
if (*end == '\0') current_settings.buffer_count = value;
}
unload_driver_settings (settings_handle);
}