00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <errno.h>
00028 #include <unistd.h>
00029
00030 #include "defaults.h"
00031
00032 #if HAVE_ALSA_ASOUNDLIB_H
00033 #define ALSA_PCM_NEW_HW_PARAMS_API
00034 #define ALSA_PCM_NEW_SW_PARAMS_API
00035 #include <alsa/asoundlib.h>
00036 #include <sys/time.h>
00037 #endif
00038
00039 #if defined (__linux__)
00040 #include <fcntl.h>
00041 #include <sys/ioctl.h>
00042 #include <sys/soundcard.h>
00043 #endif
00044
00045 #include <sndfile.h>
00046
00047 #define SIGNED_SIZEOF(x) ((int) sizeof (x))
00048 #define _BUFFER_LEN (2048)
00049
00050 void sndfile_play (char *file);
00051
00052
00053
00054
00055
00056 #if HAVE_ALSA_ASOUNDLIB_H
00057 static snd_pcm_t * alsa_open (int channels, int srate) ;
00058 static int alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels) ;
00059
00060 static void alsa_play (char *file);
00061 static snd_pcm_t *alsa_open (int channels, int samplerate);
00062 static int alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels);
00063 #endif
00064
00065
00066
00067
00068
00069 #if defined (__linux__)
00070
00071 static int linux_open_dsp_device (int channels, int srate) ;
00072
00073 static void linux_play (char *file);
00074 static int linux_open_dsp_device (int channels, int srate);
00075
00076 #endif