summaryrefslogtreecommitdiffstats
path: root/sound/oss/emu10k1/voicemgr.h
blob: 099a8cb7f2c515ec8ed4df41b3ad2a74d952f806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
 **********************************************************************
 *     sblive_voice.h -- EMU Voice Resource Manager header file
 *     Copyright 1999, 2000 Creative Labs, Inc.
 *
 **********************************************************************
 *
 *     Date                 Author          Summary of changes
 *     ----                 ------          ------------------
 *     October 20, 1999     Bertrand Lee    base code release
 *
 **********************************************************************
 *
 *     This program is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of
 *     the License, or (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public
 *     License along with this program; if not, write to the Free
 *     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
 *     USA.
 *
 **********************************************************************
 */

#ifndef _VOICEMGR_H
#define _VOICEMGR_H

#include "hwaccess.h"

/* struct emu_voice.usage flags */
#define VOICE_USAGE_FREE		0x01
#define VOICE_USAGE_MIDI		0x02
#define VOICE_USAGE_PLAYBACK		0x04

/* struct emu_voice.flags flags */
#define VOICE_FLAGS_STEREO		0x02
#define VOICE_FLAGS_16BIT		0x04

struct voice_param
{
	/* FX bus amount send */

	u32 send_routing;
	// audigy only:
	u32 send_routing2;

	u32 send_dcba;
	// audigy only:
	u32 send_hgfe;


	u32 initial_fc;
	u32 fc_target;

	u32 initial_attn;
	u32 volume_target;

	u32 byampl_env_sustain;
	u32 byampl_env_decay;
};

struct voice_mem {
	int emupageindex;
	void *addr[BUFMAXPAGES];
	dma_addr_t dma_handle[BUFMAXPAGES];
	u32 pages;
};

struct emu_voice
{
	struct emu10k1_card *card;
	u8 usage;		/* Free, MIDI, playback */
	u8 num;			/* Voice ID */
	u8 flags;		/* Stereo/mono, 8/16 bit */

	u32 startloop;
	u32 endloop;
	u32 start;

	u32 initial_pitch;
	u32 pitch_target;

	struct voice_param params[2];

	struct voice_mem mem;
};

int emu10k1_voice_alloc_buffer(struct emu10k1_card *, struct voice_mem *, u32);
void emu10k1_voice_free_buffer(struct emu10k1_card *, struct voice_mem *);
int emu10k1_voice_alloc(struct emu10k1_card *, struct emu_voice *);
void emu10k1_voice_free(struct emu_voice *);
void emu10k1_voice_playback_setup(struct emu_voice *);
void emu10k1_voices_start(struct emu_voice *, unsigned int, int);
void emu10k1_voices_stop(struct emu_voice *, int);

#endif /* _VOICEMGR_H */