@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
#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) {
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;
}
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;
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) {
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;
}
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) {
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) {
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) {
mixer_test(idx, idx1);
snd_ctl_close(handle);
}
+ return 0;
}
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;
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)) {
if (count < 256 * 1024) {
perror("small count < 256k");
snd_pcm_close(handle);
- return;
+ return 0;
}
count1 = status.fragment_size * 12;
show_playback_status(handle);
printf("Pause end.. Bytes written %i from %i...\n", size, count);
snd_pcm_close(handle);
free(buffer);
+ return 0;
}
void method1(void)
{
- void *phandle, *rhandle;
+ snd_pcm_t *phandle, *rhandle;
char buffer[BUFFER_SIZE];
int err;
void method2(void)
{
- void *phandle, *rhandle;
+ snd_pcm_t *phandle, *rhandle;
char buffer[BUFFER_SIZE];
int err;
void method3(void)
{
- void *handle;
+ snd_pcm_t *handle;
char buffer[BUFFER_SIZE];
int err;
}
-void main(void)
+int main(void)
{
printf(">>>>> METHOD 1\n");
method1();
method2();
printf(">>>>> METHOD 3\n");
method3();
+ return 0;
}
#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
//#define USE_REALTIME
FILE *F;
-void* seq_handle = NULL;
+snd_seq_t *seq_handle = NULL;
int ppq = 96;
double local_secs = 0;
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;
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;
* 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;
sleep(1);
}
-void event_sender_filter(void *handle)
+void event_sender_filter(snd_seq_t *handle)
{
int err;
snd_seq_client_info_t info;
}
}
-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;
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;
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;
}
}
-void system_info(void *handle)
+void system_info(snd_seq_t *handle)
{
int err;
}
}
-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);
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;
}
}
-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;
}
}
-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;
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},
#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;
free(list.pswitches);
}
-void main(void)
+int main(void)
{
int cards, card, err, idx;
snd_ctl_hw_info_t info;
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++) {
}
snd_ctl_close(ctl_handle);
}
+ return 0;
}
}
}
-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;
read_loop(handle, 25, sel.slave ? 10000 : 1);
show_status(handle);
snd_timer_close(handle);
+ return 0;
}