Skip to contentSkip to conversation

Remarks about alsa-lib-1.0.29/test/pcm*.c

PATCH Christophe Lohr 2 participants 2 messages May 31, 2015 – Jun 1, 2015

lore
Share & tools
lore
#0 lore raw

Hello,
I'm looking about examples in alsa-lib-1.0.29/test/

I have two questions about:

pcm.c line 71: In case of a FLOAT format, maxval is 1.0, isn't it?

pcm_min.c lin 79: Variable err does not refers to the previous call?

Did I understood well?

Best regards
Christophe

test/pcm.c +1 -1
diff -uprN alsa-lib-1.0.29.origin/test/pcm.c alsa-lib-1.0.29/test/pcm.c
@@ -68,7 +68,7 @@ static void generate_sine(const snd_pcm_
 		} fval;
 		int res, i;
 		if (is_float) {
-			fval.f = sin(phase) * maxval;
+			fval.f = sin(phase);
 			res = fval.i;
 		} else
 			res = sin(phase) * maxval;
test/pcm_min.c +1 -1
diff -uprN alsa-lib-1.0.29.origin/test/pcm_min.c alsa-lib-1.0.29/test/pcm_min.c
@@ -39,7 +39,7 @@ int main(void)
                 if (frames < 0)
                         frames = snd_pcm_recover(handle, frames, 0);
                 if (frames < 0) {
-                        printf("snd_pcm_writei failed: %s\n", snd_strerror(err));
+                        printf("snd_pcm_writei failed: %s\n", snd_strerror(frames));
                         break;
                 }
                 if (frames > 0 && frames < (long)sizeof(buffer))
#1 lore raw

At Sun, 31 May 2015 13:51:26 +0200,

Quoted 11 lines · Christophe Lohr

Hello,
I'm looking about examples in alsa-lib-1.0.29/test/

I have two questions about:

pcm.c line 71: In case of a FLOAT format, maxval is 1.0, isn't it?

pcm_min.c lin 79: Variable err does not refers to the previous call?

Did I understood well?

Yes, both are correct fixes. Now I merged to git tree. Thanks!

Takashi

Quoted 31 lines

Best regards
Christophe
diff -uprN alsa-lib-1.0.29.origin/test/pcm.c alsa-lib-1.0.29/test/pcm.c

test/pcm.c +1 -1
@@ -68,7 +68,7 @@ static void generate_sine(const snd_pcm_
 		} fval;
 		int res, i;
 		if (is_float) {
-			fval.f = sin(phase) * maxval;
+			fval.f = sin(phase);
 			res = fval.i;
 		} else
 			res = sin(phase) * maxval;

diff -uprN alsa-lib-1.0.29.origin/test/pcm_min.c alsa-lib-1.0.29/test/pcm_min.c

test/pcm_min.c +1 -1
@@ -39,7 +39,7 @@ int main(void)
                 if (frames < 0)
                         frames = snd_pcm_recover(handle, frames, 0);
                 if (frames < 0) {
-                        printf("snd_pcm_writei failed: %s\n", snd_strerror(err));
+                        printf("snd_pcm_writei failed: %s\n", snd_strerror(frames));
                         break;
                 }
                 if (frames > 0 && frames < (long)sizeof(buffer))

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel