]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixes for new types...
authorJaroslav Kysela <perex@perex.cz>
Thu, 3 Jun 1999 21:41:29 +0000 (21:41 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 3 Jun 1999 21:41:29 +0000 (21:41 +0000)
13 files changed:
include/Makefile.am
test/control.c
test/latency.c
test/loopback.c
test/mixer.c
test/pause.c
test/pcm.c
test/playmidi1.c
test/seq-decoder.c
test/seq-sender.c
test/seq.c
test/switches.c
test/timer.c

index 25410d1e116fe332cc4857e518d2aca436963a51..33b57f4e5584f92ff08e2625a5f69cb853f439e6 100644 (file)
@@ -27,7 +27,7 @@ stamp-vh: $(top_builddir)/configure.in
        @echo "                           SND_LIB_SUBMINOR)" >> ver.tmp
        @echo "#define SND_LIB_VERSION_STR      \"$(SND_LIB_VERSION)\"" >> ver.tmp
        @echo >> ver.tmp
-       @echo "/* OBSOLETE DEFINES WHICH WILLN'T BE IN 0.3.0 FINAL!!! */" >> ver.tmp
+       @echo "/* OBSOLETE DEFINES WHICH WON'T BE IN 0.3.0 FINAL!!! */" >> ver.tmp
        @echo "#define SOUNDLIB_VERSION_MAJOR           SND_LIB_MAJOR" >> ver.tmp
        @echo "#define SOUNDLIB_VERSION_MINOR           SND_LIB_MINOR" >> ver.tmp
        @echo "#define SOUNDLIB_VERSION_SUBMINOR        SND_LIB_SUBMINOR" >> ver.tmp
index c8d67478c27b2930d9f5a7c62f1012d0fffbc0a3..d8a6edd1ac2f9120ad1fe5ecd0ad91c7900b2a69 100644 (file)
@@ -2,20 +2,20 @@
 #include <string.h>
 #include "../include/asoundlib.h"
 
-void main(void)
+int main(void)
 {
        int idx, idx1, cards, err;
-       void *handle;
+       snd_ctl_t *handle;
        struct snd_ctl_hw_info info;
        snd_pcm_info_t pcminfo;
        snd_mixer_info_t mixerinfo;
        char str[128];
 
        cards = snd_cards();
-       printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
+       printf("Detected %i soundcard%s...\n", cards, cards != 1 ? "s" : "");
        if (cards <= 0) {
                printf("Giving up...\n");
-               return;
+               return 0;
        }
        for (idx = 0; idx < cards; idx++) {
                if ((err = snd_ctl_open(&handle, idx)) < 0) {
@@ -58,10 +58,11 @@ void main(void)
                        printf("  elements - %i\n", mixerinfo.elements);
                        printf("  groups - %i\n", mixerinfo.groups);
                        printf("  switches - %i\n", mixerinfo.switches);
-                       printf("  attribute - 0x%x\n", mixerinfo.attribute);
+                       printf("  attrib - 0x%x\n", mixerinfo.attrib);
                        printf("  id - '%s'\n", mixerinfo.id);
                        printf("  name - '%s'\n", mixerinfo.name);
                }
                snd_ctl_close(handle);
        }
+       return 0;
 }
index 87a8c1e59452b7e594e914731179442d2d4adb74..f03b6f0bb1e4efdb1ee701bd60e92a805d176647 100644 (file)
@@ -175,9 +175,9 @@ long timediff(struct timeval t1, struct timeval t2)
        return (t1.tv_sec * 1000000) + l;
 }
 
-void main(void)
+int main(void)
 {
-       void *phandle, *rhandle;
+       snd_pcm_t *phandle, *rhandle;
        char buffer[4096 * 2];  /* max two fragments by 4096 bytes */
        int pcard = 0, pdevice = 0;
        int rcard = 0, rdevice = 0;
@@ -189,11 +189,11 @@ void main(void)
        setscheduler();
        if ((err = snd_pcm_open(&phandle, pcard, pdevice, SND_PCM_OPEN_PLAYBACK)) < 0) {
                printf("Playback open error: %s\n", snd_strerror(err));
-               return;
+               return 0;
        }
        if ((err = snd_pcm_open(&rhandle, rcard, rdevice, SND_PCM_OPEN_RECORD)) < 0) {
                printf("Record open error: %s\n", snd_strerror(err));
-               return;
+               return 0;
        }
        setformat(phandle, rhandle);
        while (1) {
@@ -231,13 +231,14 @@ void main(void)
                        printf("Playback OK!!!\n");
                        printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
                               pstatus.stime.tv_sec,
-                              pstatus.stime.tv_usec,
+                              (int)pstatus.stime.tv_usec,
                               rstatus.stime.tv_sec,
-                              rstatus.stime.tv_usec,
+                              (int)rstatus.stime.tv_usec,
                               timediff(pstatus.stime, rstatus.stime));
                        break;
                }
        }
        snd_pcm_close(phandle);
        snd_pcm_close(rhandle);
