File: ainstr_simple.h

package info (click to toggle)
alsadriver 0.4.1i-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,256 kB
  • ctags: 15,024
  • sloc: ansic: 96,846; makefile: 1,232; sh: 1,051; perl: 54
file content (141 lines) | stat: -rw-r--r-- 4,264 bytes parent folder | download | duplicates (2)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 *  Advanced Linux Sound Architecture
 *
 *  Simple (MOD player) Instrument Format
 *  Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
 *
 *
 *   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 __AINSTR_SIMPLE_H
#define __AINSTR_SIMPLE_H

#ifndef __KERNEL__
#include <asm/types.h>
#endif

/*
 *  share types (share ID 1)
 */

#define SIMPLE_SHARE_FILE		0

/*
 *  wave formats
 */

#define SIMPLE_WAVE_16BIT		0x0001  /* 16-bit wave */
#define SIMPLE_WAVE_UNSIGNED		0x0002  /* unsigned wave */
#define SIMPLE_WAVE_INVERT		0x0002  /* same as unsigned wave */
#define SIMPLE_WAVE_BACKWARD		0x0004  /* backward mode (maybe used for reverb or ping-ping loop) */
#define SIMPLE_WAVE_LOOP		0x0008  /* loop mode */
#define SIMPLE_WAVE_BIDIR		0x0010  /* bidirectional mode */
#define SIMPLE_WAVE_STEREO		0x0100	/* stereo wave */
#define SIMPLE_WAVE_ULAW		0x0200	/* uLaw compression mode */

/*
 *  Instrument
 */

#define SIMPLE_EFFECT_NONE		0
#define SIMPLE_EFFECT_REVERB		1
#define SIMPLE_EFFECT_CHORUS		2
#define SIMPLE_EFFECT_ECHO		3

typedef struct {
	unsigned int share_id[4];	/* share id - zero = no sharing */
	unsigned int format;		/* wave format */

	struct {
		unsigned int number;	/* some other ID for this instrument */
		unsigned int memory;	/* begin of waveform in onboard memory */
		unsigned char *ptr;	/* pointer to waveform in system memory */
	} address;

	unsigned int size;		/* size of waveform in samples */
	unsigned int start;		/* start offset in samples * 16 (lowest 4 bits - fraction) */
	unsigned int loop_start;	/* loop start offset in samples * 16 (lowest 4 bits - fraction) */
	unsigned int loop_end;		/* loop end offset in samples * 16 (lowest 4 bits - fraction) */
	unsigned short loop_repeat;	/* loop repeat - 0 = forever */

	unsigned char effect1;		/* effect 1 */
	unsigned char effect1_depth;	/* 0-127 */
	unsigned char effect2;		/* effect 2 */
	unsigned char effect2_depth;	/* 0-127 */
} simple_instrument_t;

/*
 *
 *    Kernel <-> user space
 *    Hardware (CPU) independent section
 *
 *    * = zero or more
 *    + = one or more
 *
 *    simple_xinstrument	SIMPLE_STRU_INSTR
 *
 */

#define SIMPLE_STRU_INSTR	snd_htoi_32(('I'<<24)|('N'<<16)|('S'<<8)|'T')

/*
 *  Instrument
 */

typedef struct simple_xinstrument {
	__u32 stype;

	__u32 share_id[4];		/* share id - zero = no sharing */
	__u32 format;			/* wave format */

	__u32 size;			/* size of waveform in samples */
	__u32 start;			/* start offset in samples * 16 (lowest 4 bits - fraction) */
	__u32 loop_start;		/* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
	__u32 loop_end;			/* loop start offset in samples * 16 (lowest 4 bits - fraction) */
	__u16 loop_repeat;		/* loop repeat - 0 = forever */
	
	__u8 effect1;			/* effect 1 */
	__u8 effect1_depth;		/* 0-127 */
	__u8 effect2;			/* effect 2 */
	__u8 effect2_depth;		/* 0-127 */
} simple_xinstrument_t;

#ifdef __KERNEL__

#include "seq_instr.h"

extern char *snd_seq_simple_id;

typedef struct {
	void *private_data;
	int (*put_sample)(void *private_data, simple_instrument_t *instr,
	                  char *data, long len, int atomic);
	int (*get_sample)(void *private_data, simple_instrument_t *instr,
			  char *data, long len, int atomic);
	int (*remove_sample)(void *private_data, simple_instrument_t *instr,
			     int atomic);
	void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
	snd_seq_kinstr_ops_t kops;
} snd_simple_ops_t;

int snd_seq_simple_init(snd_simple_ops_t *ops,
			void *private_data,
			snd_seq_kinstr_ops_t *next);

#endif

#endif /* __SEQ_INSTR_SIMPLE_H */