Linux Audio

Check our new training course

Loading...
v3.1
 
 1#ifndef __SOUND_SEQ_VIRMIDI_H
 2#define __SOUND_SEQ_VIRMIDI_H
 3
 4/*
 5 *  Virtual Raw MIDI client on Sequencer
 6 *  Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>,
 7 *                        Jaroslav Kysela <perex@perex.cz>
 8 *
 9 *   This program is free software; you can redistribute it and/or modify
10 *   it under the terms of the GNU General Public License as published by
11 *   the Free Software Foundation; either version 2 of the License, or
12 *   (at your option) any later version.
13 *
14 *   This program is distributed in the hope that it will be useful,
15 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *   GNU General Public License for more details.
18 *
19 *   You should have received a copy of the GNU General Public License
20 *   along with this program; if not, write to the Free Software
21 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22 *
23 */
24
25#include "rawmidi.h"
26#include "seq_midi_event.h"
27
28/*
29 * device file instance:
30 * This instance is created at each time the midi device file is
31 * opened.  Each instance has its own input buffer and MIDI parser
32 * (buffer), and is associated with the device instance.
33 */
34struct snd_virmidi {
35	struct list_head list;
36	int seq_mode;
37	int client;
38	int port;
39	unsigned int trigger: 1;
40	struct snd_midi_event *parser;
41	struct snd_seq_event event;
42	struct snd_virmidi_dev *rdev;
43	struct snd_rawmidi_substream *substream;
 
44};
45
46#define SNDRV_VIRMIDI_SUBSCRIBE		(1<<0)
47#define SNDRV_VIRMIDI_USE		(1<<1)
48
49/*
50 * device record:
51 * Each virtual midi device has one device instance.  It contains
52 * common information and the linked-list of opened files, 
53 */
54struct snd_virmidi_dev {
55	struct snd_card *card;		/* associated card */
56	struct snd_rawmidi *rmidi;		/* rawmidi device */
57	int seq_mode;			/* SNDRV_VIRMIDI_XXX */
58	int device;			/* sequencer device */
59	int client;			/* created/attached client */
60	int port;			/* created/attached port */
61	unsigned int flags;		/* SNDRV_VIRMIDI_* */
62	rwlock_t filelist_lock;
 
63	struct list_head filelist;
64};
65
66/* sequencer mode:
67 * ATTACH = input/output events from midi device are routed to the
68 *          attached sequencer port.  sequencer port is not created
69 *          by virmidi itself.
70 *          the input to rawmidi must be processed by passing the
71 *          incoming events via snd_virmidi_receive()
72 * DISPATCH = input/output events are routed to subscribers.
73 *            sequencer port is created in virmidi.
74 */
75#define SNDRV_VIRMIDI_SEQ_NONE		0
76#define SNDRV_VIRMIDI_SEQ_ATTACH	1
77#define SNDRV_VIRMIDI_SEQ_DISPATCH	2
78
79int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
80
81#endif /* __SOUND_SEQ_VIRMIDI */
v5.4
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2#ifndef __SOUND_SEQ_VIRMIDI_H
 3#define __SOUND_SEQ_VIRMIDI_H
 4
 5/*
 6 *  Virtual Raw MIDI client on Sequencer
 7 *  Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>,
 8 *                        Jaroslav Kysela <perex@perex.cz>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 9 */
10
11#include <sound/rawmidi.h>
12#include <sound/seq_midi_event.h>
13
14/*
15 * device file instance:
16 * This instance is created at each time the midi device file is
17 * opened.  Each instance has its own input buffer and MIDI parser
18 * (buffer), and is associated with the device instance.
19 */
20struct snd_virmidi {
21	struct list_head list;
22	int seq_mode;
23	int client;
24	int port;
25	bool trigger;
26	struct snd_midi_event *parser;
27	struct snd_seq_event event;
28	struct snd_virmidi_dev *rdev;
29	struct snd_rawmidi_substream *substream;
30	struct work_struct output_work;
31};
32
33#define SNDRV_VIRMIDI_SUBSCRIBE		(1<<0)
34#define SNDRV_VIRMIDI_USE		(1<<1)
35
36/*
37 * device record:
38 * Each virtual midi device has one device instance.  It contains
39 * common information and the linked-list of opened files, 
40 */
41struct snd_virmidi_dev {
42	struct snd_card *card;		/* associated card */
43	struct snd_rawmidi *rmidi;		/* rawmidi device */
44	int seq_mode;			/* SNDRV_VIRMIDI_XXX */
45	int device;			/* sequencer device */
46	int client;			/* created/attached client */
47	int port;			/* created/attached port */
48	unsigned int flags;		/* SNDRV_VIRMIDI_* */
49	rwlock_t filelist_lock;
50	struct rw_semaphore filelist_sem;
51	struct list_head filelist;
52};
53
54/* sequencer mode:
55 * ATTACH = input/output events from midi device are routed to the
56 *          attached sequencer port.  sequencer port is not created
57 *          by virmidi itself.
58 *          the input to rawmidi must be processed by passing the
59 *          incoming events via snd_virmidi_receive()
60 * DISPATCH = input/output events are routed to subscribers.
61 *            sequencer port is created in virmidi.
62 */
63#define SNDRV_VIRMIDI_SEQ_NONE		0
64#define SNDRV_VIRMIDI_SEQ_ATTACH	1
65#define SNDRV_VIRMIDI_SEQ_DISPATCH	2
66
67int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
68
69#endif /* __SOUND_SEQ_VIRMIDI */