sndfile-play.h

Go to the documentation of this file.
00001 /*
00002 mcv: adapted from sndfile-play.c, that is an example available in libsndfile library for play wav files.
00003 */
00004 
00005 
00006 /*
00007 ** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
00008 **
00009 ** This program is free software; you can redistribute it and/or modify
00010 ** it under the terms of the GNU General Public License as published by
00011 ** the Free Software Foundation; either version 2 of the License, or
00012 ** (at your option) any later version.
00013 **
00014 ** This program is distributed in the hope that it will be useful,
00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 ** GNU General Public License for more details.
00018 **
00019 ** You should have received a copy of the GNU General Public License
00020 ** along with this program; if not, write to the Free Software
00021 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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); //mcv
00051 
00052 /*------------------------------------------------------------------------------
00053 **      Linux/OSS functions for playing a sound.
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   //mcv: static void alsa_play (int argc, char *argv []);
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 /* HAVE_ALSA_ASOUNDLIB_H */
00064 
00065 
00066 /*------------------------------------------------------------------------------
00067 **      Linux/OSS functions for playing a sound.
00068 */
00069 #if defined (__linux__)
00070 
00071   static int linux_open_dsp_device (int channels, int srate) ;
00072   //mcv: static void linux_play (int argc, char *argv []);
00073   static void linux_play (char *file);
00074   static int linux_open_dsp_device (int channels, int srate);
00075   
00076 #endif /* __linux__ */

Generated on Tue Jan 22 17:07:29 2008 for MUAN by  doxygen 1.4.7