audiodriversalsa.h 1.94 KB
Newer Older
1
/**
llea's avatar
llea committed
2
 *  Copyright (C) 2004-2005 Savoir-Faire Linux inc.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *  Author:  Jerome Oufella <jerome.oufella@savoirfairelinux.com> 
 *                                                                              
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *                                                                              
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *                                                                              
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

20 21
//#ifdef AUDIO_ALSA

22 23 24 25 26 27
#ifndef _AUDIO_DRIVERS_ALSA_H_
#define _AUDIO_DRIVERS_ALSA_H_

#include <alsa/asoundlib.h>

#include "audiodrivers.h"
llea's avatar
llea committed
28
#include "../error.h"
29

30 31 32 33 34 35 36 37 38 39 40 41

/**
 * This is the ALSA implementation of DspOut.
 * Note that you cannot change how many fragments
 * this class requests, yet.
 */
class AudioDriversALSA : public AudioDrivers {
public:
	/**
	 * Constructs a AudioDriversALSA object representing the given
	 * filename.  Default is /dev/dsp.
	 */
42
	AudioDriversALSA(DeviceMode, Error*);
43 44 45 46 47 48 49 50 51 52

	/**
	 * Destructor.  Will close the device if it is open.
	 */
	virtual ~AudioDriversALSA( void );

	int 	initDevice	(DeviceMode);
	int		resetDevice	(void);	
	int 	writeBuffer	(void);
	int		readBuffer 	(void *, int);
llea's avatar
llea committed
53
	unsigned int readableBytes (void) { return 0; }
54 55
	
private:
56 57
	Error *	error;
	
llea's avatar
llea committed
58
	snd_pcm_t *audio_hdl;
llea's avatar
llea committed
59
	void closeDevice (void);
60 61 62
};

#endif  // _AUDIO_DRIVERS_ALSA_H_
63 64

//#endif // defined(AUDIO_ALSA)