Skip to contentSkip to conversation

Salsa-lib : _snd_pcm_hw_param_test is not defined

DISCUSSION Matthieu CASTET 2 participants 7 messages Oct 13, 2008 – Oct 16, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks

Matthieu

#1 lore raw

At Mon, 13 Oct 2008 11:49:03 +0200,

Quoted 7 lines · Matthieu CASTET

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks for reporting. Does the patch below works?

Takashi

src/pcm_params.c +9 -0
diff -r f481dcc66eae src/pcm_params.c
@@ -754,6 +754,15 @@
 	return err;
 }
 
+int _snd_pcm_hw_param_test(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+			   int var, unsigned int val, int *dir)
+{
+	snd_pcm_hw_params_t save = *params;
+	int err = _snd_pcm_hw_param_set(pcm, params, var, val, dir);
+	*params = save;
+	return err;
+}
+
 int _snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, 
 				  snd_pcm_hw_params_t *params,
 				  int var)
#2 lore raw

Hi,

Quoted 10 lines · Takashi Iwai

At Mon, 13 Oct 2008 11:49:03 +0200,

Quoted 6 lines · Matthieu CASTET

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks for reporting.

Thanks for your quick reply.

Quoted 1 line

Does the patch below works?

Hum,

dir is a pointer, but _snd_pcm_hw_param_set want a integer.

BTW, some application expect snd_config (from cards.c) to be not null after a call to snd_config_update.

Matthieu

#3 lore raw

At Mon, 13 Oct 2008 16:01:07 +0200,

Quoted 13 lines · Matthieu CASTET

Hi,

Quoted 9 lines · Takashi Iwai

At Mon, 13 Oct 2008 11:49:03 +0200,

Quoted 6 lines · Matthieu CASTET

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Quoted 7 lines
Quoted 1 line

Thanks for reporting.

Thanks for your quick reply.

Quoted 1 line

Does the patch below works?

Hum,

dir is a pointer, but _snd_pcm_hw_param_set want a integer.

Oops, the fixed patch is below.

Quoted 3 lines

BTW, some application expect snd_config (from cards.c) to be not null after a call to snd_config_update.

Hm, which apps?

Basically the non-null pointer isn't guaranteed even in the API definition, so it's not necessarily to implement. But, if many apps assume it, it becomes as a de facto standard, and we need to give a workaround...

thanks,

Takashi

src/pcm_params.c +9 -0
diff -r f481dcc66eae src/pcm_params.c
@@ -754,6 +754,15 @@
 	return err;
 }
 
+int _snd_pcm_hw_param_test(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+			   int var, unsigned int val, int *dir)
+{
+	snd_pcm_hw_params_t save = *params;
+	int err = _snd_pcm_hw_param_set(pcm, params, var, val, dir ? *dir : 0);
+	*params = save;
+	return err;
+}
+
 int _snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, 
 				  snd_pcm_hw_params_t *params,
 				  int var)
#4 lore raw
Quoted 14 lines · Takashi Iwai

At Mon, 13 Oct 2008 16:01:07 +0200,

Quoted 12 lines · Matthieu CASTET

Hi,

Quoted 9 lines · Takashi Iwai

At Mon, 13 Oct 2008 11:49:03 +0200,

Quoted 6 lines · Matthieu CASTET

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks for reporting.

Quoted 9 lines
Quoted 6 lines

Thanks for your quick reply.

Quoted 1 line

Does the patch below works?

Hum,

dir is a pointer, but _snd_pcm_hw_param_set want a integer.

Oops, the fixed patch is below.

Ok sound better.
But why _snd_pcm_hw_param_test take a pointer and not a integer. All snd_pcm_hw_params_test_xxx seems to take a dir as integer.

Quoted 5 lines
Quoted 2 lines

BTW, some application expect snd_config (from cards.c) to be not null after a call to snd_config_update.

Hm, which apps?

portaudio.

Matthieu

#5 lore raw

At Tue, 14 Oct 2008 09:46:16 +0200,

Quoted 21 lines · Matthieu CASTET
Quoted 19 lines · Takashi Iwai

At Mon, 13 Oct 2008 16:01:07 +0200,

Quoted 17 lines · Matthieu CASTET

Hi,

Quoted 9 lines · Takashi Iwai

At Mon, 13 Oct 2008 11:49:03 +0200,

Quoted 6 lines · Matthieu CASTET

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks for reporting.

Thanks for your quick reply.

Quoted 1 line

Does the patch below works?

Hum,

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

dir is a pointer, but _snd_pcm_hw_param_set want a integer.

Oops, the fixed patch is below.

Ok sound better.
But why _snd_pcm_hw_param_test take a pointer and not a integer. All snd_pcm_hw_params_test_xxx seems to take a dir as integer.

When you pass a pointer pointing the integer value 0, it returns the direction it goes in return.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

BTW, some application expect snd_config (from cards.c) to be not null after a call to snd_config_update.

Hm, which apps?

portaudio.

One app isn't always enough to change the thing :)
OTOH, if just faking a pointer (i.e. passing any non-null) fixes the problem, it might be a reasonable workaround...

Takashi

#6 lore raw

At Tue, 14 Oct 2008 10:10:36 +0200,

Quoted 26 lines · I wrote:

At Tue, 14 Oct 2008 09:46:16 +0200,

Quoted 23 lines · Matthieu CASTET
Quoted 21 lines · Takashi Iwai

At Mon, 13 Oct 2008 16:01:07 +0200,

Quoted 18 lines · Matthieu CASTET

Hi,

Quoted 9 lines · Takashi Iwai

At Mon, 13 Oct 2008 11:49:03 +0200,

Quoted 6 lines · Matthieu CASTET

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks for reporting.

Thanks for your quick reply.

Quoted 1 line

Does the patch below works?

Hum,

dir is a pointer, but _snd_pcm_hw_param_set want a integer.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Oops, the fixed patch is below.

Ok sound better.
But why _snd_pcm_hw_param_test take a pointer and not a integer. All snd_pcm_hw_params_test_xxx seems to take a dir as integer.

When you pass a pointer pointing the integer value 0, it returns the direction it goes in return.

I released version 0.0.20 just including this fix now.

However...

Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

BTW, some application expect snd_config (from cards.c) to be not null after a call to snd_config_update.

Hm, which apps?

portaudio.

One app isn't always enough to change the thing :)
OTOH, if just faking a pointer (i.e. passing any non-null) fixes the problem, it might be a reasonable workaround...

... this problem still remains.
Can you check the patch like below could work around the problem?

thanks,

Takashi

src/cards.c +4 -1
diff -r 590f5dd3cd39 src/cards.c
@@ -174,4 +174,7 @@
 	return 0;
 }
 
-snd_config_t *snd_config; /* placeholder */
+/* This is just a placeholder, but contains non-NULL value for apps
+ * that check the value by some reason
+ */
+snd_config_t *snd_config = (snd_config_t*)1;