4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "audiodevice.h"
27 #include "condition.inc"
28 #include "playbackconfig.inc"
31 #include <sys/soundcard.h>
33 class OSSThread : public Thread
36 OSSThread(AudioOSS *device);
40 void write_data(int fd, unsigned char *data, int bytes);
41 void read_data(int fd, unsigned char *data, int bytes);
42 // Must synchronize reads and writes
45 int64_t device_position();
47 Condition *input_lock;
48 Condition *output_lock;
50 Condition *write_lock;
57 int64_t bytes_written;
64 class AudioOSS : public AudioLowLevel
67 AudioOSS(AudioDevice *device);
72 int write_buffer(char *buffer, int bytes);
73 int read_buffer(char *buffer, int bytes);
75 int64_t device_position();
77 int interrupt_playback();
78 int stop_output() { return interrupt_playback(); }
79 int64_t samples_output();
82 int get_fmt(int bits);
83 int sizetofrag(int samples, int channels, int bits);
84 int set_cloexec_flag(int desc, int value);
85 int get_output(int number);
86 int get_input(int number);
87 int dsp_in[MAXDEVICES], dsp_out[MAXDEVICES];
88 OSSThread *thread[MAXDEVICES];
89 // Temp for each device, Bytes allocated
90 unsigned char *data[MAXDEVICES];
91 int data_allocated[MAXDEVICES];