]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Updated to current API..
authorJaroslav Kysela <perex@perex.cz>
Fri, 4 Feb 2000 10:07:20 +0000 (10:07 +0000)
committerJaroslav Kysela <perex@perex.cz>
Fri, 4 Feb 2000 10:07:20 +0000 (10:07 +0000)
test/latency.c
test/pcmtest.c

index e0877a997014b1f5cc579d4540bff7bfc8c7cdd1..b87d10084429ee149acb05b52d79142061e3f888 100644 (file)
@@ -152,6 +152,7 @@ void showstat(snd_pcm_t *handle, int channel, snd_pcm_channel_status_t *rstatus)
        printf("%s:\n", str);
        printf("  status = %i\n", status.status);
        printf("  position = %u\n", status.scount);
+       printf("  free = %i\n", status.free);
        if (rstatus)
                *rstatus = status;
 }
@@ -230,11 +231,11 @@ int main(void)
 
        // latency = 4096 - 16;
        setscheduler();
-       if ((err = snd_pcm_open(&phandle, pcard, pdevice, SND_PCM_OPEN_STREAM_PLAYBACK)) < 0) {
+       if ((err = snd_pcm_open(&phandle, pcard, pdevice, SND_PCM_OPEN_PLAYBACK)) < 0) {
                printf("Playback open error: %s\n", snd_strerror(err));
                return 0;
        }
-       if ((err = snd_pcm_open(&chandle, ccard, cdevice, SND_PCM_OPEN_STREAM_CAPTURE)) < 0) {
+       if ((err = snd_pcm_open(&chandle, ccard, cdevice, SND_PCM_OPEN_CAPTURE)) < 0) {
                printf("Record open error: %s\n", snd_strerror(err));
                return 0;
        }
@@ -274,8 +275,8 @@ int main(void)
                }
                showstat(phandle, SND_PCM_CHANNEL_PLAYBACK, &pstatus);
                showstat(chandle, SND_PCM_CHANNEL_CAPTURE, &cstatus);
-               snd_pcm_flush_capture(chandle);
-               snd_pcm_flush_playback(phandle);
+               snd_pcm_capture_flush(chandle);
+               snd_pcm_playback_flush(phandle);
                if (ok) {
                        printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
                               pstatus.stime.tv_sec,
index 2806a8d040cf343e323ce8a72ae6a5ce473111f2..44c995f5d3988dfe94e187981cda36c26f9471a4 100644 (file)
@@ -2,11 +2,13 @@
 #include <string.h>
 #include "../include/asoundlib.h"
 
-void info_channel(snd_pcm_t *handle, char *id)
+void info_channel(snd_pcm_t *handle, int channel, char *id)
 {
        snd_pcm_channel_info_t chninfo;
        int err;
        
+       bzero(&chninfo, sizeof(chninfo));
+       chninfo.channel = channel;
        if ((err = snd_pcm_channel_info(handle, &chninfo))<0) {
                fprintf(stderr, "channel info error: %s\n", snd_strerror(err));
                return;
@@ -146,7 +148,7 @@ void info(void)
        snd_pcm_info_t info;
        int err;
 
-       if ((err = snd_pcm_open(&handle, 0, 0, SND_PCM_OPEN_PLAYBACK))<0) {
+       if ((err = snd_pcm_open(&handle, 0, 0, SND_PCM_OPEN_DUPLEX))<0) {
                fprintf(stderr, "open error: %s\n", snd_strerror(err));
                return;
        }
@@ -162,9 +164,9 @@ void info(void)
        printf("  playback  : %i\n", info.playback);
        printf("  capture   : %i\n", info.capture);
        if (info.flags & SND_PCM_INFO_PLAYBACK)
-               info_channel(handle, "Playback");
+               info_channel(handle, SND_PCM_CHANNEL_PLAYBACK, "Playback");
        if (info.flags & SND_PCM_INFO_CAPTURE)
-               info_channel(handle, "Capture");
+               info_channel(handle, SND_PCM_CHANNEL_CAPTURE, "Capture");
        snd_pcm_close(handle);
 }