source: roaraudio/plugins/alsa/roar.h @ 5168:38e69b0d26e0

Last change on this file since 5168:38e69b0d26e0 was 5168:38e69b0d26e0, checked in by phi, 13 years ago

added support to set stream role

File size: 2.8 KB
Line 
1//roar.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2011
5 *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010
6 *
7 *  This file is part of libroar a part of RoarAudio,
8 *  a cross-platform sound system for both, home and professional use.
9 *  See README for details.
10 *
11 *  This file is free software; you can redistribute it and/or modify
12 *  it under the terms of the GNU General Public License version 3
13 *  as published by the Free Software Foundation.
14 *
15 *  libroar is distributed in the hope that it will be useful,
16 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *  GNU General Public License for more details.
19 *
20 *  You should have received a copy of the GNU General Public License
21 *  along with this software; see the file COPYING.  If not, write to
22 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23 *  Boston, MA 02110-1301, USA.
24 *
25 *  NOTE for everyone want's to change something and send patches:
26 *  read README and HACKING! There a addition information on
27 *  the license of this document you need to read before you send
28 *  any patches.
29 *
30 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
31 *  or libpulse*:
32 *  The libs libroaresd, libroararts and libroarpulse link this lib
33 *  and are therefore GPL. Because of this it may be illigal to use
34 *  them with any software that uses libesd, libartsc or libpulse*.
35 */
36
37#ifndef _ROARAUDIO_PLUGINS_ALSA_ROAR_H_
38#define _ROARAUDIO_PLUGINS_ALSA_ROAR_H_
39
40#include <roaraudio.h>
41#include <errno.h>
42#include <alsa/asoundlib.h>
43#include <alsa/global.h>
44#include <alsa/pcm_external.h>
45#include <alsa/control_external.h>
46#include <pthread.h>
47#include <time.h>
48
49#define _as(x) (sizeof((x))/sizeof(*(x)))
50
51struct roar_alsa {
52 struct roar_connection con;
53};
54
55struct roar_alsa_pcm {
56 snd_pcm_ioplug_t       io;
57 struct roar_alsa       roar;
58 struct roar_audio_info info;
59 struct roar_stream     stream;
60 struct roar_vio_calls  stream_vio;
61 int                    stream_role;
62 int                    stream_opened;
63 size_t                 writec;
64 size_t                 last_ptr;
65 char*                  buffer;
66 size_t                 bufsize;
67 volatile size_t        bufptr;
68 pthread_t              thread;
69 pthread_mutex_t        lock;
70 pthread_mutex_t        cond_lock;
71 pthread_cond_t         cond;
72 volatile int           thread_active;
73 int                    bytes_in_buffer;
74 volatile int64_t       total_written;
75 int                    has_written;
76 struct timespec        start_tv;
77};
78
79void roar_plugin_reset(struct roar_alsa_pcm * self);
80void* roar_plugin_thread (void * thread_data);
81size_t roar_plugin_write(struct roar_alsa_pcm * self, const char * buf, size_t size);
82void roar_plugin_drain(struct roar_alsa_pcm * self);
83
84#endif
85
86//ll
Note: See TracBrowser for help on using the repository browser.