4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "audiodevice.h"
26 #include "condition.inc"
27 #include "playbackconfig.inc"
30 #include <sys/soundcard.h>
32 class OSSThread : public Thread
35 OSSThread(AudioOSS *device);
39 void write_data(int fd, unsigned char *data, int bytes);
40 void read_data(int fd, unsigned char *data, int bytes);
41 // Must synchronize reads and writes
45 Condition *input_lock;
46 Condition *output_lock;
48 Condition *write_lock;
56 class AudioOSS : public AudioLowLevel
59 AudioOSS(AudioDevice *device);
64 int write_buffer(char *buffer, int bytes);
65 int read_buffer(char *buffer, int bytes);
67 int64_t device_position();
69 int interrupt_playback();
72 int get_fmt(int bits);
73 int sizetofrag(int samples, int channels, int bits);
74 int set_cloexec_flag(int desc, int value);
75 int get_output(int number);
76 int get_input(int number);
77 int dsp_in[MAXDEVICES], dsp_out[MAXDEVICES];
78 OSSThread *thread[MAXDEVICES];
79 // Temp for each device
80 unsigned char *data[MAXDEVICES];
82 int data_allocated[MAXDEVICES];