diff options
Diffstat (limited to 'sound/oss/emu10k1/passthrough.h')
-rw-r--r-- | sound/oss/emu10k1/passthrough.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/sound/oss/emu10k1/passthrough.h b/sound/oss/emu10k1/passthrough.h new file mode 100644 index 000000000000..420cc9784251 --- /dev/null +++ b/sound/oss/emu10k1/passthrough.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | ********************************************************************** | ||
3 | * passthrough.h -- Emu10k1 digital passthrough header file | ||
4 | * Copyright (C) 2001 Juha Yrjölä <jyrjola@cc.hut.fi> | ||
5 | * | ||
6 | ********************************************************************** | ||
7 | * | ||
8 | * Date Author Summary of changes | ||
9 | * ---- ------ ------------------ | ||
10 | * May 15, 2001 Juha Yrjölä base code release | ||
11 | * | ||
12 | ********************************************************************** | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public | ||
25 | * License along with this program; if not, write to the Free | ||
26 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, | ||
27 | * USA. | ||
28 | * | ||
29 | ********************************************************************** | ||
30 | */ | ||
31 | |||
32 | #ifndef _PASSTHROUGH_H | ||
33 | #define _PASSTHROUGH_H | ||
34 | |||
35 | #include "audio.h" | ||
36 | |||
37 | /* number of 16-bit stereo samples in XTRAM buffer */ | ||
38 | #define PT_SAMPLES 0x8000 | ||
39 | #define PT_BLOCKSAMPLES 0x400 | ||
40 | #define PT_BLOCKSIZE (PT_BLOCKSAMPLES*4) | ||
41 | #define PT_BLOCKSIZE_LOG2 12 | ||
42 | #define PT_BLOCKCOUNT (PT_SAMPLES/PT_BLOCKSAMPLES) | ||
43 | #define PT_INITPTR (PT_SAMPLES/2-1) | ||
44 | |||
45 | #define PT_STATE_INACTIVE 0 | ||
46 | #define PT_STATE_ACTIVATED 1 | ||
47 | #define PT_STATE_PLAYING 2 | ||
48 | |||
49 | /* passthrough struct */ | ||
50 | struct pt_data | ||
51 | { | ||
52 | u8 selected, state, spcs_to_use; | ||
53 | int intr_gpr, enable_gpr, pos_gpr; | ||
54 | u32 blocks_played, blocks_copied, old_spcs[3]; | ||
55 | u32 playptr, copyptr; | ||
56 | u32 prepend_size; | ||
57 | u8 *buf; | ||
58 | u8 ac3data; | ||
59 | |||
60 | char *patch_name, *intr_gpr_name, *enable_gpr_name, *pos_gpr_name; | ||
61 | |||
62 | wait_queue_head_t wait; | ||
63 | spinlock_t lock; | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | Passthrough can be done in two methods: | ||
68 | |||
69 | Method 1 : tram | ||
70 | In original emu10k1, we couldn't bypass the sample rate converters. Even at 48kHz | ||
71 | (the internal sample rate of the emu10k1) the samples would get messed up. | ||
72 | To over come this, samples are copied into the tram and a special dsp patch copies | ||
73 | the samples out and generates interrupts when a block has finnished playing. | ||
74 | |||
75 | Method 2 : Interpolator bypass | ||
76 | |||
77 | Creative fixed the sample rate convert problem in emu10k1 rev 7 and higher | ||
78 | (including the emu10k2 (audigy)). This allows us to use the regular, and much simpler | ||
79 | playback method. | ||
80 | |||
81 | |||
82 | In both methods, dsp code is used to mux audio and passthrough. This ensures that the spdif | ||
83 | doesn't receive audio and pasthrough data at the same time. The spdif flag SPCS_NOTAUDIODATA | ||
84 | is set to tell | ||
85 | |||
86 | */ | ||
87 | |||
88 | // emu10k1 revs greater than or equal to 7 can use method2 | ||
89 | |||
90 | #define USE_PT_METHOD2 (card->is_audigy) | ||
91 | #define USE_PT_METHOD1 !USE_PT_METHOD2 | ||
92 | |||
93 | ssize_t emu10k1_pt_write(struct file *file, const char __user *buf, size_t count); | ||
94 | |||
95 | int emu10k1_pt_setup(struct emu10k1_wavedevice *wave_dev); | ||
96 | void emu10k1_pt_stop(struct emu10k1_card *card); | ||
97 | void emu10k1_pt_waveout_update(struct emu10k1_wavedevice *wave_dev); | ||
98 | |||
99 | #endif /* _PASSTHROUGH_H */ | ||