2 * Advanced Linux Sound Architecture
4 * Simple (MOD player) Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.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 #include "type_compat.h"
30 * share types (share ID 1)
33 #define SIMPLE_SHARE_FILE 0
39 #define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */
40 #define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */
41 #define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */
42 #define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
43 #define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */
44 #define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */
45 #define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */
46 #define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */
52 #define SIMPLE_EFFECT_NONE 0
53 #define SIMPLE_EFFECT_REVERB 1
54 #define SIMPLE_EFFECT_CHORUS 2
55 #define SIMPLE_EFFECT_ECHO 3
61 typedef struct simple_instrument_info {
62 unsigned int format; /* supported format bits */
63 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
64 unsigned int max8_len; /* maximum 8-bit wave length */
65 unsigned int max16_len; /* maximum 16-bit wave length */
66 } simple_instrument_info_t;
73 unsigned int share_id[4]; /* share id - zero = no sharing */
74 unsigned int format; /* wave format */
77 unsigned int number; /* some other ID for this instrument */
78 unsigned int memory; /* begin of waveform in onboard memory */
79 unsigned char *ptr; /* pointer to waveform in system memory */
82 unsigned int size; /* size of waveform in samples */
83 unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
84 unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
85 unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */
86 unsigned short loop_repeat; /* loop repeat - 0 = forever */
88 unsigned char effect1; /* effect 1 */
89 unsigned char effect1_depth; /* 0-127 */
90 unsigned char effect2; /* effect 2 */
91 unsigned char effect2_depth; /* 0-127 */
92 } simple_instrument_t;
96 * Kernel <-> user space
97 * Hardware (CPU) independent section
102 * simple_xinstrument SIMPLE_STRU_INSTR
106 #define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
112 typedef struct simple_xinstrument {
115 __u32 share_id[4]; /* share id - zero = no sharing */
116 __u32 format; /* wave format */
118 __u32 size; /* size of waveform in samples */
119 __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
120 __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
121 __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
122 __u16 loop_repeat; /* loop repeat - 0 = forever */
124 __u8 effect1; /* effect 1 */
125 __u8 effect1_depth; /* 0-127 */
126 __u8 effect2; /* effect 2 */
127 __u8 effect2_depth; /* 0-127 */
128 } simple_xinstrument_t;
132 #include "seq_instr.h"
134 extern char *snd_seq_simple_id;
138 int (*info)(void *private_data, simple_instrument_info_t *info);
139 int (*put_sample)(void *private_data, simple_instrument_t *instr,
140 char *data, long len, int atomic);
141 int (*get_sample)(void *private_data, simple_instrument_t *instr,
142 char *data, long len, int atomic);
143 int (*remove_sample)(void *private_data, simple_instrument_t *instr,
145 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
146 snd_seq_kinstr_ops_t kops;
149 int snd_seq_simple_init(snd_simple_ops_t *ops,
151 snd_seq_kinstr_ops_t *next);
155 #endif /* __SOUND_AINSTR_SIMPLE_H */