Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / qapi / audio.json
blob4e54c00f51eb2c010138afaf2f274c82a5ade7fd
1 # -*- mode: python -*-
2 # vim: filetype=python
4 # Copyright (C) 2015-2019 Zoltán Kővágó <DirtY.iCE.hu@gmail.com>
6 # This work is licensed under the terms of the GNU GPL, version 2 or later.
7 # See the COPYING file in the top-level directory.
9 ##
10 # = Audio
14 # @AudiodevPerDirectionOptions:
16 # General audio backend options that are used for both playback and
17 # recording.
19 # @mixing-engine: use QEMU's mixing engine to mix all streams inside QEMU and
20 #                 convert audio formats when not supported by the backend. When
21 #                 set to off, fixed-settings must be also off (default on,
22 #                 since 4.2)
24 # @fixed-settings: use fixed settings for host input/output. When off,
25 #                  frequency, channels and format must not be
26 #                  specified (default true)
28 # @frequency: frequency to use when using fixed settings
29 #             (default 44100)
31 # @channels: number of channels when using fixed settings (default 2)
33 # @voices: number of voices to use (default 1)
35 # @format: sample format to use when using fixed settings
36 #          (default s16)
38 # @buffer-length: the buffer length in microseconds
40 # Since: 4.0
42 { 'struct': 'AudiodevPerDirectionOptions',
43   'data': {
44     '*mixing-engine':  'bool',
45     '*fixed-settings': 'bool',
46     '*frequency':      'uint32',
47     '*channels':       'uint32',
48     '*voices':         'uint32',
49     '*format':         'AudioFormat',
50     '*buffer-length':  'uint32' } }
53 # @AudiodevGenericOptions:
55 # Generic driver-specific options.
57 # @in: options of the capture stream
59 # @out: options of the playback stream
61 # Since: 4.0
63 { 'struct': 'AudiodevGenericOptions',
64   'data': {
65     '*in':  'AudiodevPerDirectionOptions',
66     '*out': 'AudiodevPerDirectionOptions' } }
69 # @AudiodevAlsaPerDirectionOptions:
71 # Options of the ALSA backend that are used for both playback and
72 # recording.
74 # @dev: the name of the ALSA device to use (default 'default')
76 # @period-length: the period length in microseconds
78 # @try-poll: attempt to use poll mode, falling back to non-polling
79 #            access on failure (default true)
81 # Since: 4.0
83 { 'struct': 'AudiodevAlsaPerDirectionOptions',
84   'base': 'AudiodevPerDirectionOptions',
85   'data': {
86     '*dev':           'str',
87     '*period-length': 'uint32',
88     '*try-poll':      'bool' } }
91 # @AudiodevAlsaOptions:
93 # Options of the ALSA audio backend.
95 # @in: options of the capture stream
97 # @out: options of the playback stream
99 # @threshold: set the threshold (in microseconds) when playback starts
101 # Since: 4.0
103 { 'struct': 'AudiodevAlsaOptions',
104   'data': {
105     '*in':        'AudiodevAlsaPerDirectionOptions',
106     '*out':       'AudiodevAlsaPerDirectionOptions',
107     '*threshold': 'uint32' } }
110 # @AudiodevSndioOptions:
112 # Options of the sndio audio backend.
114 # @in: options of the capture stream
116 # @out: options of the playback stream
118 # @dev: the name of the sndio device to use (default 'default')
120 # @latency: play buffer size (in microseconds)
122 # Since: 7.2
124 { 'struct': 'AudiodevSndioOptions',
125   'data': {
126     '*in':        'AudiodevPerDirectionOptions',
127     '*out':       'AudiodevPerDirectionOptions',
128     '*dev':       'str',
129     '*latency':   'uint32'} }
132 # @AudiodevCoreaudioPerDirectionOptions:
134 # Options of the Core Audio backend that are used for both playback and
135 # recording.
137 # @buffer-count: number of buffers
139 # Since: 4.0
141 { 'struct': 'AudiodevCoreaudioPerDirectionOptions',
142   'base': 'AudiodevPerDirectionOptions',
143   'data': {
144     '*buffer-count': 'uint32' } }
147 # @AudiodevCoreaudioOptions:
149 # Options of the coreaudio audio backend.
151 # @in: options of the capture stream
153 # @out: options of the playback stream
155 # Since: 4.0
157 { 'struct': 'AudiodevCoreaudioOptions',
158   'data': {
159     '*in':  'AudiodevCoreaudioPerDirectionOptions',
160     '*out': 'AudiodevCoreaudioPerDirectionOptions' } }
163 # @AudiodevDsoundOptions:
165 # Options of the DirectSound audio backend.
167 # @in: options of the capture stream
169 # @out: options of the playback stream
171 # @latency: add extra latency to playback in microseconds
172 #           (default 10000)
174 # Since: 4.0
176 { 'struct': 'AudiodevDsoundOptions',
177   'data': {
178     '*in':      'AudiodevPerDirectionOptions',
179     '*out':     'AudiodevPerDirectionOptions',
180     '*latency': 'uint32' } }
183 # @AudiodevJackPerDirectionOptions:
185 # Options of the JACK backend that are used for both playback and
186 # recording.
188 # @server-name: select from among several possible concurrent server instances
189 #               (default: environment variable $JACK_DEFAULT_SERVER if set, else "default")
191 # @client-name: the client name to use. The server will modify this name to
192 #               create a unique variant, if needed unless @exact-name is true (default: the
193 #               guest's name)
195 # @connect-ports: if set, a regular expression of JACK client port name(s) to
196 #                 monitor for and automatically connect to
198 # @start-server: start a jack server process if one is not already present
199 #                (default: false)
201 # @exact-name: use the exact name requested otherwise JACK automatically
202 #              generates a unique one, if needed (default: false)
204 # Since: 5.1
206 { 'struct': 'AudiodevJackPerDirectionOptions',
207   'base': 'AudiodevPerDirectionOptions',
208   'data': {
209     '*server-name':   'str',
210     '*client-name':   'str',
211     '*connect-ports': 'str',
212     '*start-server':  'bool',
213     '*exact-name':    'bool' } }
216 # @AudiodevJackOptions:
218 # Options of the JACK audio backend.
220 # @in: options of the capture stream
222 # @out: options of the playback stream
224 # Since: 5.1
226 { 'struct': 'AudiodevJackOptions',
227   'data': {
228     '*in':  'AudiodevJackPerDirectionOptions',
229     '*out': 'AudiodevJackPerDirectionOptions' } }
232 # @AudiodevOssPerDirectionOptions:
234 # Options of the OSS backend that are used for both playback and
235 # recording.
237 # @dev: file name of the OSS device (default '/dev/dsp')
239 # @buffer-count: number of buffers
241 # @try-poll: attempt to use poll mode, falling back to non-polling
242 #            access on failure (default true)
244 # Since: 4.0
246 { 'struct': 'AudiodevOssPerDirectionOptions',
247   'base': 'AudiodevPerDirectionOptions',
248   'data': {
249     '*dev':          'str',
250     '*buffer-count': 'uint32',
251     '*try-poll':     'bool' } }
254 # @AudiodevOssOptions:
256 # Options of the OSS audio backend.
258 # @in: options of the capture stream
260 # @out: options of the playback stream
262 # @try-mmap: try using memory-mapped access, falling back to
263 #            non-memory-mapped access on failure (default true)
265 # @exclusive: open device in exclusive mode (vmix won't work)
266 #             (default false)
268 # @dsp-policy: set the timing policy of the device (between 0 and 10,
269 #              where smaller number means smaller latency but higher
270 #              CPU usage) or -1 to use fragment mode (option ignored
271 #              on some platforms) (default 5)
273 # Since: 4.0
275 { 'struct': 'AudiodevOssOptions',
276   'data': {
277     '*in':         'AudiodevOssPerDirectionOptions',
278     '*out':        'AudiodevOssPerDirectionOptions',
279     '*try-mmap':   'bool',
280     '*exclusive':  'bool',
281     '*dsp-policy': 'uint32' } }
284 # @AudiodevPaPerDirectionOptions:
286 # Options of the Pulseaudio backend that are used for both playback and
287 # recording.
289 # @name: name of the sink/source to use
291 # @stream-name: name of the PulseAudio stream created by qemu.  Can be
292 #               used to identify the stream in PulseAudio when you
293 #               create multiple PulseAudio devices or run multiple qemu
294 #               instances (default: audiodev's id, since 4.2)
296 # @latency: latency you want PulseAudio to achieve in microseconds
297 #           (default 15000)
299 # Since: 4.0
301 { 'struct': 'AudiodevPaPerDirectionOptions',
302   'base': 'AudiodevPerDirectionOptions',
303   'data': {
304     '*name': 'str',
305     '*stream-name': 'str',
306     '*latency': 'uint32' } }
309 # @AudiodevPaOptions:
311 # Options of the PulseAudio audio backend.
313 # @in: options of the capture stream
315 # @out: options of the playback stream
317 # @server: PulseAudio server address (default: let PulseAudio choose)
319 # Since: 4.0
321 { 'struct': 'AudiodevPaOptions',
322   'data': {
323     '*in':     'AudiodevPaPerDirectionOptions',
324     '*out':    'AudiodevPaPerDirectionOptions',
325     '*server': 'str' } }
328 # @AudiodevSdlPerDirectionOptions:
330 # Options of the SDL audio backend that are used for both playback and
331 # recording.
333 # @buffer-count: number of buffers (default 4)
335 # Since: 6.0
337 { 'struct': 'AudiodevSdlPerDirectionOptions',
338   'base': 'AudiodevPerDirectionOptions',
339   'data': {
340     '*buffer-count': 'uint32' } }
343 # @AudiodevSdlOptions:
345 # Options of the SDL audio backend.
347 # @in: options of the recording stream
349 # @out: options of the playback stream
351 # Since: 6.0
353 { 'struct': 'AudiodevSdlOptions',
354   'data': {
355     '*in':  'AudiodevSdlPerDirectionOptions',
356     '*out': 'AudiodevSdlPerDirectionOptions' } }
359 # @AudiodevWavOptions:
361 # Options of the wav audio backend.
363 # @in: options of the capture stream
365 # @out: options of the playback stream
367 # @path: name of the wav file to record (default 'qemu.wav')
369 # Since: 4.0
371 { 'struct': 'AudiodevWavOptions',
372   'data': {
373     '*in':   'AudiodevPerDirectionOptions',
374     '*out':  'AudiodevPerDirectionOptions',
375     '*path': 'str' } }
378 # @AudioFormat:
380 # An enumeration of possible audio formats.
382 # @u8: unsigned 8 bit integer
384 # @s8: signed 8 bit integer
386 # @u16: unsigned 16 bit integer
388 # @s16: signed 16 bit integer
390 # @u32: unsigned 32 bit integer
392 # @s32: signed 32 bit integer
394 # @f32: single precision floating-point (since 5.0)
396 # Since: 4.0
398 { 'enum': 'AudioFormat',
399   'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32', 'f32' ] }
402 # @AudiodevDriver:
404 # An enumeration of possible audio backend drivers.
406 # @jack: JACK audio backend (since 5.1)
408 # Since: 4.0
410 { 'enum': 'AudiodevDriver',
411   'data': [ 'none',
412             { 'name': 'alsa', 'if': 'CONFIG_AUDIO_ALSA' },
413             { 'name': 'coreaudio', 'if': 'CONFIG_AUDIO_COREAUDIO' },
414             { 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' },
415             { 'name': 'dsound', 'if': 'CONFIG_AUDIO_DSOUND' },
416             { 'name': 'jack', 'if': 'CONFIG_AUDIO_JACK' },
417             { 'name': 'oss', 'if': 'CONFIG_AUDIO_OSS' },
418             { 'name': 'pa', 'if': 'CONFIG_AUDIO_PA' },
419             { 'name': 'sdl', 'if': 'CONFIG_AUDIO_SDL' },
420             { 'name': 'sndio', 'if': 'CONFIG_AUDIO_SNDIO' },
421             { 'name': 'spice', 'if': 'CONFIG_SPICE' },
422             'wav' ] }
425 # @Audiodev:
427 # Options of an audio backend.
429 # @id: identifier of the backend
431 # @driver: the backend driver to use
433 # @timer-period: timer period (in microseconds, 0: use lowest possible)
435 # Since: 4.0
437 { 'union': 'Audiodev',
438   'base': {
439     'id':            'str',
440     'driver':        'AudiodevDriver',
441     '*timer-period': 'uint32' },
442   'discriminator': 'driver',
443   'data': {
444     'none':      'AudiodevGenericOptions',
445     'alsa':      { 'type': 'AudiodevAlsaOptions',
446                    'if': 'CONFIG_AUDIO_ALSA' },
447     'coreaudio': { 'type': 'AudiodevCoreaudioOptions',
448                    'if': 'CONFIG_AUDIO_COREAUDIO' },
449     'dbus':      { 'type': 'AudiodevGenericOptions',
450                    'if': 'CONFIG_DBUS_DISPLAY' },
451     'dsound':    { 'type': 'AudiodevDsoundOptions',
452                    'if': 'CONFIG_AUDIO_DSOUND' },
453     'jack':      { 'type': 'AudiodevJackOptions',
454                    'if': 'CONFIG_AUDIO_JACK' },
455     'oss':       { 'type': 'AudiodevOssOptions',
456                    'if': 'CONFIG_AUDIO_OSS' },
457     'pa':        { 'type': 'AudiodevPaOptions',
458                    'if': 'CONFIG_AUDIO_PA' },
459     'sdl':       { 'type': 'AudiodevSdlOptions',
460                    'if': 'CONFIG_AUDIO_SDL' },
461     'sndio':     { 'type': 'AudiodevSndioOptions',
462                    'if': 'CONFIG_AUDIO_SNDIO' },
463     'spice':     { 'type': 'AudiodevGenericOptions',
464                    'if': 'CONFIG_SPICE' },
465     'wav':       'AudiodevWavOptions' } }
468 # @query-audiodevs:
470 # Returns information about audiodev configuration
472 # Returns: array of @Audiodev
474 # Since: 8.0
477 { 'command': 'query-audiodevs',
478   'returns': ['Audiodev'] }