Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / sound / ainstr_simple.h
blob40824b4ab23dd527eec628d79f66f03929582d90
1 /*
2 * Advanced Linux Sound Architecture
4 * Simple (MOD player) Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef __SOUND_AINSTR_SIMPLE_H
25 #define __SOUND_AINSTR_SIMPLE_H
27 #ifndef __KERNEL__
28 #include <asm/types.h>
29 #include <asm/byteorder.h>
30 #endif
33 * share types (share ID 1)
36 #define SIMPLE_SHARE_FILE 0
39 * wave formats
42 #define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */
43 #define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */
44 #define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */
45 #define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
46 #define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */
47 #define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */
48 #define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */
49 #define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */
52 * instrument effects
55 #define SIMPLE_EFFECT_NONE 0
56 #define SIMPLE_EFFECT_REVERB 1
57 #define SIMPLE_EFFECT_CHORUS 2
58 #define SIMPLE_EFFECT_ECHO 3
61 * instrument info
64 typedef struct simple_instrument_info {
65 unsigned int format; /* supported format bits */
66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
67 unsigned int max8_len; /* maximum 8-bit wave length */
68 unsigned int max16_len; /* maximum 16-bit wave length */
69 } simple_instrument_info_t;
72 * Instrument
75 typedef struct {
76 unsigned int share_id[4]; /* share id - zero = no sharing */
77 unsigned int format; /* wave format */
79 struct {
80 unsigned int number; /* some other ID for this instrument */
81 unsigned int memory; /* begin of waveform in onboard memory */
82 unsigned char *ptr; /* pointer to waveform in system memory */
83 } address;
85 unsigned int size; /* size of waveform in samples */
86 unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
87 unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
88 unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */
89 unsigned short loop_repeat; /* loop repeat - 0 = forever */
91 unsigned char effect1; /* effect 1 */
92 unsigned char effect1_depth; /* 0-127 */
93 unsigned char effect2; /* effect 2 */
94 unsigned char effect2_depth; /* 0-127 */
95 } simple_instrument_t;
99 * Kernel <-> user space
100 * Hardware (CPU) independent section
102 * * = zero or more
103 * + = one or more
105 * simple_xinstrument SIMPLE_STRU_INSTR
109 #define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
112 * Instrument
115 typedef struct simple_xinstrument {
116 __u32 stype;
118 __u32 share_id[4]; /* share id - zero = no sharing */
119 __u32 format; /* wave format */
121 __u32 size; /* size of waveform in samples */
122 __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
123 __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
124 __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
125 __u16 loop_repeat; /* loop repeat - 0 = forever */
127 __u8 effect1; /* effect 1 */
128 __u8 effect1_depth; /* 0-127 */
129 __u8 effect2; /* effect 2 */
130 __u8 effect2_depth; /* 0-127 */
131 } simple_xinstrument_t;
133 #ifdef __KERNEL__
135 #include "seq_instr.h"
137 typedef struct {
138 void *private_data;
139 int (*info)(void *private_data, simple_instrument_info_t *info);
140 int (*put_sample)(void *private_data, simple_instrument_t *instr,
141 char __user *data, long len, int atomic);
142 int (*get_sample)(void *private_data, simple_instrument_t *instr,
143 char __user *data, long len, int atomic);
144 int (*remove_sample)(void *private_data, simple_instrument_t *instr,
145 int atomic);
146 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
147 snd_seq_kinstr_ops_t kops;
148 } snd_simple_ops_t;
150 int snd_seq_simple_init(snd_simple_ops_t *ops,
151 void *private_data,
152 snd_seq_kinstr_ops_t *next);
154 #endif
156 #endif /* __SOUND_AINSTR_SIMPLE_H */