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
44 int64_t device_position();
46 Condition *input_lock;
47 Condition *output_lock;
49 Condition *write_lock;
56 int64_t bytes_written;
63 class AudioOSS : public AudioLowLevel
66 AudioOSS(AudioDevice *device);
71 int write_buffer(char *buffer, int bytes);
72 int read_buffer(char *buffer, int bytes);
74 int64_t device_position();
76 int interrupt_playback();
79 int get_fmt(int bits);
80 int sizetofrag(int samples, int channels, int bits);
81 int set_cloexec_flag(int desc, int value);
82 int get_output(int number);
83 int get_input(int number);
84 int dsp_in[MAXDEVICES], dsp_out[MAXDEVICES];
85 OSSThread *thread[MAXDEVICES];
86 // Temp for each device, Bytes allocated
87 unsigned char *data[MAXDEVICES];
88 int data_allocated[MAXDEVICES];