OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [sound/] [Readme.v30] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
Sound driver version v3.0 (and later)
2
-------------------------------------
3
 
4
All features of v2.90-2 should work as earlier. There could be some
5
omissions but they are unintentional. I started this version thread
6
after v2.3 so all features implemented before it are there.
7
 
8
New features
9
============
10
 
11
There are now two new device interfaces. The /dev/midi## is a raw
12
tty like interface to MIDI ports. There is a device file for each MIDI
13
port on your system. They are named (/dev/midi00 to /dev/midiNN).
14
The second addition is the /dev/music which is higher level interface
15
than the old /dev/sequencer. It's intended for writing device independent
16
applications like sequencers.
17
 
18
/dev/midi##
19
-----------
20
 
21
This interface should be useful for applications like MIDI sysex librarians.
22
There are (currently) no timing features so making music could be impossible.
23
 
24
There are as many /dev/midi## devices as there are MIDI ports in the system.
25
The /dev/midi00 is connected to the first one, /dev/midi01 to the second etc.
26
 
27
These devices work like tty devices in raw mode. Everything written to them is
28
sent out to the MIDI port. There is currently an extra delay of at most
29
1/100th of sec but it will be removed later.
30
 
31
The reading algorithm is little bit more complicated. There are two different
32
cases:
33
 
34
1)      There is at least one byte in the input buffer.
35
 
36
The read returns as many bytes as it can without waiting for more bytes.
37
For example when a process reads 100 bytes and there are 10 bytes in the
38
buffer, the read returns just 10 bytes.
39
 
40
2)      The input buffer is empty when the process calls read.
41
 
42
The read waits for the first byte and then continues as in case 1. By
43
default it waits infinitely but there is an ioctl for setting a timeout
44
for this. The ioctl(fd, SNDCTL_MIDI_PRETIME, &time) changes the timeout.
45
The time is given in 1/10th of seconds (10 means one second).
46
 
47
Other ioctl calls:
48
 
49
ioctl(fd, SNDCTL_MIDI_MPUMODE, &mode) is available for full MPU-401
50
compatible devices such as MPU-IPC-T, MQ PC Midi Card or MQX-32.
51
It's not available for the so called MPU UART ports of some soundcards
52
(PAS16, SB16 etc). By default the MIDI port is in UART mode after open.
53
If this ioctl is called with mode=1, the interface is put to the intelligent
54
(coprocessor) mode. NOTE! The MIDI port will be reset when this ioctl is called.
55
It could have some strange effects if not called immediately after open. This
56
call returns EINVAL if the midi port doesn't support the MPU-401 intelligent
57
mode.
58
 
59
ioctl(fd, SNDCTL_MIDI_MPUCMD, &cmdstruct) is valid only if the MIDI port
60
is put to the coprocessor mode using ioctl(SNDCTL_MIDI_MPUMODE). It's used to
61
send commands to a MPU-401 compatible MIDI cards. Please refer to the
62
MPU-401 Technical Reference Manual (or Music Quest Technical Reference
63
Manual) for descriptions of the commands.
64
 
65
The argument of SNDCTL_MIDI_MPUCOMMAND is of type mpu_command_rec. It
66
has the following fields:
67
 
68
typedef struct {
69
                unsigned char cmd;
70
 
71
                char nr_args, nr_returns;
72
                unsigned char data[30];
73
        } mpu_command_rec;
74
 
75
where:
76
        cmd             Contains the command number.
77
        nr_args         Number of arguments of the command.
78
                        MUST BE INITIALIZED BEFORE CALL
79
        nr_returns      Number of bytes returned by the command.
80
                        MUST BE INITIALIZED BEFORE CALL
81
        data            Buffer for the command arguments and returned
82
                        data.
83
 
84
Be extremely careful with the nr_args and nr_returns fields. They
85
must match the command. An incorrect value will put the card and
86
the driver out of sync. Refer to the MPU-401/MQX-32M documentation for further
87
details.
88
 
89
 
90
 
91
/dev/music (/dev/sequencer2)
92
----------------------------
93
 
94
This device file works much like the /dev/sequencer which has been present
95
since the beginning. The main differences are the following:
96
 
97
- /dev/sequencer makes the MIDI ports to look like the synth devices. In fact
98
the result is somewhere between the MIDI specification and the synth devices of
99
/dev/sequencer. Both kind of devices are accessed using the SEQ_START_NOTE()
100
like macros. The voice number parameters of the API macros have been redefined
101
to denote MIDI channels. This means that the driver allocates voices for
102
the channels automatically (this is a responsibility/right of an application
103
with /dev/sequencer). The result is that a SEQ_START_NOTE() macro has
104
similar effects for a synth channel than on a MIDI port. This kind of
105
solution provides better device independence than the /dev/sequencer. The
106
drawback is that the new interface doesn't permit so low level access to the
107
device as the /dev/sequencer does. An application developer must choose between
108
these two interfaces. I think the old /dev/sequencer is better for applications
109
like module players while the new one is better for making generic sequencer
110
programs.
111
 
112
- There are no separate MIDI devices with the /dev/sequencer2. The
113
ioctl(SNDCTL_SEQ_NRMIDIS) returns always zero. Instead the MIDI ports are
114
shown as synth devices. ioctl(SNDCTL_SEQ_NRSYNTHS) on /dev/sequencer2 will
115
return sum of internal synthesizers (GUS, OPL3) and MIDI ports in the systems.
116
 
117
- The new interface is used much like the ordinary /dev/sequencer. The
118
event format is new so you have to use the API macros defined in the
119
sys/soundcard.h. The interface is will probably change before the final 3.0
120
release but using the API macros should ensure compatibility in source level.
121
The new event format is not recognized by version 2.X so don't try to
122
distribute binaries compiled with soundcard.h of v3.X.
123
 
124
- The basic API usage is similar to the current one. There are some new
125
macros but the older ones should work as earlier. The most important
126
incompatibility is that the /dev/sequencer2 driver allocates voices itself.
127
The other one is that the application must send SEQ_START_TIMER() as its
128
first event. Otherwise the timer is not started and the application waits
129
infinitely.
130
 
131
 
132
There are several new features but I don't document them here. There are
133
some info in the soundcard.h (near the end). I have also included some
134
sample code in the directory v30. Full documentation will
135
appear in the Hacker's Guide later.
136
 
137
Don't hesitate to contact me in case you have questions or comments.
138
 
139
Hannu Savolainen
140
hannu@4front-tech.com

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.