Commit e5723b41 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove sequencer instrument layer

Remove sequencer instrument layer from the tree.
This mechanism hasn't been used much with the actual devices.  The only
reasonable user was OPL3 loader, and now it was rewritten to use hwdep
instead.  So, let's remove the rest of rotten codes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 05c1afe7
/*
* Advanced Linux Sound Architecture
*
* FM (OPL2/3) Instrument Format
* Copyright (c) 2000 Uros Bizjak <uros@kss-loka.si>
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_FM_H
#define __SOUND_AINSTR_FM_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define FM_SHARE_FILE 0
/*
* FM operator
*/
struct fm_operator {
unsigned char am_vib;
unsigned char ksl_level;
unsigned char attack_decay;
unsigned char sustain_release;
unsigned char wave_select;
};
/*
* Instrument
*/
#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
struct fm_instrument {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned char type; /* instrument type */
struct fm_operator op[4];
unsigned char feedback_connection[2];
unsigned char echo_delay;
unsigned char echo_atten;
unsigned char chorus_spread;
unsigned char trnsps;
unsigned char fix_dur;
unsigned char modes;
unsigned char fix_key;
};
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* fm_xinstrument FM_STRU_INSTR
*
*/
#define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* FM operator
*/
struct fm_xoperator {
__u8 am_vib;
__u8 ksl_level;
__u8 attack_decay;
__u8 sustain_release;
__u8 wave_select;
};
/*
* Instrument
*/
struct fm_xinstrument {
__u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */
__u8 type; /* instrument type */
struct fm_xoperator op[4]; /* fm operators */
__u8 feedback_connection[2];
__u8 echo_delay;
__u8 echo_atten;
__u8 chorus_spread;
__u8 trnsps;
__u8 fix_dur;
__u8 modes;
__u8 fix_key;
};
#ifdef __KERNEL__
#include "seq_instr.h"
int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops,
struct snd_seq_kinstr_ops * next);
#endif
/* typedefs for compatibility to user-space */
typedef struct fm_xoperator fm_xoperator_t;
typedef struct fm_xinstrument fm_xinstrument_t;
#endif /* __SOUND_AINSTR_FM_H */
/*
* Advanced Linux Sound Architecture
*
* GF1 (GUS) Patch Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_GF1_H
#define __SOUND_AINSTR_GF1_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define GF1_SHARE_FILE 0
/*
* wave formats
*/
#define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */
#define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */
#define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */
#define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
#define GF1_WAVE_LOOP 0x0008 /* loop mode */
#define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */
#define GF1_WAVE_STEREO 0x0100 /* stereo mode */
#define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */
/*
* Wavetable definitions
*/
struct gf1_wave {
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; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned short loop_repeat; /* loop repeat - 0 = forever */
unsigned char flags; /* GF1 patch flags */
unsigned char pad;
unsigned int sample_rate; /* sample rate in Hz */
unsigned int low_frequency; /* low frequency range */
unsigned int high_frequency; /* high frequency range */
unsigned int root_frequency; /* root frequency range */
signed short tune;
unsigned char balance;
unsigned char envelope_rate[6];
unsigned char envelope_offset[6];
unsigned char tremolo_sweep;
unsigned char tremolo_rate;
unsigned char tremolo_depth;
unsigned char vibrato_sweep;
unsigned char vibrato_rate;
unsigned char vibrato_depth;
unsigned short scale_frequency;
unsigned short scale_factor; /* 0-2048 or 0-2 */
struct gf1_wave *next;
};
/*
* Instrument
*/
#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
#define IWFFFF_EFFECT_NONE 0
#define IWFFFF_EFFECT_REVERB 1
#define IWFFFF_EFFECT_CHORUS 2
#define IWFFFF_EFFECT_ECHO 3
struct gf1_instrument {
unsigned short exclusion;
unsigned short exclusion_group; /* 0 - none, 1-65535 */
unsigned char effect1; /* effect 1 */
unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */
struct gf1_wave *wave; /* first waveform */
};
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* gf1_xinstrument IWFFFF_STRU_INSTR
* +gf1_xwave IWFFFF_STRU_WAVE
*
*/
#define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
#define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Wavetable definitions
*/
struct gf1_xwave {
__u32 stype; /* structure type */
__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 flags; /* GF1 patch flags */
__u8 pad;
__u32 sample_rate; /* sample rate in Hz */
__u32 low_frequency; /* low frequency range */
__u32 high_frequency; /* high frequency range */
__u32 root_frequency; /* root frequency range */
__s16 tune;
__u8 balance;
__u8 envelope_rate[6];
__u8 envelope_offset[6];
__u8 tremolo_sweep;
__u8 tremolo_rate;
__u8 tremolo_depth;
__u8 vibrato_sweep;
__u8 vibrato_rate;
__u8 vibrato_depth;
__u16 scale_frequency;
__u16 scale_factor; /* 0-2048 or 0-2 */
};
/*
* Instrument
*/
struct gf1_xinstrument {
__u32 stype;
__u16 exclusion;
__u16 exclusion_group; /* 0 - none, 1-65535 */
__u8 effect1; /* effect 1 */
__u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */
};
/*
* Instrument info
*/
#define GF1_INFO_ENVELOPE (1<<0)
#define GF1_INFO_TREMOLO (1<<1)
#define GF1_INFO_VIBRATO (1<<2)
struct gf1_info {
unsigned char flags; /* supported wave flags */
unsigned char pad[3];
unsigned int features; /* supported features */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
};
#ifdef __KERNEL__
#include "seq_instr.h"
struct snd_gf1_ops {
void *private_data;
int (*info)(void *private_data, struct gf1_info *info);
int (*put_sample)(void *private_data, struct gf1_wave *wave,
char __user *data, long len, int atomic);
int (*get_sample)(void *private_data, struct gf1_wave *wave,
char __user *data, long len, int atomic);
int (*remove_sample)(void *private_data, struct gf1_wave *wave,
int atomic);
void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
struct snd_seq_kinstr_ops kops;
};
int snd_seq_gf1_init(struct snd_gf1_ops *ops,
void *private_data,
struct snd_seq_kinstr_ops *next);
#endif
/* typedefs for compatibility to user-space */
typedef struct gf1_xwave gf1_xwave_t;
typedef struct gf1_xinstrument gf1_xinstrument_t;
#endif /* __SOUND_AINSTR_GF1_H */
This diff is collapsed.
/*
* Advanced Linux Sound Architecture
*
* Simple (MOD player) Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_SIMPLE_H
#define __SOUND_AINSTR_SIMPLE_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.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 effects
*/
#define SIMPLE_EFFECT_NONE 0
#define SIMPLE_EFFECT_REVERB 1
#define SIMPLE_EFFECT_CHORUS 2
#define SIMPLE_EFFECT_ECHO 3
/*
* instrument info
*/
struct simple_instrument_info {
unsigned int format; /* supported format bits */
unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
};
/*
* Instrument
*/
struct simple_instrument {
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 */
};
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* simple_xinstrument SIMPLE_STRU_INSTR
*
*/
#define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Instrument
*/
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 */
};
#ifdef __KERNEL__
#include "seq_instr.h"
struct snd_simple_ops {
void *private_data;
int (*info)(void *private_data, struct simple_instrument_info *info);
int (*put_sample)(void *private_data, struct simple_instrument *instr,
char __user *data, long len, int atomic);
int (*get_sample)(void *private_data, struct simple_instrument *instr,
char __user *data, long len, int atomic);
int (*remove_sample)(void *private_data, struct simple_instrument *instr,
int atomic);
void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
struct snd_seq_kinstr_ops kops;
};
int snd_seq_simple_init(struct snd_simple_ops *ops,
void *private_data,
struct snd_seq_kinstr_ops *next);
#endif
/* typedefs for compatibility to user-space */
typedef struct simple_xinstrument simple_xinstrument_t;
#endif /* __SOUND_AINSTR_SIMPLE_H */
......@@ -110,18 +110,7 @@
#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
/** synthesizer events
* event data type = snd_seq_eve_sample_control
*/
#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */
#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */
#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */
#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */
#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */
#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */
#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */
/* 70-89: synthesizer events - obsoleted */
/** user-defined events with fixed length
* event data type = any
......@@ -137,28 +126,7 @@
#define SNDRV_SEQ_EVENT_USR8 98
#define SNDRV_SEQ_EVENT_USR9 99
/** instrument layer
* variable length data can be passed directly to the driver
*/
#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */
#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */
#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */
#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */
#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */
#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */
#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */
#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */
#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */
#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */
#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */
#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */
#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */
#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */
#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */
#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */
#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */
#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */
#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */
/* 100-118: instrument layer - obsoleted */
/* 119-129: reserved */
/* 130-139: variable length events
......@@ -258,78 +226,6 @@ struct snd_seq_ev_ext {
void *ptr; /* pointer to data (note: maybe 64-bit) */
} __attribute__((packed));
/* Instrument cluster type */
typedef unsigned int snd_seq_instr_cluster_t;
/* Instrument type */
struct snd_seq_instr {
snd_seq_instr_cluster_t cluster;
unsigned int std; /* the upper byte means a private instrument (owner - client #) */
unsigned short bank;
unsigned short prg;
};
/* sample number */
struct snd_seq_ev_sample {
unsigned int std;
unsigned short bank;
unsigned short prg;
};
/* sample cluster */
struct snd_seq_ev_cluster {
snd_seq_instr_cluster_t cluster;
};
/* sample position */
typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
/* sample stop mode */
enum {
SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
};
/* sample frequency */
typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
/* sample volume control; if any value is set to -1 == do not change */
struct snd_seq_ev_volume {
signed short volume; /* range: 0-16383 */
signed short lr; /* left-right balance; range: 0-16383 */
signed short fr; /* front-rear balance; range: 0-16383 */
signed short du; /* down-up balance; range: 0-16383 */
};
/* simple loop redefinition */
struct snd_seq_ev_loop {
unsigned int start; /* loop start (in samples) * 16 */
unsigned int end; /* loop end (in samples) * 16 */
};
struct snd_seq_ev_sample_control {
unsigned char channel;
unsigned char unused1, unused2, unused3; /* pad */
union {
struct snd_seq_ev_sample sample;
struct snd_seq_ev_cluster cluster;
snd_seq_position_t position;
int stop_mode;
snd_seq_frequency_t frequency;
struct snd_seq_ev_volume volume;
struct snd_seq_ev_loop loop;
unsigned char raw8[8];
} param;
};
/* INSTR_BEGIN event */
struct snd_seq_ev_instr_begin {
int timeout; /* zero = forever, otherwise timeout in ms */
};
struct snd_seq_result {
int event; /* processed event type */
int result;
......@@ -399,8 +295,6 @@ struct snd_seq_event {
struct snd_seq_addr addr;
struct snd_seq_connect connect;
struct snd_seq_result result;
struct snd_seq_ev_instr_begin instr_begin;
struct snd_seq_ev_sample_control sample;
struct snd_seq_ev_quote quote;
} data;
};
......@@ -441,8 +335,6 @@ struct snd_seq_event_bounce {
#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
/* fixed length events: 0-99 */
#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
/* instrument layer events: 100-129 */
#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
/* variable length events: 130-139 */
#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
/* reserved for kernel */
......@@ -737,136 +629,6 @@ struct snd_seq_query_subs {
};
/*
* Instrument abstraction layer
* - based on events
*/
/* instrument types */
#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
/* instrument ASCII identifiers */
#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
/* instrument types */
#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
/* put commands */
#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
/* get commands */
#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
/* query flags */
#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
/* free commands */
#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
/* size of ROM/RAM */
typedef unsigned int snd_seq_instr_size_t;
/* INSTR_INFO */
struct snd_seq_instr_info {
int result; /* operation result */
unsigned int formats[8]; /* bitmap of supported formats */
int ram_count; /* count of RAM banks */
snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
int rom_count; /* count of ROM banks */
snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
char reserved[128];
};
/* INSTR_STATUS */
struct snd_seq_instr_status {
int result; /* operation result */
snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
int instrument_count; /* count of downloaded instruments */
char reserved[128];
};
/* INSTR_FORMAT_INFO */
struct snd_seq_instr_format_info {
char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
unsigned int len; /* max data length (without this structure) */
};
struct snd_seq_instr_format_info_result {
int result; /* operation result */
char format[16]; /* format identifier */
unsigned int len; /* filled data length (without this structure) */
};
/* instrument data */
struct snd_seq_instr_data {
char name[32]; /* instrument name */
char reserved[16]; /* for the future use */
int type; /* instrument type */
union {
char format[16]; /* format identifier */
struct snd_seq_instr alias;
} data;
};
/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
struct snd_seq_instr_header {
union {
struct snd_seq_instr instr;
snd_seq_instr_cluster_t cluster;
} id; /* instrument identifier */
unsigned int cmd; /* get/put/free command */
unsigned int flags; /* query flags (only for get) */
unsigned int len; /* real instrument data length (without header) */
int result; /* operation result */
char reserved[16]; /* for the future */
struct snd_seq_instr_data data; /* instrument data (for put/get result) */
};
/* INSTR_CLUSTER_SET */
struct snd_seq_instr_cluster_set {
snd_seq_instr_cluster_t cluster; /* cluster identifier */
char name[32]; /* cluster name */
int priority; /* cluster priority */
char reserved[64]; /* for the future use */
};
/* INSTR_CLUSTER_GET */
struct snd_seq_instr_cluster_get {
snd_seq_instr_cluster_t cluster; /* cluster identifier */
char name[32]; /* cluster name */
int priority; /* cluster priority */
char reserved[64]; /* for the future use */
};
/*
* IOCTL commands
*/
......
......@@ -27,13 +27,8 @@
#include "timer.h"
#include "seq_midi_emul.h"
#include "seq_device.h"
#include "ainstr_iw.h"
#include "ainstr_gf1.h"
#include "ainstr_simple.h"
#include <asm/io.h>
#define SNDRV_SEQ_DEV_ID_GUS "gus-synth"
/* IO ports */
#define GUSP(gus, x) ((gus)->gf1.port + SNDRV_g_u_s_##x)
......@@ -234,16 +229,6 @@ struct snd_gus_port {
struct snd_gus_voice;
struct snd_gus_sample_ops {
void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);
void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);
void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);
void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);
void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);
void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);
void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);
};
#define SNDRV_GF1_VOICE_TYPE_PCM 0
#define SNDRV_GF1_VOICE_TYPE_SYNTH 1
#define SNDRV_GF1_VOICE_TYPE_MIDI 2
......@@ -284,12 +269,8 @@ struct snd_gus_voice {
struct snd_gus_sample_ops *sample_ops;
struct snd_seq_instr instr;
/* running status / registers */
struct snd_seq_ev_volume sample_volume;
unsigned short fc_register;
unsigned short fc_lfo;
unsigned short gf1_volume;
......@@ -382,10 +363,6 @@ struct snd_gf1 {
int seq_client;
struct snd_gus_port seq_ports[4];
struct snd_seq_kinstr_list *ilist;
struct snd_iwffff_ops iwffff_ops;
struct snd_gf1_ops gf1_ops;
struct snd_simple_ops simple_ops;
/* timer */
......@@ -458,8 +435,6 @@ struct snd_gus_card {
struct snd_rawmidi_substream *midi_substream_output;
struct snd_rawmidi_substream *midi_substream_input;
struct snd_seq_device *seq_dev;
spinlock_t reg_lock;
spinlock_t voice_alloc;
spinlock_t active_voice_lock;
......@@ -647,48 +622,10 @@ void snd_gus_irq_profile_init(struct snd_gus_card *gus);
int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);
#if 0
extern void snd_engine_instrument_register(unsigned short mode,
struct _SND_INSTRUMENT_VOICE_COMMANDS *voice_cmds,
struct _SND_INSTRUMENT_NOTE_COMMANDS *note_cmds,
struct _SND_INSTRUMENT_CHANNEL_COMMANDS *channel_cmds);
extern int snd_engine_instrument_register_ask(unsigned short mode);
#endif
/* gus_dram.c */
int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
unsigned int addr, unsigned int size);
int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
unsigned int addr, unsigned int size, int rom);
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
/* gus_sample.c */
void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p);
/* gus_simple.c */
void snd_gf1_simple_init(struct snd_gus_voice *voice);
/* gus_instr.c */
int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave,
char __user *data, long len, int atomic);
int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave,
char __user *data, long len, int atomic);
int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave,
int atomic);
int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave,
char __user *data, long len, int atomic);
int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave,
char __user *data, long len, int atomic);
int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave,
int atomic);
int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr,
char __user *data, long len, int atomic);
int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr,
char __user *data, long len, int atomic);
int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr,
int atomic);
#endif /* CONFIG_SND_SEQUENCER */
#endif /* __SOUND_GUS_H */
#ifndef __SOUND_SEQ_INSTR_H
#define __SOUND_SEQ_INSTR_H
/*
* Main kernel header file for the ALSA sequencer
* Copyright (c) 1999 by Jaroslav Kysela <perex@perex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "seq_kernel.h"
/* Instrument cluster */
struct snd_seq_kcluster {
snd_seq_instr_cluster_t cluster;
char name[32];
int priority;
struct snd_seq_kcluster *next;
};
/* return pointer to private data */
#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
/* Instrument structure */
struct snd_seq_kinstr {
struct snd_seq_instr instr;
char name[32];
int type; /* instrument type */
int use; /* use count */
int busy; /* not useable */
int add_len; /* additional length */
struct snd_seq_kinstr_ops *ops; /* operations */
struct snd_seq_kinstr *next;
};
#define SNDRV_SEQ_INSTR_HASH_SIZE 32
/* Instrument flags */
#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
/* List of all instruments */
struct snd_seq_kinstr_list {
struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
int count; /* count of all instruments */
struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
int ccount; /* count of all clusters */
int owner; /* current owner of the instrument list */
unsigned int flags;
spinlock_t lock;
spinlock_t ops_lock;
struct mutex ops_mutex;
unsigned long ops_flags;
};
#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
struct snd_seq_kinstr_ops {
void *private_data;
long add_len; /* additional length */
char *instr_type;
int (*info)(void *private_data, char *info_data, long len);
int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
char __user *instr_data, long len, int atomic, int cmd);
int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
char __user *instr_data, long len, int atomic, int cmd);
int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
struct snd_seq_kinstr_ops *next;
};
/* instrument operations */
struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
struct snd_seq_instr_header *ifree,
int client,
int atomic);
struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
struct snd_seq_instr *instr,
int exact,
int follow_alias);
void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
struct snd_seq_kinstr *instr);
int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
struct snd_seq_kinstr_list *list,
struct snd_seq_event *ev,
int client,
int atomic,
int hop);
#endif /* __SOUND_SEQ_INSTR_H */
......@@ -26,19 +26,12 @@
#include "pcm.h"
#include "mpu401.h"
#include "ac97_codec.h"
#include "seq_midi_emul.h"
#include "seq_device.h"
#include "util_mem.h"
//#include "ainstr_iw.h"
//#include "ainstr_gf1.h"
#include "ainstr_simple.h"
#define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX)
#define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX)
#define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018)
#define SNDRV_SEQ_DEV_ID_TRIDENT "trident-synth"
#define SNDRV_TRIDENT_VOICE_TYPE_PCM 0
#define SNDRV_TRIDENT_VOICE_TYPE_SYNTH 1
#define SNDRV_TRIDENT_VOICE_TYPE_MIDI 2
......@@ -257,16 +250,6 @@ struct snd_trident;
struct snd_trident_voice;
struct snd_trident_pcm_mixer;
struct snd_trident_sample_ops {
void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position);
void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode);
void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq);
void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume);
void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop);
void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position);
void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data);
};
struct snd_trident_port {
struct snd_midi_channel_set * chset;
struct snd_trident * trident;
......@@ -300,7 +283,6 @@ struct snd_trident_voice {
unsigned char port;
unsigned char index;
struct snd_seq_instr instr;
struct snd_trident_sample_ops *sample_ops;
/* channel parameters */
......@@ -354,9 +336,6 @@ struct snd_4dwave {
int seq_client;
struct snd_trident_port seq_ports[4];
struct snd_simple_ops simple_ops;
struct snd_seq_kinstr_list *ilist;
struct snd_trident_voice voices[64];
int ChanSynthCount; /* number of allocated synth channels */
......@@ -416,7 +395,6 @@ struct snd_trident {
struct snd_pcm *foldback; /* Foldback PCM */
struct snd_pcm *spdif; /* SPDIF PCM */
struct snd_rawmidi *rmidi;
struct snd_seq_device *seq_dev;
struct snd_ac97_bus *ac97_bus;
struct snd_ac97 *ac97;
......
......@@ -3,7 +3,6 @@
# Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz>
#
obj-$(CONFIG_SND) += instr/
ifeq ($(CONFIG_SND_SEQUENCER_OSS),y)
obj-$(CONFIG_SND_SEQUENCER) += oss/
endif
......@@ -15,7 +14,6 @@ snd-seq-objs := seq.o seq_lock.o seq_clientmgr.o seq_memory.o seq_queue.o \
snd-seq-midi-objs := seq_midi.o
snd-seq-midi-emul-objs := seq_midi_emul.o
snd-seq-midi-event-objs := seq_midi_event.o
snd-seq-instr-objs := seq_instr.o
snd-seq-dummy-objs := seq_dummy.o
snd-seq-virmidi-objs := seq_virmidi.o
......@@ -36,9 +34,7 @@ obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o
# Toplevel Module Dependency
obj-$(CONFIG_SND_VIRMIDI) += snd-seq-virmidi.o snd-seq-midi-event.o
obj-$(call sequencer,$(CONFIG_SND_RAWMIDI)) += snd-seq-midi.o snd-seq-midi-event.o
obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-seq-midi-emul.o snd-seq-instr.o
obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o
obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o
obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-seq-midi-emul.o snd-seq-virmidi.o
obj-$(call sequencer,$(CONFIG_SND_EMU10K1)) += snd-seq-midi-emul.o snd-seq-virmidi.o
obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-seq-midi-emul.o snd-seq-instr.o
#
# Makefile for ALSA
# Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz>
#
snd-ainstr-fm-objs := ainstr_fm.o
snd-ainstr-simple-objs := ainstr_simple.o
snd-ainstr-gf1-objs := ainstr_gf1.o
snd-ainstr-iw-objs := ainstr_iw.o
#
# this function returns:
# "m" - CONFIG_SND_SEQUENCER is m
# <empty string> - CONFIG_SND_SEQUENCER is undefined
# otherwise parameter #1 value
#
sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
# Toplevel Module Dependency
obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-ainstr-fm.o
obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-ainstr-fm.o
obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-ainstr-gf1.o snd-ainstr-simple.o snd-ainstr-iw.o
obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-ainstr-simple.o
/*
* FM (OPL2/3) Instrument routines
* Copyright (c) 2000 Uros Bizjak <uros@kss-loka.si>
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <sound/driver.h>
#include <linux/init.h>
#include <sound/core.h>
#include <sound/ainstr_fm.h>
#include <sound/initval.h>
#include <asm/uaccess.h>
MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>");
MODULE_DESCRIPTION("Advanced Linux Sound Architecture FM Instrument support.");
MODULE_LICENSE("GPL");
static int snd_seq_fm_put(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic, int cmd)
{
struct fm_instrument *ip;
struct fm_xinstrument ix;
int idx;
if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
return -EINVAL;
/* copy instrument data */
if (len < (long)sizeof(ix))
return -EINVAL;
if (copy_from_user(&ix, instr_data, sizeof(ix)))
return -EFAULT;
if (ix.stype != FM_STRU_INSTR)
return -EINVAL;
ip = (struct fm_instrument *)KINSTR_DATA(instr);
ip->share_id[0] = le32_to_cpu(ix.share_id[0]);
ip->share_id[1] = le32_to_cpu(ix.share_id[1]);
ip->share_id[2] = le32_to_cpu(ix.share_id[2]);
ip->share_id[3] = le32_to_cpu(ix.share_id[3]);
ip->type = ix.type;
for (idx = 0; idx < 4; idx++) {
ip->op[idx].am_vib = ix.op[idx].am_vib;
ip->op[idx].ksl_level = ix.op[idx].ksl_level;
ip->op[idx].attack_decay = ix.op[idx].attack_decay;
ip->op[idx].sustain_release = ix.op[idx].sustain_release;
ip->op[idx].wave_select = ix.op[idx].wave_select;
}
for (idx = 0; idx < 2; idx++) {
ip->feedback_connection[idx] = ix.feedback_connection[idx];
}
ip->echo_delay = ix.echo_delay;
ip->echo_atten = ix.echo_atten;
ip->chorus_spread = ix.chorus_spread;
ip->trnsps = ix.trnsps;
ip->fix_dur = ix.fix_dur;
ip->modes = ix.modes;
ip->fix_key = ix.fix_key;
return 0;
}
static int snd_seq_fm_get(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len, int atomic,
int cmd)
{
struct fm_instrument *ip;
struct fm_xinstrument ix;
int idx;
if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
return -EINVAL;
if (len < (long)sizeof(ix))
return -ENOMEM;
memset(&ix, 0, sizeof(ix));
ip = (struct fm_instrument *)KINSTR_DATA(instr);
ix.stype = FM_STRU_INSTR;
ix.share_id[0] = cpu_to_le32(ip->share_id[0]);
ix.share_id[1] = cpu_to_le32(ip->share_id[1]);
ix.share_id[2] = cpu_to_le32(ip->share_id[2]);
ix.share_id[3] = cpu_to_le32(ip->share_id[3]);
ix.type = ip->type;
for (idx = 0; idx < 4; idx++) {
ix.op[idx].am_vib = ip->op[idx].am_vib;
ix.op[idx].ksl_level = ip->op[idx].ksl_level;
ix.op[idx].attack_decay = ip->op[idx].attack_decay;
ix.op[idx].sustain_release = ip->op[idx].sustain_release;
ix.op[idx].wave_select = ip->op[idx].wave_select;
}
for (idx = 0; idx < 2; idx++) {
ix.feedback_connection[idx] = ip->feedback_connection[idx];
}
if (copy_to_user(instr_data, &ix, sizeof(ix)))
return -EFAULT;
ix.echo_delay = ip->echo_delay;
ix.echo_atten = ip->echo_atten;
ix.chorus_spread = ip->chorus_spread;
ix.trnsps = ip->trnsps;
ix.fix_dur = ip->fix_dur;
ix.modes = ip->modes;
ix.fix_key = ip->fix_key;
return 0;
}
static int snd_seq_fm_get_size(void *private_data, struct snd_seq_kinstr *instr,
long *size)
{
*size = sizeof(struct fm_xinstrument);
return 0;
}
int snd_seq_fm_init(struct snd_seq_kinstr_ops *ops,
struct snd_seq_kinstr_ops *next)
{
memset(ops, 0, sizeof(*ops));
// ops->private_data = private_data;
ops->add_len = sizeof(struct fm_instrument);
ops->instr_type = SNDRV_SEQ_INSTR_ID_OPL2_3;
ops->put = snd_seq_fm_put;
ops->get = snd_seq_fm_get;
ops->get_size = snd_seq_fm_get_size;
// ops->remove = snd_seq_fm_remove;
// ops->notify = snd_seq_fm_notify;
ops->next = next;
return 0;
}
/*
* Init part
*/
static int __init alsa_ainstr_fm_init(void)
{
return 0;
}
static void __exit alsa_ainstr_fm_exit(void)
{
}
module_init(alsa_ainstr_fm_init)
module_exit(alsa_ainstr_fm_exit)
EXPORT_SYMBOL(snd_seq_fm_init);
This diff is collapsed.
This diff is collapsed.
/*
* Simple (MOD player) - Instrument routines
* Copyright (c) 1999 by Jaroslav Kysela <perex@perex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <sound/driver.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/ainstr_simple.h>
#include <sound/initval.h>
#include <asm/uaccess.h>
MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_DESCRIPTION("Advanced Linux Sound Architecture Simple Instrument support.");
MODULE_LICENSE("GPL");
static unsigned int snd_seq_simple_size(unsigned int size, unsigned int format)
{
unsigned int result = size;
if (format & SIMPLE_WAVE_16BIT)
result <<= 1;
if (format & SIMPLE_WAVE_STEREO)
result <<= 1;
return result;
}
static void snd_seq_simple_instr_free(struct snd_simple_ops *ops,
struct simple_instrument *ip,
int atomic)
{
if (ops->remove_sample)
ops->remove_sample(ops->private_data, ip, atomic);
}
static int snd_seq_simple_put(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len,
int atomic, int cmd)
{
struct snd_simple_ops *ops = private_data;
struct simple_instrument *ip;
struct simple_xinstrument ix;
int err;
gfp_t gfp_mask;
unsigned int real_size;
if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)
return -EINVAL;
gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;
/* copy instrument data */
if (len < (long)sizeof(ix))
return -EINVAL;
if (copy_from_user(&ix, instr_data, sizeof(ix)))
return -EFAULT;
if (ix.stype != SIMPLE_STRU_INSTR)
return -EINVAL;
instr_data += sizeof(ix);
len -= sizeof(ix);
ip = (struct simple_instrument *)KINSTR_DATA(instr);
ip->share_id[0] = le32_to_cpu(ix.share_id[0]);
ip->share_id[1] = le32_to_cpu(ix.share_id[1]);
ip->share_id[2] = le32_to_cpu(ix.share_id[2]);
ip->share_id[3] = le32_to_cpu(ix.share_id[3]);
ip->format = le32_to_cpu(ix.format);
ip->size = le32_to_cpu(ix.size);
ip->start = le32_to_cpu(ix.start);
ip->loop_start = le32_to_cpu(ix.loop_start);
ip->loop_end = le32_to_cpu(ix.loop_end);
ip->loop_repeat = le16_to_cpu(ix.loop_repeat);
ip->effect1 = ix.effect1;
ip->effect1_depth = ix.effect1_depth;
ip->effect2 = ix.effect2;
ip->effect2_depth = ix.effect2_depth;
real_size = snd_seq_simple_size(ip->size, ip->format);
if (len < (long)real_size)
return -EINVAL;
if (ops->put_sample) {
err = ops->put_sample(ops->private_data, ip,
instr_data, real_size, atomic);
if (err < 0)
return err;
}
return 0;
}
static int snd_seq_simple_get(void *private_data, struct snd_seq_kinstr *instr,
char __user *instr_data, long len,
int atomic, int cmd)
{
struct snd_simple_ops *ops = private_data;
struct simple_instrument *ip;
struct simple_xinstrument ix;
int err;
unsigned int real_size;
if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
return -EINVAL;
if (len < (long)sizeof(ix))
return -ENOMEM;
memset(&ix, 0, sizeof(ix));
ip = (struct simple_instrument *)KINSTR_DATA(instr);
ix.stype = SIMPLE_STRU_INSTR;
ix.share_id[0] = cpu_to_le32(ip->share_id[0]);
ix.share_id[1] = cpu_to_le32(ip->share_id[1]);
ix.share_id[2] = cpu_to_le32(ip->share_id[2]);
ix.share_id[3] = cpu_to_le32(ip->share_id[3]);
ix.format = cpu_to_le32(ip->format);
ix.size = cpu_to_le32(ip->size);
ix.start = cpu_to_le32(ip->start);
ix.loop_start = cpu_to_le32(ip->loop_start);
ix.loop_end = cpu_to_le32(ip->loop_end);
ix.loop_repeat = cpu_to_le32(ip->loop_repeat);
ix.effect1 = cpu_to_le16(ip->effect1);
ix.effect1_depth = cpu_to_le16(ip->effect1_depth);
ix.effect2 = ip->effect2;
ix.effect2_depth = ip->effect2_depth;
if (copy_to_user(instr_data, &ix, sizeof(ix)))
return -EFAULT;
instr_data += sizeof(ix);
len -= sizeof(ix);
real_size = snd_seq_simple_size(ip->size, ip->format);
if (len < (long)real_size)
return -ENOMEM;
if (ops->get_sample) {
err = ops->get_sample(ops->private_data, ip,
instr_data, real_size, atomic);
if (err < 0)
return err;
}
return 0;
}
static int snd_seq_simple_get_size(void *private_data, struct snd_seq_kinstr *instr,
long *size)
{
struct simple_instrument *ip;
ip = (struct simple_instrument *)KINSTR_DATA(instr);
*size = sizeof(struct simple_xinstrument) + snd_seq_simple_size(ip->size, ip->format);
return 0;
}
static int snd_seq_simple_remove(void *private_data,
struct snd_seq_kinstr *instr,
int atomic)
{
struct snd_simple_ops *ops = private_data;
struct simple_instrument *ip;
ip = (struct simple_instrument *)KINSTR_DATA(instr);
snd_seq_simple_instr_free(ops, ip, atomic);
return 0;
}
static void snd_seq_simple_notify(void *private_data,
struct snd_seq_kinstr *instr,
int what)
{
struct snd_simple_ops *ops = private_data;
if (ops->notify)
ops->notify(ops->private_data, instr, what);
}
int snd_seq_simple_init(struct snd_simple_ops *ops,
void *private_data,
struct snd_seq_kinstr_ops *next)
{
memset(ops, 0, sizeof(*ops));
ops->private_data = private_data;
ops->kops.private_data = ops;
ops->kops.add_len = sizeof(struct simple_instrument);
ops->kops.instr_type = SNDRV_SEQ_INSTR_ID_SIMPLE;
ops->kops.put = snd_seq_simple_put;
ops->kops.get = snd_seq_simple_get;
ops->kops.get_size = snd_seq_simple_get_size;
ops->kops.remove = snd_seq_simple_remove;
ops->kops.notify = snd_seq_simple_notify;
ops->kops.next = next;
return 0;
}
/*
* Init part
*/
static int __init alsa_ainstr_simple_init(void)
{
return 0;
}
static void __exit alsa_ainstr_simple_exit(void)
{
}
module_init(alsa_ainstr_simple_init)
module_exit(alsa_ainstr_simple_exit)
EXPORT_SYMBOL(snd_seq_simple_init);
......@@ -966,8 +966,7 @@ static int check_event_type_and_length(struct snd_seq_event *ev)
return -EINVAL;
break;
case SNDRV_SEQ_EVENT_LENGTH_VARUSR:
if (! snd_seq_ev_is_instr_type(ev) ||
! snd_seq_ev_is_direct(ev))
if (! snd_seq_ev_is_direct(ev))
return -EINVAL;
break;
}
......
This diff is collapsed.
......@@ -229,13 +229,6 @@ snd_midi_process_event(struct snd_midi_op *ops,
case SNDRV_SEQ_EVENT_PORT_START:
case SNDRV_SEQ_EVENT_PORT_EXIT:
case SNDRV_SEQ_EVENT_PORT_CHANGE:
case SNDRV_SEQ_EVENT_SAMPLE:
case SNDRV_SEQ_EVENT_SAMPLE_START:
case SNDRV_SEQ_EVENT_SAMPLE_STOP:
case SNDRV_SEQ_EVENT_SAMPLE_FREQ:
case SNDRV_SEQ_EVENT_SAMPLE_VOLUME:
case SNDRV_SEQ_EVENT_SAMPLE_LOOP:
case SNDRV_SEQ_EVENT_SAMPLE_POSITION:
case SNDRV_SEQ_EVENT_ECHO:
not_yet:
default:
......
......@@ -9,7 +9,6 @@ snd-gus-lib-objs := gus_main.o \
gus_pcm.o gus_mixer.o \
gus_uart.o \
gus_reset.o
snd-gus-synth-objs := gus_synth.o gus_sample.o gus_simple.o gus_instr.o
snd-gusclassic-objs := gusclassic.o
snd-gusextreme-objs := gusextreme.o
......@@ -17,20 +16,9 @@ snd-gusmax-objs := gusmax.o
snd-interwave-objs := interwave.o
snd-interwave-stb-objs := interwave-stb.o
#
# this function returns:
# "m" - CONFIG_SND_SEQUENCER is m
# <empty string> - CONFIG_SND_SEQUENCER is undefined
# otherwise parameter #1 value
#
sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
# Toplevel Module Dependency
obj-$(CONFIG_SND_GUSCLASSIC) += snd-gusclassic.o snd-gus-lib.o
obj-$(CONFIG_SND_GUSMAX) += snd-gusmax.o snd-gus-lib.o
obj-$(CONFIG_SND_GUSEXTREME) += snd-gusextreme.o snd-gus-lib.o
obj-$(CONFIG_SND_INTERWAVE) += snd-interwave.o snd-gus-lib.o
obj-$(CONFIG_SND_INTERWAVE_STB) += snd-interwave-stb.o snd-gus-lib.o
obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-gus-synth.o
obj-m := $(sort $(obj-m))
......@@ -104,12 +104,6 @@ static int snd_gus_free(struct snd_gus_card *gus)
{
if (gus->gf1.res_port2 == NULL)
goto __hw_end;
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
if (gus->seq_dev) {
snd_device_free(gus->card, gus->seq_dev);
gus->seq_dev = NULL;
}
#endif
snd_gf1_stop(gus);
snd_gus_init_dma_irq(gus, 0);
__hw_end:
......@@ -408,14 +402,6 @@ static int snd_gus_check_version(struct snd_gus_card * gus)
return 0;
}
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
static void snd_gus_seq_dev_free(struct snd_seq_device *seq_dev)
{
struct snd_gus_card *gus = seq_dev->private_data;
gus->seq_dev = NULL;
}
#endif
int snd_gus_initialize(struct snd_gus_card *gus)
{
int err;
......@@ -430,15 +416,6 @@ int snd_gus_initialize(struct snd_gus_card *gus)
}
if ((err = snd_gus_init_dma_irq(gus, 1)) < 0)
return err;
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
if (snd_seq_device_new(gus->card, 1, SNDRV_SEQ_DEV_ID_GUS,
sizeof(struct snd_gus_card *), &gus->seq_dev) >= 0) {
strcpy(gus->seq_dev->name, "GUS");
*(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(gus->seq_dev) = gus;
gus->seq_dev->private_data = gus;
gus->seq_dev->private_free = snd_gus_seq_dev_free;
}
#endif
snd_gf1_start(gus);
gus->initialized = 1;
return 0;
......
/*
* Routines for Gravis UltraSound soundcards - Sample support
* Copyright (c) by Jaroslav Kysela <perex@perex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <sound/driver.h>
#include <linux/time.h>
#include <sound/core.h>
#include <sound/gus.h>
/*
*
*/
static void select_instrument(struct snd_gus_card * gus, struct snd_gus_voice * v)
{
struct snd_seq_kinstr *instr;
#if 0
printk("select instrument: cluster = %li, std = 0x%x, bank = %i, prg = %i\n",
v->instr.cluster,
v->instr.std,
v->instr.bank,
v->instr.prg);
#endif
instr = snd_seq_instr_find(gus->gf1.ilist, &v->instr, 0, 1);
if (instr != NULL) {
if (instr->ops) {
if (!strcmp(instr->ops->instr_type, SNDRV_SEQ_INSTR_ID_SIMPLE))
snd_gf1_simple_init(v);
}
snd_seq_instr_free_use(gus->gf1.ilist, instr);
}
}
/*
*
*/
static void event_sample(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_stop)
v->sample_ops->sample_stop(p->gus, v, SAMPLE_STOP_IMMEDIATELY);
v->instr.std = ev->data.sample.param.sample.std;
if (v->instr.std & 0xff000000) { /* private instrument */
v->instr.std &= 0x00ffffff;
v->instr.std |= (unsigned int)ev->source.client << 24;
}
v->instr.bank = ev->data.sample.param.sample.bank;
v->instr.prg = ev->data.sample.param.sample.prg;
select_instrument(p->gus, v);
}
static void event_cluster(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_stop)
v->sample_ops->sample_stop(p->gus, v, SAMPLE_STOP_IMMEDIATELY);
v->instr.cluster = ev->data.sample.param.cluster.cluster;
select_instrument(p->gus, v);
}
static void event_start(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_start)
v->sample_ops->sample_start(p->gus, v, ev->data.sample.param.position);
}
static void event_stop(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_stop)
v->sample_ops->sample_stop(p->gus, v, ev->data.sample.param.stop_mode);
}
static void event_freq(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_freq)
v->sample_ops->sample_freq(p->gus, v, ev->data.sample.param.frequency);
}
static void event_volume(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_volume)
v->sample_ops->sample_volume(p->gus, v, &ev->data.sample.param.volume);
}
static void event_loop(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_loop)
v->sample_ops->sample_loop(p->gus, v, &ev->data.sample.param.loop);
}
static void event_position(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_pos)
v->sample_ops->sample_pos(p->gus, v, ev->data.sample.param.position);
}
static void event_private1(struct snd_seq_event *ev, struct snd_gus_port *p,
struct snd_gus_voice *v)
{
if (v->sample_ops && v->sample_ops->sample_private1)
v->sample_ops->sample_private1(p->gus, v, (unsigned char *)&ev->data.sample.param.raw8);
}
typedef void (gus_sample_event_handler_t)(struct snd_seq_event *ev,
struct snd_gus_port *p,
struct snd_gus_voice *v);
static gus_sample_event_handler_t *gus_sample_event_handlers[9] = {
event_sample,
event_cluster,
event_start,
event_stop,
event_freq,
event_volume,
event_loop,
event_position,
event_private1
};
void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p)
{
int idx, voice;
struct snd_gus_card *gus = p->gus;
struct snd_gus_voice *v;
unsigned long flags;
idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE;
if (idx < 0 || idx > 8)
return;
for (voice = 0; voice < 32; voice++) {
v = &gus->gf1.voices[voice];
if (v->use && v->client == ev->source.client &&
v->port == ev->source.port &&
v->index == ev->data.sample.channel) {
spin_lock_irqsave(&gus->event_lock, flags);
gus_sample_event_handlers[idx](ev, p, v);
spin_unlock_irqrestore(&gus->event_lock, flags);
return;
}
}
}
This diff is collapsed.
/*
* Routines for Gravis UltraSound soundcards - Synthesizer
* Copyright (c) by Jaroslav Kysela <perex@perex.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <sound/driver.h>
#include <linux/init.h>
#include <linux/time.h>
#include <sound/core.h>
#include <sound/gus.h>
#include <sound/seq_device.h>
MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_DESCRIPTION("Routines for Gravis UltraSound soundcards - Synthesizer");
MODULE_LICENSE("GPL");
/*
*
*/
static void snd_gus_synth_free_voices(struct snd_gus_card * gus, int client, int port)
{
int idx;
struct snd_gus_voice * voice;
for (idx = 0; idx < 32; idx++) {
voice = &gus->gf1.voices[idx];
if (voice->use && voice->client == client && voice->port == port)
snd_gf1_free_voice(gus, voice);
}
}
static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *info)
{
struct snd_gus_port * port = private_data;
struct snd_gus_card * gus = port->gus;
struct snd_gus_voice * voice;
unsigned int idx;
if (info->voices > 32)
return -EINVAL;
mutex_lock(&gus->register_mutex);
if (!snd_gus_use_inc(gus)) {
mutex_unlock(&gus->register_mutex);
return -EFAULT;
}
for (idx = 0; idx < info->voices; idx++) {
voice = snd_gf1_alloc_voice(gus, SNDRV_GF1_VOICE_TYPE_SYNTH, info->sender.client, info->sender.port);
if (voice == NULL) {
snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
snd_gus_use_dec(gus);
mutex_unlock(&gus->register_mutex);
return -EBUSY;
}
voice->index = idx;
}
mutex_unlock(&gus->register_mutex);
return 0;
}
static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
{
struct snd_gus_port * port = private_data;
struct snd_gus_card * gus = port->gus;
mutex_lock(&gus->register_mutex);
snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
snd_gus_use_dec(gus);
mutex_unlock(&gus->register_mutex);
return 0;
}
/*
*
*/
static void snd_gus_synth_free_private_instruments(struct snd_gus_port *p, int client)
{
struct snd_seq_instr_header ifree;
memset(&ifree, 0, sizeof(ifree));
ifree.cmd = SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE;
snd_seq_instr_list_free_cond(p->gus->gf1.ilist, &ifree, client, 0);
}
static int snd_gus_synth_event_input(struct snd_seq_event *ev, int direct,
void *private_data, int atomic, int hop)
{
struct snd_gus_port * p = private_data;
snd_assert(p != NULL, return -EINVAL);
if (ev->type >= SNDRV_SEQ_EVENT_SAMPLE &&
ev->type <= SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1) {
snd_gus_sample_event(ev, p);
return 0;
}
if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM &&
ev->source.port == SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE) {
if (ev->type == SNDRV_SEQ_EVENT_CLIENT_EXIT) {
snd_gus_synth_free_private_instruments(p, ev->data.addr.client);
return 0;
}
}
if (direct) {
if (ev->type >= SNDRV_SEQ_EVENT_INSTR_BEGIN) {
snd_seq_instr_event(&p->gus->gf1.iwffff_ops.kops,
p->gus->gf1.ilist,
ev,
p->gus->gf1.seq_client,
atomic, hop);
return 0;
}
}
return 0;
}
static void snd_gus_synth_instr_notify(void *private_data,
struct snd_seq_kinstr *instr,
int what)
{
unsigned int idx;
struct snd_gus_card *gus = private_data;
struct snd_gus_voice *pvoice;
unsigned long flags;
spin_lock_irqsave(&gus->event_lock, flags);
for (idx = 0; idx < 32; idx++) {
pvoice = &gus->gf1.voices[idx];
if (pvoice->use && !memcmp(&pvoice->instr, &instr->instr, sizeof(pvoice->instr))) {
if (pvoice->sample_ops && pvoice->sample_ops->sample_stop) {
pvoice->sample_ops->sample_stop(gus, pvoice, SAMPLE_STOP_IMMEDIATELY);
} else {
snd_gf1_stop_voice(gus, pvoice->number);
pvoice->flags &= ~SNDRV_GF1_VFLG_RUNNING;
}
}
}
spin_unlock_irqrestore(&gus->event_lock, flags);
}
/*
*
*/
static void snd_gus_synth_free_port(void *private_data)
{
struct snd_gus_port * p = private_data;
if (p)
snd_midi_channel_free_set(p->chset);
}
static int snd_gus_synth_create_port(struct snd_gus_card * gus, int idx)
{
struct snd_gus_port * p;
struct snd_seq_port_callback callbacks;
char name[32];
int result;
p = &gus->gf1.seq_ports[idx];
p->chset = snd_midi_channel_alloc_set(16);
if (p->chset == NULL)
return -ENOMEM;
p->chset->private_data = p;
p->gus = gus;
p->client = gus->gf1.seq_client;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.owner = THIS_MODULE;
callbacks.use = snd_gus_synth_use;
callbacks.unuse = snd_gus_synth_unuse;
callbacks.event_input = snd_gus_synth_event_input;
callbacks.private_free = snd_gus_synth_free_port;
callbacks.private_data = p;
sprintf(name, "%s port %i", gus->interwave ? "AMD InterWave" : "GF1", idx);
p->chset->port = snd_seq_event_port_attach(gus->gf1.seq_client,
&callbacks,
SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
SNDRV_SEQ_PORT_TYPE_SYNTH |
SNDRV_SEQ_PORT_TYPE_HARDWARE |
SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
16, 0,
name);
if (p->chset->port < 0) {
result = p->chset->port;
snd_gus_synth_free_port(p);
return result;
}
p->port = p->chset->port;
return 0;
}
/*
*
*/
static int snd_gus_synth_new_device(struct snd_seq_device *dev)
{
struct snd_gus_card *gus;
int client, i;
struct snd_seq_port_subscribe sub;
struct snd_iwffff_ops *iwops;
struct snd_gf1_ops *gf1ops;
struct snd_simple_ops *simpleops;
gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
if (gus == NULL)
return -EINVAL;
mutex_init(&gus->register_mutex);
gus->gf1.seq_client = -1;
/* allocate new client */
client = gus->gf1.seq_client =
snd_seq_create_kernel_client(gus->card, 1, gus->interwave ?
"AMD InterWave" : "GF1");
if (client < 0)
return client;
for (i = 0; i < 4; i++)
snd_gus_synth_create_port(gus, i);
gus->gf1.ilist = snd_seq_instr_list_new();
if (gus->gf1.ilist == NULL) {
snd_seq_delete_kernel_client(client);
gus->gf1.seq_client = -1;
return -ENOMEM;
}
gus->gf1.ilist->flags = SNDRV_SEQ_INSTR_FLG_DIRECT;
simpleops = &gus->gf1.simple_ops;
snd_seq_simple_init(simpleops, gus, NULL);
simpleops->put_sample = snd_gus_simple_put_sample;
simpleops->get_sample = snd_gus_simple_get_sample;
simpleops->remove_sample = snd_gus_simple_remove_sample;
simpleops->notify = snd_gus_synth_instr_notify;
gf1ops = &gus->gf1.gf1_ops;
snd_seq_gf1_init(gf1ops, gus, &simpleops->kops);
gf1ops->put_sample = snd_gus_gf1_put_sample;
gf1ops->get_sample = snd_gus_gf1_get_sample;
gf1ops->remove_sample = snd_gus_gf1_remove_sample;
gf1ops->notify = snd_gus_synth_instr_notify;
iwops = &gus->gf1.iwffff_ops;
snd_seq_iwffff_init(iwops, gus, &gf1ops->kops);
iwops->put_sample = snd_gus_iwffff_put_sample;
iwops->get_sample = snd_gus_iwffff_get_sample;
iwops->remove_sample = snd_gus_iwffff_remove_sample;
iwops->notify = snd_gus_synth_instr_notify;
memset(&sub, 0, sizeof(sub));
sub.sender.client = SNDRV_SEQ_CLIENT_SYSTEM;
sub.sender.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE;
sub.dest.client = client;
sub.dest.port = 0;
snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &sub);
return 0;
}
static int snd_gus_synth_delete_device(struct snd_seq_device *dev)
{
struct snd_gus_card *gus;
gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
if (gus == NULL)
return -EINVAL;
if (gus->gf1.seq_client >= 0) {
snd_seq_delete_kernel_client(gus->gf1.seq_client);
gus->gf1.seq_client = -1;
}
if (gus->gf1.ilist)
snd_seq_instr_list_free(&gus->gf1.ilist);
return 0;
}
static int __init alsa_gus_synth_init(void)
{
static struct snd_seq_dev_ops ops = {
snd_gus_synth_new_device,
snd_gus_synth_delete_device
};
return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_GUS, &ops,
sizeof(struct snd_gus_card *));
}
static void __exit alsa_gus_synth_exit(void)
{
snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_GUS);
}
module_init(alsa_gus_synth_init)
module_exit(alsa_gus_synth_exit)
......@@ -4,16 +4,6 @@
#
snd-trident-objs := trident.o trident_main.o trident_memory.o
snd-trident-synth-objs := trident_synth.o
#
# this function returns:
# "m" - CONFIG_SND_SEQUENCER is m
# <empty string> - CONFIG_SND_SEQUENCER is undefined
# otherwise parameter #1 value
#
sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
# Toplevel Module Dependency
obj-$(CONFIG_SND_TRIDENT) += snd-trident.o
obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-trident-synth.o
......@@ -155,13 +155,6 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
return err;
}
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
if ((err = snd_trident_attach_synthesizer(trident)) < 0) {
snd_card_free(card);
return err;
}
#endif
snd_trident_create_gameport(trident);
if ((err = snd_card_register(card)) < 0) {
......
......@@ -3313,12 +3313,6 @@ static void snd_trident_proc_read(struct snd_info_entry *entry,
snd_iprintf(buffer, "Memory Free : %d\n", snd_util_mem_avail(trident->tlb.memhdr));
}
}
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
snd_iprintf(buffer,"\nWavetable Synth\n");
snd_iprintf(buffer, "Memory Maximum : %d\n", trident->synth.max_size);
snd_iprintf(buffer, "Memory Used : %d\n", trident->synth.current_size);
snd_iprintf(buffer, "Memory Free : %d\n", (trident->synth.max_size-trident->synth.current_size));
#endif
}
static void __devinit snd_trident_proc_init(struct snd_trident * trident)
......@@ -3815,28 +3809,6 @@ static irqreturn_t snd_trident_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
/*---------------------------------------------------------------------------
snd_trident_attach_synthesizer
Description: Attach synthesizer hooks
Paramters: trident - device specific private data for 4DWave card
Returns: None.
---------------------------------------------------------------------------*/
int snd_trident_attach_synthesizer(struct snd_trident *trident)
{
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
if (snd_seq_device_new(trident->card, 1, SNDRV_SEQ_DEV_ID_TRIDENT,
sizeof(struct snd_trident *), &trident->seq_dev) >= 0) {
strcpy(trident->seq_dev->name, "4DWave");
*(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(trident->seq_dev) = trident;
}
#endif
return 0;
}
struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, int client, int port)
{
struct snd_trident_voice *pvoice;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment