summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>1999-06-03 21:41:29 +0000
committerJaroslav Kysela <perex@perex.cz>1999-06-03 21:41:29 +0000
commitc6d9012d5578e206cfcc9594cdae9647c2557298 (patch)
tree2d034549b6d7908efbbff1a682c4a0aef31e41ae /test
parent3d5115b325d13eec8a886d323a694adf818547ab (diff)
downloadalsa-lib-c6d9012d5578e206cfcc9594cdae9647c2557298.tar.gz
Fixes for new types...
Diffstat (limited to 'test')
-rw-r--r--test/control.c11
-rw-r--r--test/latency.c13
-rw-r--r--test/loopback.c2
-rw-r--r--test/mixer.c11
-rw-r--r--test/pause.c19
-rw-r--r--test/pcm.c9
-rw-r--r--test/playmidi1.c4
-rw-r--r--test/seq-decoder.c4
-rw-r--r--test/seq-sender.c8
-rw-r--r--test/seq.c14
-rw-r--r--test/switches.c7
-rw-r--r--test/timer.c7
12 files changed, 58 insertions, 51 deletions
diff --git a/test/control.c b/test/control.c
index c8d67478..d8a6edd1 100644
--- a/test/control.c
+++ b/test/control.c
@@ -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;
}
diff --git a/test/latency.c b/test/latency.c
index 87a8c1e5..f03b6f0b 100644
--- a/test/latency.c
+++ b/test/latency.c
@@ -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;
}
diff --git a/test/loopback.c b/test/loopback.c
index c74e83f0..f39c2d00 100644
--- a/test/loopback.c
+++ b/test/loopback.c
@@ -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) {
diff --git a/test/mixer.c b/test/mixer.c
index 3550acbe..34dd3756 100644
--- a/test/mixer.c
+++ b/test/mixer.c
@@ -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;
}
diff --git a/test/pause.c b/test/pause.c
index 892b7ee1..7c865ab0 100644
--- a/test/pause.c
+++ b/test/pause.c
@@ -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;
}
diff --git a/test/pcm.c b/test/pcm.c
index 0c514caf..6e3e0c06 100644
--- a/test/pcm.c
+++ b/test/pcm.c
@@ -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;
}
diff --git a/test/playmidi1.c b/test/playmidi1.c
index d65545fd..c3b8533b 100644
--- a/test/playmidi1.c
+++ b/test/playmidi1.c
@@ -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;
diff --git a/test/seq-decoder.c b/test/seq-decoder.c
index 7142be27..bb45f34a 100644
--- a/test/seq-decoder.c
+++ b/test/seq-decoder.c
@@ -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;
diff --git a/test/seq-sender.c b/test/seq-sender.c
index 644c73af..ffd8474f 100644
--- a/test/seq-sender.c
+++ b/test/seq-sender.c
@@ -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;
diff --git a/test/seq.c b/test/seq.c
index 45b8ce22..c50957f6 100644
--- a/test/seq.c
+++ b/test/seq.c
@@ -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},
diff --git a/test/switches.c b/test/switches.c
index 898a3643..124eff84 100644
--- a/test/switches.c
+++ b/test/switches.c
@@ -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;
}
diff --git a/test/timer.c b/test/timer.c
index 08ba4c35..99fa7813 100644
--- a/test/timer.c
+++ b/test/timer.c
@@ -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;
}