[3133] | 1 | //roar.h: |
---|
| 2 | |
---|
| 3 | /* |
---|
[4708] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2011 |
---|
[4167] | 5 | * Copyright (C) Hans-Kristian 'maister' Arntzen - 2010 |
---|
[3133] | 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 |
---|
[3517] | 22 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 23 | * Boston, MA 02110-1301, USA. |
---|
[3133] | 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 | * |
---|
[4167] | 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*. |
---|
[3133] | 35 | */ |
---|
| 36 | |
---|
| 37 | #ifndef _ROARAUDIO_PLUGINS_ALSA_ROAR_H_ |
---|
| 38 | #define _ROARAUDIO_PLUGINS_ALSA_ROAR_H_ |
---|
| 39 | |
---|
| 40 | #include <roaraudio.h> |
---|
[3134] | 41 | #include <errno.h> |
---|
| 42 | #include <alsa/asoundlib.h> |
---|
[3135] | 43 | #include <alsa/global.h> |
---|
[3134] | 44 | #include <alsa/pcm_external.h> |
---|
| 45 | #include <alsa/control_external.h> |
---|
[4167] | 46 | #include <pthread.h> |
---|
| 47 | #include <time.h> |
---|
[3134] | 48 | |
---|
| 49 | #define _as(x) (sizeof((x))/sizeof(*(x))) |
---|
| 50 | |
---|
| 51 | struct roar_alsa { |
---|
| 52 | struct roar_connection con; |
---|
| 53 | }; |
---|
| 54 | |
---|
| 55 | struct 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_opened; |
---|
[3658] | 62 | size_t writec; |
---|
[4167] | 63 | size_t last_ptr; |
---|
| 64 | char* buffer; |
---|
| 65 | size_t bufsize; |
---|
[4177] | 66 | volatile size_t bufptr; |
---|
[4167] | 67 | pthread_t thread; |
---|
| 68 | pthread_mutex_t lock; |
---|
| 69 | pthread_mutex_t cond_lock; |
---|
| 70 | pthread_cond_t cond; |
---|
| 71 | volatile int thread_active; |
---|
| 72 | int bytes_in_buffer; |
---|
| 73 | volatile int64_t total_written; |
---|
| 74 | int has_written; |
---|
| 75 | struct timespec start_tv; |
---|
[3134] | 76 | }; |
---|
[3133] | 77 | |
---|
[4167] | 78 | void roar_reset(struct roar_alsa_pcm * self); |
---|
| 79 | void* roar_thread (void * thread_data); |
---|
| 80 | size_t roar_write(struct roar_alsa_pcm * self, const char * buf, size_t size); |
---|
| 81 | void roar_drain(struct roar_alsa_pcm * self); |
---|
| 82 | |
---|
[3133] | 83 | #endif |
---|
| 84 | |
---|
| 85 | //ll |
---|