2011-06-08 23:00:22 +02:00
|
|
|
/*
|
|
|
|
* simpleaudio.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
|
|
|
|
*
|
2011-06-23 02:10:50 +02:00
|
|
|
* 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2011-06-08 23:00:22 +02:00
|
|
|
*
|
2011-06-23 02:10:50 +02:00
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
2011-06-08 23:00:22 +02:00
|
|
|
*/
|
|
|
|
|
2011-05-30 07:20:28 +02:00
|
|
|
#ifndef SIMPLEAUDIO_H
|
|
|
|
#define SIMPLEAUDIO_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
struct simpleaudio;
|
|
|
|
typedef struct simpleaudio simpleaudio;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* simpleaudio_open_source_XXXX() routines which return a (simpleaudio *)
|
|
|
|
* are provided by the separate backend modules.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-06-17 23:21:31 +02:00
|
|
|
enum {
|
|
|
|
SA_STREAM_PLAYBACK,
|
|
|
|
SA_STREAM_RECORD,
|
|
|
|
};
|
|
|
|
|
2011-05-30 07:20:28 +02:00
|
|
|
simpleaudio *
|
2011-06-17 23:21:31 +02:00
|
|
|
simpleaudio_open_stream_pulseaudio(
|
2011-05-30 07:20:28 +02:00
|
|
|
// unsigned int rate, unsigned int channels,
|
2011-06-17 23:21:31 +02:00
|
|
|
int sa_stream_direction,
|
2011-05-30 07:20:28 +02:00
|
|
|
char *app_name, char *stream_name );
|
|
|
|
|
|
|
|
simpleaudio *
|
2011-06-19 18:40:49 +02:00
|
|
|
simpleaudio_open_stream_sndfile(
|
|
|
|
int sa_stream_direction,
|
|
|
|
char *path );
|
2011-05-30 07:20:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* common simpleaudio_ API routines available to any backend:
|
|
|
|
*/
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
simpleaudio_get_rate( simpleaudio *sa );
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
simpleaudio_get_channels( simpleaudio *sa );
|
|
|
|
|
2011-06-08 01:31:26 +02:00
|
|
|
ssize_t
|
2011-05-30 07:20:28 +02:00
|
|
|
simpleaudio_read( simpleaudio *sa, float *buf, size_t nframes );
|
|
|
|
|
2011-06-17 23:21:31 +02:00
|
|
|
ssize_t
|
|
|
|
simpleaudio_write( simpleaudio *sa, float *buf, size_t nframes );
|
|
|
|
|
2011-05-30 07:20:28 +02:00
|
|
|
void
|
|
|
|
simpleaudio_close( simpleaudio *sa );
|
|
|
|
|
|
|
|
|
2011-06-18 20:29:00 +02:00
|
|
|
/*
|
|
|
|
* simpleaudio tone generator
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
simpleaudio_tone_reset();
|
|
|
|
|
|
|
|
void
|
|
|
|
simpleaudio_tone(simpleaudio *sa_out, float tone_freq, size_t nsamples_dur);
|
|
|
|
|
|
|
|
|
2011-05-30 07:20:28 +02:00
|
|
|
#endif
|