summaryrefslogtreecommitdiff
path: root/drivers/oss/oss_driver.h
blob: 5bdf12da9fc56b09e8d9eb68bc36c1120f0cf4f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*

	OSS driver for Jack
	Copyright (C) 2003-2007 Jussi Laako <jussi@sonarnerd.net>

	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 2 of the License, or
	(at your option) any later version.

	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, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
	MA  02111-1307  USA

*/


#ifndef __JACK_OSS_DRIVER_H__
#define __JACK_OSS_DRIVER_H__

#include <sys/types.h>
#include <pthread.h>
#include <semaphore.h>

#include <jack/types.h>
#include <jack/jslist.h>
#include <jack/jack.h>

#include "driver.h"


#define OSS_DRIVER_DEF_DEV	"/dev/dsp"
#define OSS_DRIVER_DEF_FS	48000
#define OSS_DRIVER_DEF_BLKSIZE	1024
#define OSS_DRIVER_DEF_NPERIODS	2
#define OSS_DRIVER_DEF_BITS	16
#define OSS_DRIVER_DEF_INS	2
#define OSS_DRIVER_DEF_OUTS	2


typedef jack_default_audio_sample_t jack_sample_t;

typedef struct _oss_driver
{
	JACK_DRIVER_DECL

	jack_nframes_t sample_rate;
	jack_nframes_t period_size;
	unsigned int nperiods;
	int bits;
	unsigned int capture_channels;
	unsigned int playback_channels;

	char *indev;
	char *outdev;
	int infd;
	int outfd;
	int format;
	int ignorehwbuf;
	int trigger;

	size_t indevbufsize;
	size_t outdevbufsize;
	size_t portbufsize;
	void *indevbuf;
	void *outdevbuf;

	float iodelay;
	jack_time_t last_periodtime;
	jack_time_t next_periodtime;
	jack_nframes_t sys_in_latency;
	jack_nframes_t sys_out_latency;

	JSList *capture_ports;
	JSList *playback_ports;

	jack_engine_t *engine;
	jack_client_t *client;

	volatile int run;
	volatile int threads;
	pthread_t thread_in;
	pthread_t thread_out;
	pthread_mutex_t mutex_in;
	pthread_mutex_t mutex_out;
#	ifdef USE_BARRIER
	pthread_barrier_t barrier;
#	endif
	sem_t sem_start;
} oss_driver_t;


#endif