root / audio / audio.h @ afc7df11
History | View | Annotate | Download (2.2 kB)
1 | 85571bc7 | bellard | /*
|
---|---|---|---|
2 | 85571bc7 | bellard | * QEMU Audio subsystem header
|
3 | 85571bc7 | bellard | *
|
4 | 85571bc7 | bellard | * Copyright (c) 2003-2004 Vassili Karpov (malc)
|
5 | 85571bc7 | bellard | *
|
6 | 85571bc7 | bellard | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 85571bc7 | bellard | * of this software and associated documentation files (the "Software"), to deal
|
8 | 85571bc7 | bellard | * in the Software without restriction, including without limitation the rights
|
9 | 85571bc7 | bellard | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 85571bc7 | bellard | * copies of the Software, and to permit persons to whom the Software is
|
11 | 85571bc7 | bellard | * furnished to do so, subject to the following conditions:
|
12 | 85571bc7 | bellard | *
|
13 | 85571bc7 | bellard | * The above copyright notice and this permission notice shall be included in
|
14 | 85571bc7 | bellard | * all copies or substantial portions of the Software.
|
15 | 85571bc7 | bellard | *
|
16 | 85571bc7 | bellard | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 85571bc7 | bellard | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 85571bc7 | bellard | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 85571bc7 | bellard | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 85571bc7 | bellard | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 85571bc7 | bellard | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 85571bc7 | bellard | * THE SOFTWARE.
|
23 | 85571bc7 | bellard | */
|
24 | 85571bc7 | bellard | #ifndef QEMU_AUDIO_H
|
25 | 85571bc7 | bellard | #define QEMU_AUDIO_H
|
26 | 85571bc7 | bellard | |
27 | 85571bc7 | bellard | #include "mixeng.h" |
28 | 85571bc7 | bellard | |
29 | 85571bc7 | bellard | typedef enum { |
30 | 85571bc7 | bellard | AUD_FMT_U8, |
31 | 85571bc7 | bellard | AUD_FMT_S8, |
32 | 85571bc7 | bellard | AUD_FMT_U16, |
33 | 85571bc7 | bellard | AUD_FMT_S16 |
34 | 85571bc7 | bellard | } audfmt_e; |
35 | 85571bc7 | bellard | |
36 | fb065187 | bellard | typedef struct SWVoice SWVoice; |
37 | 85571bc7 | bellard | |
38 | 85571bc7 | bellard | SWVoice * AUD_open (SWVoice *sw, const char *name, int freq, |
39 | 85571bc7 | bellard | int nchannels, audfmt_e fmt);
|
40 | fb065187 | bellard | void AUD_init (void); |
41 | fb065187 | bellard | void AUD_log (const char *cap, const char *fmt, ...) |
42 | fb065187 | bellard | __attribute__ ((__format__ (__printf__, 2, 3)));; |
43 | fb065187 | bellard | void AUD_close (SWVoice *sw);
|
44 | 85571bc7 | bellard | int AUD_write (SWVoice *sw, void *pcm_buf, int size); |
45 | 85571bc7 | bellard | void AUD_adjust (SWVoice *sw, int leftover); |
46 | 85571bc7 | bellard | void AUD_reset (SWVoice *sw);
|
47 | 85571bc7 | bellard | int AUD_get_free (SWVoice *sw);
|
48 | 85571bc7 | bellard | int AUD_get_buffer_size (SWVoice *sw);
|
49 | 85571bc7 | bellard | void AUD_run (void); |
50 | 85571bc7 | bellard | void AUD_enable (SWVoice *sw, int on); |
51 | 85571bc7 | bellard | int AUD_calc_elapsed (SWVoice *sw);
|
52 | 85571bc7 | bellard | |
53 | 85571bc7 | bellard | static inline void *advance (void *p, int incr) |
54 | 85571bc7 | bellard | { |
55 | 85571bc7 | bellard | uint8_t *d = p; |
56 | 85571bc7 | bellard | return (d + incr);
|
57 | 85571bc7 | bellard | } |
58 | 85571bc7 | bellard | |
59 | 85571bc7 | bellard | uint32_t popcount (uint32_t u); |
60 | 85571bc7 | bellard | inline uint32_t lsbindex (uint32_t u);
|
61 | 85571bc7 | bellard | |
62 | 85571bc7 | bellard | #define audio_MIN(a, b) ((a)>(b)?(b):(a))
|
63 | 85571bc7 | bellard | #define audio_MAX(a, b) ((a)<(b)?(b):(a))
|
64 | 85571bc7 | bellard | |
65 | 85571bc7 | bellard | #endif /* audio.h */ |