/**************************************************************************************** * Class: sndbuf * * Purpose: hold several channels of sound buffer data * * Author: Luke Scharf (lscharf@vt.edu) * * History: * 05-25-2000: Start work. ***************************************************************************************/ /******************************* * Multiple Include Protection * *****************************/ #ifndef _SNDBUF_H_ #define _SNDBUF_H_ /************ * Includes * *********/ #include #include #include #include #include #include #include #include #include #include #include #include "sndbuf_config.h" /***************** * Class: sndbuf * **************/ class sndbuf { //-- Data -- private: int audio_fd; //File descriptor BUF_TYPE** buf; //The buffer we'll allocate int chan_max; //The the number of channels we'll allocate int samp_max; //The number of samples we'll allocate public: int chan; //The number of channels we're using int samp; //The number of samples we're using //-- Structors -- public: sndbuf(int new_chan_max, int new_samp_max); ~sndbuf(); //-- Info Methods -- public: int get_chan_max(){return chan_max;}; int get_samp_max(){return samp_max;}; //-- I/O Methods -- public: void dsp_open(char* device); //Open sound board void dsp_close(); //Close sound board void dsp_capture(); //Capture a bufferfull of sound void dsp_play(); //Play the first two channels void dsp_play(int chan_idxs[], int chan_idxs_size); //Play specified channels void file_read(char* name); //Read data from a file void file_write(char* name); //Write data to a file //-- Operators -- public: inline BUF_TYPE* operator[](int i) { /*assert(i