diff options
Diffstat (limited to 'lib/rbcodec/dsp/dsp_sample_io.h')
-rw-r--r-- | lib/rbcodec/dsp/dsp_sample_io.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/rbcodec/dsp/dsp_sample_io.h b/lib/rbcodec/dsp/dsp_sample_io.h new file mode 100644 index 0000000000..443038919d --- /dev/null +++ b/lib/rbcodec/dsp/dsp_sample_io.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2012 Michael Sevakis | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef DSP_SAMPLE_IO_H | ||
22 | #define DSP_SAMPLE_IO_H | ||
23 | |||
24 | /* 16-bit samples are scaled based on these constants. The shift should be | ||
25 | * no more than 15. | ||
26 | */ | ||
27 | #define WORD_SHIFT 12 | ||
28 | #define WORD_FRACBITS 27 | ||
29 | #define NATIVE_DEPTH 16 | ||
30 | |||
31 | #define SAMPLE_BUF_COUNT 128 /* Per channel, per DSP */ | ||
32 | |||
33 | struct sample_io_data; | ||
34 | |||
35 | /* DSP initial buffer input function call prototype */ | ||
36 | typedef void (*sample_input_fn_type)(struct sample_io_data *this, | ||
37 | struct dsp_buffer **buf_p); | ||
38 | |||
39 | /* DSP final buffer output function call prototype */ | ||
40 | typedef void (*sample_output_fn_type)(struct sample_io_data *this, | ||
41 | struct dsp_buffer *src, | ||
42 | struct dsp_buffer *dst); | ||
43 | |||
44 | /* This becomes part of the DSP aggregate */ | ||
45 | struct sample_io_data | ||
46 | { | ||
47 | int outcount; /* 00h: Output count */ | ||
48 | struct sample_format format; /* General format info */ | ||
49 | int sample_depth; /* Codec-specified sample depth */ | ||
50 | int stereo_mode; /* Codec-specified input format */ | ||
51 | sample_input_fn_type input_samples[2]; /* input functions */ | ||
52 | struct dsp_buffer sample_buf; /* Buffer descriptor for converted samples */ | ||
53 | int32_t sample_buf_arr[2][SAMPLE_BUF_COUNT]; /* Internal format */ | ||
54 | sample_output_fn_type output_samples[2]; /* Final output functions */ | ||
55 | }; | ||
56 | |||
57 | /* Sample IO watches the format setting from the codec */ | ||
58 | void dsp_sample_io_configure(struct sample_io_data *this, | ||
59 | unsigned int setting, | ||
60 | intptr_t value); | ||
61 | |||
62 | #endif /* DSP_SAMPLE_IO_H */ | ||