+       return 0;
 }
index c74e83f060f0f2bff9dc601a3fb6db523ec73ef4..f39c2d00057766e3bed13c17f1f5f3503e070c0a 100644 (file)
@@ -6,7 +6,7 @@
 int main(int argc, char *argv[])
 {
        int err;
-       void *handle;
+       snd_pcm_loopback_t *handle;
 
        err = snd_pcm_loopback_open(&handle, 0, 0, SND_PCM_LB_OPEN_PLAYBACK);
        if (err < 0) {
index 3550acbed84ca162afdb6bc107f8fe68f428ca98..34dd37563ae798ee437454d7af541683aeceaf87 100644 (file)
@@ -5,7 +5,7 @@
 static void mixer_test(int card, int device)
 {
        int err;
-       void *handle;
+       snd_mixer_t *handle;
        snd_mixer_info_t info;
 
        if ((err = snd_mixer_open(&handle, card, device)) < 0) {
@@ -22,23 +22,23 @@ static void mixer_test(int card, int device)
        printf("    elements - %i\n", info.elements);
        printf("    groups - %i\n", info.groups);
        printf("    switches - %i\n", info.switches);
-       printf("    attribute - 0x%x\n", info.attribute);
+       printf("    attrib - 0x%x\n", info.attrib);
        printf("    id - '%s'\n", info.id);
        printf("    name - '%s'\n", info.name);
        snd_mixer_close(handle);
 }
 
-void main(void)
+int main(void)
 {
        int idx, idx1, cards, err;
-       void *handle;
+       snd_ctl_t *handle;
        struct snd_ctl_hw_info info;
 
        cards = snd_cards();
        printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
        if (cards <= 0) {
                printf("Giving up...\n");
-               return;
+               return 0;
        }
        for (idx = 0; idx < cards; idx++) {
                if ((err = snd_ctl_open(&handle, idx)) < 0) {
@@ -53,4 +53,5 @@ void main(void)
                        mixer_test(idx, idx1);
                snd_ctl_close(handle);
        }
+       return 0;
 }
index 892b7ee164a37ce7dbe45dc534bb1e63575d2b6d..7c865ab0799041b7278e7fc6aec87041320ae92d 100644 (file)
@@ -24,20 +24,20 @@ static void show_playback_status(void *handle)
        printf("  scount = %i\n", pstatus.scount);
 }
 
-void main(void)
+int main(void)
 {
        int card = 0, device = 0, err, fd, count, count1, size, idx;
-       void *handle;
+       snd_pcm_t *handle;
        snd_pcm_format_t format;
        snd_pcm_playback_status_t status;
        char *buffer, *buffer1;
 
        buffer = (char *) malloc(512 * 1024);
        if (!buffer)
-               return;
+               return 0;
        if ((err = snd_pcm_open(&handle, card, device, SND_PCM_OPEN_PLAYBACK)) < 0) {
                fprintf(stderr, "open failed: %s\n", snd_strerror(err));
-               return;
+               return 0;
        }
        format.format = SND_PCM_SFMT_MU_LAW;
        format.rate = 8000;
@@ -45,25 +45,25 @@ void main(void)
        if ((err = snd_pcm_playback_format(handle, &format)) < 0) {
                fprintf(stderr, "format setup failed: %s\n", snd_strerror(err));
                snd_pcm_close(handle);
-               return;
+               return 0;
        }
        if ((err = snd_pcm_playback_status(handle, &status)) < 0) {
                fprintf(stderr, "status failed: %s\n", snd_strerror(err));
                snd_pcm_close(handle);
-               return;
+               return 0;
        }
        fd = open(AU_FILE, O_RDONLY);
        if (fd < 0) {
                perror("open file");
                snd_pcm_close(handle);
-               return;
+               return 0;
        }
        idx = 0;
        count = read(fd, buffer, 512 * 1024);
        if (count <= 0) {
                perror("read from file");
                snd_pcm_close(handle);
-               return;
+               return 0;
        }
        close(fd);
        if (!memcmp(buffer, ".snd", 4)) {
@@ -78,7 +78,7 @@ void main(void)
        if (count < 256 * 1024) {
                perror("small count < 256k");
                snd_pcm_close(handle);
-               return;
+               return 0;
        }
        count1 = status.fragment_size * 12;
        show_playback_status(handle);
@@ -98,4 +98,5 @@ void main(void)
        printf("Pause end.. Bytes written %i from %i...\n", size, count);
        snd_pcm_close(handle);
        free(buffer);
+       return 0;
 }
index 0c514cafd9c3b3f43cd6e7ba0b02cea7e8fd600c..6e3e0c06105f076beb16f1874ff2329dcc2d306b 100644 (file)
@@ -31,7 +31,7 @@ void setformat(void *phandle, void *rhandle)
 
 void method1(void)
 {
-       void *phandle, *rhandle;
+       snd_pcm_t *phandle, *rhandle;
        char buffer[BUFFER_SIZE];
        int err;
 
@@ -66,7 +66,7 @@ void method1(void)
 
 void method2(void)
 {
-       void *phandle, *rhandle;
+       snd_pcm_t *phandle, *rhandle;
        char buffer[BUFFER_SIZE];
        int err;
 
@@ -111,7 +111,7 @@ void method2(void)
 
 void method3(void)
 {
-       void *handle;
+       snd_pcm_t *handle;
        char buffer[BUFFER_SIZE];
        int err;
 
@@ -149,7 +149,7 @@ void method3(void)
 }
 
 
-void main(void)
+int main(void)
 {
        printf(">>>>> METHOD 1\n");
        method1();
@@ -157,4 +157,5 @@ void main(void)
        method2();
        printf(">>>>> METHOD 3\n");
        method3();
+       return 0;
 }
index d65545fda4ddd91c9b25a3e106d1de38ef3ff94f..c3b8533bda24cf9f26e4fffedd4d827a89d5c610 100644 (file)
@@ -41,7 +41,7 @@
 #include "midifile.h"          /* SMF library header */
 #include "midifile.c"          /* SMF library code */
 
-#include "sys/asoundlib.h"
+#include "../include/asoundlib.h"
 
 //#define DEST_QUEUE_NUMBER 0
 #define DEST_QUEUE_NUMBER 7
@@ -55,7 +55,7 @@
 //#define USE_REALTIME
 
 FILE *F;
-void* seq_handle = NULL;
+snd_seq_t *seq_handle = NULL;
 int ppq = 96;
 
 double local_secs = 0;
index 7142be2745a13cfed2a5a5e311073b8407f554ac..bb45f34ad4b9cf45cb15290834557b2238f3e9e1 100644 (file)
@@ -399,7 +399,7 @@ int decode_event(snd_seq_event_t * ev)
        return 0;
 }
 
-void event_decoder_start_timer(void *handle, int queue, int client, int port)
+void event_decoder_start_timer(snd_seq_t *handle, int queue, int client, int port)
 {
        int err;
        snd_seq_event_t ev;
@@ -419,7 +419,7 @@ void event_decoder_start_timer(void *handle, int queue, int client, int port)
                sleep(1);
 }
 
-void event_decoder(void *handle, int argc, char *argv[])
+void event_decoder(snd_seq_t *handle, int argc, char *argv[])
 {
        snd_seq_event_t *ev;
        snd_seq_port_info_t port;
index 644c73af55da8941efedd972f83f984aef24ae24..ffd8474f20319e3fd74f0c4e316f47fb080c7554 100644 (file)
@@ -2,7 +2,7 @@
  *  Simple event sender
  */
 
-void event_sender_start_timer(void *handle, int client, int queue)
+void event_sender_start_timer(snd_seq_t *handle, int client, int queue)
 {
        int err;
        snd_seq_event_t ev;
@@ -22,7 +22,7 @@ void event_sender_start_timer(void *handle, int client, int queue)
                sleep(1);
 }
 
-void event_sender_filter(void *handle)
+void event_sender_filter(snd_seq_t *handle)
 {
        int err;
        snd_seq_client_info_t info;
@@ -40,7 +40,7 @@ void event_sender_filter(void *handle)
        }
 }
 
-void send_event(void *handle, int queue, int client, int port,
+void send_event(snd_seq_t *handle, int queue, int client, int port,
                 snd_seq_port_subscribe_t *sub, int *time)
 {
        int err;
@@ -68,7 +68,7 @@ void send_event(void *handle, int queue, int client, int port,
                fprintf(stderr, "Event flush error: %s\n", snd_strerror(err));
 }
 
-void event_sender(void *handle, int argc, char *argv[])
+void event_sender(snd_seq_t *handle, int argc, char *argv[])
 {
        snd_seq_event_t *ev;
        snd_seq_port_info_t port;
index 45b8ce22123d0b74e6eb47fe252d6c43462f7f07..c50957f6e557ca481a9d4ef90d8f0d4fb008f7c2 100644 (file)
@@ -20,7 +20,7 @@ snd_seq_system_info_t sysinfo;
 int debug = 0;
 int verbose = 0;
 
-void set_name(void *handle)
+void set_name(snd_seq_t *handle)
 {
        int err;
        snd_seq_client_info_t info;
@@ -35,7 +35,7 @@ void set_name(void *handle)
        }
 }
 
-void system_info(void *handle)
+void system_info(snd_seq_t *handle)
 {
        int err;
        
@@ -45,7 +45,7 @@ void system_info(void *handle)
        }
 }
 
-void show_system_info(void *handle)
+void show_system_info(snd_seq_t *handle)
 {
        printf("System info\n");
        printf("  Max queues    : %i\n", sysinfo.queues);
@@ -53,7 +53,7 @@ void show_system_info(void *handle)
        printf("  Max ports     : %i\n", sysinfo.ports);
 }
 
-void show_queue_status(void *handle, int queue)
+void show_queue_status(snd_seq_t *handle, int queue)
 {
        int err, idx, min, max;
        snd_seq_queue_status_t status;
@@ -74,7 +74,7 @@ void show_queue_status(void *handle, int queue)
        }
 }
 
-void show_port_info(void *handle, int client, int port)
+void show_port_info(snd_seq_t *handle, int client, int port)
 {
        int err, idx, min, max;
        snd_seq_port_info_t info;
@@ -101,7 +101,7 @@ void show_port_info(void *handle, int client, int port)
        }
 }
 
-void show_client_info(void *handle, int client)
+void show_client_info(snd_seq_t *handle, int client)
 {
        int err, idx, min, max;
        snd_seq_client_info_t info;
@@ -142,7 +142,7 @@ static void help(void)
 int main(int argc, char *argv[])
 {
        int morehelp, err, arg, arg1;
-       void *handle;
+       snd_seq_t *handle;
        static struct option long_option[] =
        {
                {"help", 0, NULL, HELPID_HELP},
index 898a3643fbefbb537b8c7a4206b94830846586b0..124eff84af4b8c52d6e029396eb98a1710e28538 100644 (file)
@@ -4,7 +4,7 @@
 #include <errno.h>
 #include "../include/asoundlib.h"
 
-static void *ctl_handle;
+static snd_ctl_t *ctl_handle;
 static int sw_interface;
 static int sw_device;
 
@@ -168,7 +168,7 @@ void process(char *space, char *prefix, int interface, int device)
        free(list.pswitches);
 }
 
-void main(void)
+int main(void)
 {
        int cards, card, err, idx;
        snd_ctl_hw_info_t info;
@@ -177,7 +177,7 @@ void main(void)
        printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
        if (cards <= 0) {
                printf("Giving up...\n");
-               return;
+               return 0;
        }
        /* control interface */
        for (card = 0; card < cards; card++) {
@@ -199,4 +199,5 @@ void main(void)
                }
                snd_ctl_close(ctl_handle);
        }
+       return 0;
 }
index 08ba4c352157dd4e01f6d258bc648daa37869400..99fa7813b9f29b2ccac62a7e38943666c507eeb1 100644 (file)
@@ -47,13 +47,13 @@ void read_loop(void *handle, int master_ticks, int timeout)
        }
 }
 
-void main(int argc, char *argv[])
+int main(int argc, char *argv[])
 {
        int idx, err;
-       int timer = SND_TIMER_SYSTEM;
+       int timer = SND_TIMER_GLOBAL(SND_TIMER_GLOBAL_SYSTEM);
        int slave = 0;
        int slave_type = SND_TIMER_STYPE_SEQUENCER, slave_id = 0;
-       void *handle;
+       snd_timer_t *handle;
        snd_timer_general_info_t ginfo;
        snd_timer_select_t sel;
        snd_timer_info_t info;
@@ -128,4 +128,5 @@ void main(int argc, char *argv[])
        read_loop(handle, 25, sel.slave ? 10000 : 1);
        show_status(handle);
        snd_timer_close(handle);
+       return 0;
 }