Release 0.41.92
[vala-gnome.git] / vapi / alsa.vapi
blob66148d776ba28e36b22e269b2ea400d93e9d3e6b
1 /* asound.vapi
2  *
3  * Copyright (C) 2009-2018 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * Author:
20  *  Dr. Michael 'Mickey' Lauer
21  *  Wayne Blaszczyk
22  */
24 [CCode (lower_case_cprefix = "snd_", cheader_filename = "alsa/asoundlib.h")]
25 namespace Alsa {
27     public unowned string strerror (int error);
29     [CCode (cname = "snd_aes_iec958_t", destroy_function = "")]
30     public struct AesIec958
31     {
32         public uchar[] status;
33         public uchar[] subcode;
34         public uchar pad;
35         public uchar[] dig_subframe;
36     }
38     [CCode (cprefix = "SND_CTL_", cheader_filename = "alsa/control.h")]
39     public enum CardOpenType
40     {
41         NONBLOCK,
42         ASYNC,
43         READONLY
44     }
46     [Compact]
47     [CCode (cprefix = "snd_ctl_card_info_", cname = "snd_ctl_card_info_t", free_function = "snd_ctl_card_info_free")]
48     public class CardInfo
49     {
50         [CCode (cname = "snd_ctl_card_info_malloc")]
51         public static int alloc (out CardInfo info);
53         public unowned string get_id();
54         public unowned string get_longname();
56         public unowned string get_mixername();
57         public unowned string get_components();
58     }
60     [Compact]
61     [CCode (cprefix = "snd_ctl_", cname = "snd_ctl_t", free_function = "snd_ctl_close")]
62     public class Card
63     {
64         public static int open (out Card card, string name = "default", CardOpenType t = 0);
66         public int card_info (CardInfo info);
67         public int elem_list (ElemList list);
68         public int elem_info (ElemInfo info);
69         public int elem_read (ElemValue value);
70         public int elem_write (ElemValue value);
72         public int get_dB_range (ElemId eid, out long min, out long max);
73         public int convert_to_dB (ElemId eid, long volume, out long gain);
74         public int convert_from_dB (ElemId eid, long gain, out long value, int xdir);
75     }
77     [Compact]
78     [CCode (cprefix = "snd_ctl_elem_id_", cname = "snd_ctl_elem_id_t", free_function = "snd_ctl_elem_id_free")]
79     public class ElemId
80     {
81         [CCode (cname = "snd_ctl_elem_id_malloc")]
82         public static int alloc (out ElemId eid);
84         public unowned string get_name();
85         public uint get_numid();
86         public uint get_index();
87         public uint get_device();
88         public uint get_subdevice();
89     }
91     [Compact]
92     [CCode (cprefix = "snd_ctl_elem_info_", cname = "snd_ctl_elem_info_t", free_function = "snd_ctl_elem_info_free")]
93     public class ElemInfo
94     {
95         [CCode (cname = "snd_ctl_elem_info_malloc")]
96         public static int alloc (out ElemInfo t);
98         public void set_id (ElemId eid);
99         public void set_numid (uint n);
101         public uint get_count ();
102         public ElemType get_type ();
103     }
105     [CCode (cprefix = "SND_CTL_ELEM_IFACE_", cname = "snd_ctl_elem_iface_t")]
106     public enum ElemInterface
107     {
108         CARD,
109         HWDEP,
110         MIXER,
111         PCM,
112         RAWMIDI,
113         TIMER,
114         SEQUENCER
115     }
117     [CCode (cprefix = "SND_CTL_ELEM_TYPE_", cname = "snd_ctl_elem_type_t")]
118     public enum ElemType
119     {
120         NONE,
121         BOOLEAN,
122         INTEGER,
123         ENUMERATED,
124         BYTES,
125         IEC958,
126         INTEGER64,
127     }
129     [Compact]
130     [CCode (cprefix = "snd_ctl_elem_value_", cname = "snd_ctl_elem_value_t", free_function = "snd_ctl_elem_value_free")]
131     public class ElemValue
132     {
133         [CCode (cname = "snd_ctl_elem_value_malloc")]
134         public static int alloc (out ElemValue t);
136         public void set_id (ElemId eid);
138         public bool get_boolean (uint idx);
139         public long get_integer (uint idx);
140         public int64 get_integer64 (uint idx);
141         public uint get_enumerated (uint idx);
142         public uchar get_byte (uint idx);
143         public void get_iec958 (AesIec958 val);
145         public void set_boolean (uint idx, bool b);
146         public void set_integer (uint idx, long l);
147         public void set_integer64 (uint idx, int64 i);
148         public void set_enumerated (uint idx, uint val);
149         public void set_byte (uint idx, uchar val);
150         public void set_iec958 (AesIec958 val);
151     }
153     [Compact]
154     [CCode (cprefix = "snd_ctl_elem_list_", cname = "snd_ctl_elem_list_t", free_function = "snd_ctl_elem_list_free")]
155     public class ElemList
156     {
157         [CCode (cname = "snd_ctl_elem_list_malloc")]
158         public static int alloc (out ElemList list);
159         public int alloc_space (uint entries);
160         public uint get_count();
161         public uint get_used();
162         public void free_space ();
163         public void set_offset (uint offset);
165         public void get_id (uint n, ElemId eid);
166     }
168     [CCode (cname = "snd_spcm_latency_t", cprefix = "SND_SPCM_LATENCY_", has_type_id = false)]
169     public enum PcmSimpleLatency
170     {
171         STANDARD,
172         MEDIUM,
173         REALTIME
174     }
176     [CCode (cname = "snd_spcm_xrun_type_t", cprefix = "SND_SPCM_XRUN_", has_type_id = false)]
177     public enum PcmSimpleXrunType
178     {
179         IGNORE,
180         STOP,
181     }
183     [CCode (cname = "snd_spcm_duplex_t", cprefix = "SND_SPCM_DUPLEX_", has_type_id = false)]
184     public enum PcmSimpleDuplex {
185             LIBERAL,
186             PEDANTIC,
187     }
189     [CCode (cname = "snd_pcm_access_t", cprefix = "SND_PCM_ACCESS_", has_type_id = false)]
190     public enum PcmAccess
191     {
192         MMAP_INTERLEAVED,
193         MMAP_NONINTERLEAVED,
194         MMAP_COMPLEX,
195         RW_INTERLEAVED,
196         RW_NONINTERLEAVED,
197         LAST,
198     }
200     [CCode (cname = "snd_pcm_class_t", cprefix = "SND_PCM_CLASS_", has_type_id = false)]
201     public enum PcmClass
202     {
203         GENERIC,
204         MULTI,
205         MODEM,
206         DIGITIZER,
207         LAST,
208     }
210     [CCode (cname = "snd_pcm_format_t", cprefix = "SND_PCM_FORMAT_", has_type_id = false)]
211     public enum PcmFormat
212     {
213         UNKNOWN,
214         S8,
215         U8,
216         S16_LE,
217         S16_BE,
218         U16_LE,
219         U16_BE,
220         S24_LE,
221         S24_BE,
222         U24_LE,
223         U24_BE,
224         S32_LE,
225         S32_BE,
226         U32_LE,
227         U32_BE,
228         FLOAT_LE,
229         FLOAT_BE,
230         FLOAT64_LE,
231         FLOAT64_BE,
232         IEC958_SUBFRAME_LE,
233         IEC958_SUBFRAME_BE,
234         MU_LAW,
235         A_LAW,
236         IMA_ADPCM,
237         MPEG,
238         GSM,
239         SPECIAL,
240         S24_3LE,
241         S24_3BE,
242         U24_3LE,
243         U24_3BE,
244         S20_3LE,
245         S20_3BE,
246         U20_3LE,
247         U20_3BE,
248         S18_3LE,
249         S18_3BE,
250         U18_3LE,
251         U18_3BE,
252         LAST,
253         S16,
254         U16,
255         S24,
256         U24,
257         S32,
258         U32,
259         FLOAT,
260         FLOAT64,
261         IEC958_SUBFRAME,
262     }
264     [CCode (cname = "gint", cprefix = "SND_PCM_", has_type_id = false)]
265     public enum PcmMode
266     {
267         NONBLOCK,
268         ASYNC,
269         NO_AUTO_RESAMPLE,
270         NO_AUTO_CHANNELS,
271         NO_AUTO_FORMAT,
272         NO_SOFTVOL,
273     }
275     [CCode (cname = "snd_pcm_start_t", cprefix = "SND_PCM_START_", has_type_id = false)]
276     public enum PcmStart
277     {
278         DATA,
279         EXPLICIT,
280         LAST,
281     }
283     [CCode (cname = "snd_pcm_state_t", cprefix = "", has_type_id = false)]
284     public enum PcmState
285     {
286         OPEN,
287         SETUP,
288         PREPARED,
289         RUNNING,
290         XRUN,
291         DRAINING,
292         PAUSED,
293         SUSPENDED,
294         DISCONNECTED,
295         LAST,
296     }
298     [CCode (cname = "snd_pcm_stream_t", cprefix = "SND_PCM_STREAM_", has_type_id = false)]
299     public enum PcmStream
300     {
301         PLAYBACK,
302         CAPTURE,
303         LAST,
304     }
306     [CCode (cname = "snd_pcm_subclass_t", cprefix = "SND_PCM_SUBCLASS_", has_type_id = false)]
307     public enum PcmSubclass
308     {
309         GENERIC_MIX,
310         MULTI_MIX,
311         LAST,
312     }
314     [CCode (cname = "snd_pcm_subformat_t", cprefix = "SND_PCM_SUBFORMAT_", has_type_id = false)]
315     public enum PcmSubformat
316     {
317         STD,
318         LAST,
319     }
321     [CCode (cname = "snd_pcm_tstamp_t", cprefix = "SND_PCM_TSTAMP_", has_type_id = false)]
322     public enum PcmTimestamp
323     {
324         NONE,
325         ENABLE,
326         MMAP,
327         LAST,
328     }
330     [CCode (cname = "snd_pcm_type_t", cprefix = "SND_PCM_TYPE_", has_type_id = false)]
331     public enum PcmType
332     {
333         HW,
334         HOOKS,
335         MULTI,
336         FILE,
337         NULL,
338         SHM,
339         INET,
340         COPY,
341         LINEAR,
342         ALAW,
343         MULAW,
344         ADPCM,
345         RATE,
346         ROUTE,
347         PLUG,
348         SHARE,
349         METER,
350         MIX,
351         DROUTE,
352         LBSERVER,
353         LINEAR_FLOAT,
354         LADSPA,
355         DMIX,
356         JACK,
357         DSNOOP,
358         DSHARE,
359         IEC958,
360         SOFTVOL,
361         IOPLUG,
362         MMAP_EMUL,
363         LAST,
364     }
366     [CCode (cname = "snd_pcm_xrun_t", cprefix = "SND_PCM_XRUN_", has_type_id = false)]
367     public enum PcmXrun
368     {
369         NONE,
370         STOP,
371         LAST,
372     }
374     [SimpleType]
375     [CCode (cname = "snd_pcm_access_mask_t")]
376     public struct PcmAccessMask
377     {
378     }
380     [SimpleType]
381     [CCode (cname = "snd_pcm_format_mask_t")]
382     public struct PcmFormatMask
383     {
384     }
386     [SimpleType]
387     [CCode (cname = "snd_pcm_subformat_mask_t")]
388     public struct PcmSubformatMask
389     {
390     }
392     [SimpleType]
393     [CCode (cname = "snd_pcm_timestamp_t")]
394     public struct PcmSoftwareTimestamp
395     {
396     }
398     [SimpleType]
399     [CCode (cname = "snd_pcm_htimestamp_t")]
400     public struct PcmHardwareTimestamp
401     {
402     }
404     [Compact]
405     [CCode (cname = "snd_pcm_info_t", cprefix = "snd_pcm_info_")]
406     public class PcmInfo
407     {
408         public static int alloca( out PcmInfo info );
409         public static int malloc( out PcmInfo info );
410         public void free();
411         public void copy( PcmInfo source );
412         public uint get_device();
413         public uint get_subdevice();
414         public PcmStream get_stream();
415         public int get_card();
416         public string get_id();
417         public string get_name();
418         public string get_subdevice_name();
419         public PcmClass get_class();
420         public PcmSubclass get_subclass();
421         public uint get_subdevices_count();
422         public uint get_subdevices_avail();
423         public PcmSyncId get_sync();
424         public void set_device( uint val );
425         public void set_subdevice( uint val );
426         public void set_stream( PcmStream val );
427     }
429     [Compact]
430     [CCode (cname = "snd_pcm_hw_params_t", cprefix = "snd_pcm_hw_params_", free_function = "snd_pcm_hw_params_free")]
431     public class PcmHardwareParams
432     {
433         public static int alloca( out PcmHardwareParams params );
434         public static int malloc( out PcmHardwareParams params );
435         public void free();
436         public void copy( PcmHardwareParams source );
437         public int get_access( PcmAccess access );
438         public int get_access_mask( PcmAccessMask mask );
439         public int get_format( PcmFormat format );
440         public void get_format_mask( PcmFormatMask mask );
441         public int get_subformat( PcmSubformat subformat );
442         public void get_subformat_mask( PcmSubformatMask mask );
443         public int get_channels( out int val );
444         public int get_channels_min( out int val );
445         public int get_channels_max( out int val );
446         public int get_rate( out int val, out int dir );
447         public int get_rate_min( out int val, out int dir );
448         public int get_rate_max( out int val, out int dir );
449         public int get_period_time( out int val, out int dir );
450         public int get_period_time_min( out int val, out int dir );
451         public int get_period_time_max( out int val, out int dir );
452         public int get_period_size( out PcmUnsignedFrames frames, out int dir );
453         public int get_period_size_min( out PcmUnsignedFrames frames, out int dir );
454         public int get_period_size_max( out PcmUnsignedFrames frames, out int dir );
455         public int get_periods( out int val, out int dir );
456         public int get_periods_min( out int val, out int dir );
457         public int get_periods_max( out int val, out int dir );
458         public int get_buffer_time( out int val, out int dir );
459         public int get_buffer_time_min( out int val, out int dir );
460         public int get_buffer_time_max( out int val, out int dir );
461         public int get_buffer_size( out PcmUnsignedFrames frames );
462         public int get_buffer_size_min( out PcmUnsignedFrames frames );
463         public int get_buffer_size_max( out PcmUnsignedFrames frames );
464         public int get_min_align( out PcmUnsignedFrames frames );
466         public int can_mmap_sample_resolution();
467         public int is_double();
468         public int is_batch();
469         public int is_block_transfer();
470         public int is_monotonic();
471         public int can_overrange();
472         public int can_pause();
473         public int can_resume();
474         public int is_half_duplex();
475         public int is_joint_duplex();
476         public int can_sync_start();
477         public int can_disable_period_wakeup();
478         public int get_rate_numden( out uint rate_num, out uint rate_den );
479         public int get_sbits();
480         public int get_fifo_size();
481     }
483     [Compact]
484     [CCode (cname = "snd_pcm_sw_params_t")]
485     public class PcmSoftwareParams
486     {
487     }
489     [SimpleType]
490     [CCode (cname = "snd_pcm_uframes_t")]
491     [IntegerType (rank = 9)]
492     public struct PcmUnsignedFrames
493     {
494     }
496     [SimpleType]
497     [CCode (cname = "snd_pcm_sframes_t")]
498     [IntegerType (rank = 8)]
499     public struct PcmSignedFrames
500     {
501     }
503     [Compact]
504     [CCode (cname = "snd_pcm_channel_area_t", free_function = "")]
505     public struct PcmChannelArea
506     {
507         public void *addr;
508         public uint first;
509         public uint step;
510     }
512     [Compact]
513     [CCode (cname = "snd_pcm_sync_id_t", free_function = "")]
514     public struct PcmSyncId
515     {
516         public uchar id[16];
517         public ushort id16[8];
518         public uint id32[4];
519     }
521     [Compact]
522     [CCode (cname = "snd_pcm_t", cprefix = "snd_pcm_", free_function = "")]
523     public class PcmDevice
524     {
525         public static int open( out PcmDevice pcm, string name, PcmStream stream, PcmMode mode = 0 );
527         public int close();
528         [CCode (cname = "snd_pcm_name")]
529         public string get_name();
530         [CCode (cname = "snd_pcm_type")]
531         public PcmType get_type();
532         [CCode (cname = "snd_pcm_stream")]
533         public PcmStream get_stream();
534         [CCode (cname = "snd_pcm_poll_descriptors_count")]
535         public int get_poll_descriptors_count();
536         [CCode (cname = "snd_pcm_poll_descriptors")]
537         public int set_poll_descriptors( Posix.pollfd[] pfds );
538         [CCode (cname = "snd_pcm_poll_descriptors_revents")]
539         public int set_poll_descriptors_revents( Posix.pollfd[] pfds, ushort[] revents );
540         [CCode (cname = "snd_pcm_nonblock")]
541         public int set_nonblock( bool nonblock );
543         //public int snd_async_add_pcm_handler( snd_async_handler_t **handler, snd_pcm_t *pcm, snd_async_callback_t callback, void *private_data );
544         //public PcmDevice async_handler_get_pcm( snd_async_handler_t *handler );
545         public int info( PcmInfo info );
546         public int sw_params_current( out PcmSoftwareParams params );
547         public int sw_params( PcmSoftwareParams params );
548         public int hw_free();
549         public int prepare();
550         public int reset();
551         [CCode (cname = "snd_pcm_status")]
552         public int set_status( PcmState status );
553         public int start();
554         public int drop();
555         public int drain();
556         public int pause( bool enable );
557         public PcmState state();
558         public int hwsync();
559         public int delay( PcmSignedFrames delayp );
560         public int resume();
561         public int htimestamp( PcmUnsignedFrames avail, PcmHardwareTimestamp tstamp );
562         public PcmSignedFrames avail();
563         public PcmSignedFrames avail_update();
564         public int avail_delay( out PcmSignedFrames availp, out PcmSignedFrames delayp );
565         public PcmSignedFrames rewindable();
566         public PcmSignedFrames rewind( PcmUnsignedFrames frames );
567         public PcmSignedFrames forwardable();
568         public PcmSignedFrames forward( PcmUnsignedFrames frames );
569         public PcmSignedFrames writei( [CCode (array_length = false)] uint8[] buffer, PcmUnsignedFrames size );
570         public PcmSignedFrames writen( [CCode (array_length = false)] uint8*[] buffer, PcmUnsignedFrames size );
571         public PcmSignedFrames readi( [CCode (array_length = false)] uint8[] buffer, PcmUnsignedFrames size );
572         public PcmSignedFrames readn( [CCode (array_length = false)] uint8*[] buffer, PcmUnsignedFrames size );
573         public int wait( int timeout );
574         public int link( PcmDevice otherDevice );
575         public int unlink();
577         // high level API
578         public int recover( int err, int silent );
579         public int set_params( PcmFormat format, PcmAccess access, uint channels, uint rate, int soft_resample, uint latency );
580         public int get_params( out PcmUnsignedFrames buffer_size, out PcmUnsignedFrames period_size );
582         // simple setup
583         [CCode (cname = "snd_spcm_init")]
584         public int simple_init( uint rate, uint channels, PcmFormat format, PcmSubformat subformat, PcmSimpleLatency latency, PcmAccess access, PcmSimpleXrunType xrun );
585         [CCode (cname = "snd_spcm_init_duplex")]
586         public static int simple_init_duplex( PcmDevice playback, PcmDevice capture, uint rate, uint channels, PcmFormat format, PcmSubformat subformat, PcmSimpleLatency latency, PcmAccess access, PcmSimpleXrunType xrun, PcmSimpleDuplex duplex );
587         [CCode (cname = "snd_spcm_get_params")]
588         public int simple_get_params( out uint rate, out PcmUnsignedFrames buffer_size, out PcmUnsignedFrames period_size );
590         // HW params API
591         public int hw_params_current( out PcmHardwareParams params );
592         public int hw_params( PcmHardwareParams params );
593         public int hw_params_any( PcmHardwareParams params );
594         public int hw_params_test_access( PcmHardwareParams params, PcmAccess access );
595         public int hw_params_set_access( PcmHardwareParams params, PcmAccess access );
596         public int hw_params_set_access_first( PcmHardwareParams params, out PcmAccess access );
597         public int hw_params_set_access_last( PcmHardwareParams params, out PcmAccess access );
598         public int hw_params_set_access_mask( PcmHardwareParams params, out PcmAccessMask mask );
599         public int hw_params_test_format( PcmHardwareParams params, PcmFormat format );
600         public int hw_params_set_format( PcmHardwareParams params, PcmFormat format );
601         public int hw_params_set_format_first( PcmHardwareParams params, out PcmFormat format );
602         public int hw_params_set_format_last( PcmHardwareParams params, out PcmFormat format );
603         public int hw_params_set_format_mask( PcmHardwareParams params, out PcmFormatMask mask );
604         public int hw_params_test_subformat( PcmHardwareParams params, PcmSubformat subformat );
605         public int hw_params_set_subformat( PcmHardwareParams params, PcmSubformat subformat );
606         public int hw_params_set_subformat_first( PcmHardwareParams params, out PcmSubformat subformat );
607         public int hw_params_set_subformat_last( PcmHardwareParams params, out PcmSubformat subformat );
608         public int hw_params_set_subformat_mask( PcmHardwareParams params, out PcmSubformatMask mask );
609         public int hw_params_test_channels( PcmHardwareParams params, uint val );
610         public int hw_params_set_channels( PcmHardwareParams params, uint val );
611         public int hw_params_set_channels_min( PcmHardwareParams params, out int val );
612         public int hw_params_set_channels_max( PcmHardwareParams params, out int val );
613         public int hw_params_set_channels_minmax( PcmHardwareParams params, out uint min, out int max );
614         public int hw_params_set_channels_near( PcmHardwareParams params, out int val );
615         public int hw_params_set_channels_first( PcmHardwareParams params, out int val );
616         public int hw_params_set_channels_last( PcmHardwareParams params, out int val );
617         public int hw_params_test_rate( PcmHardwareParams params, uint val, int dir );
618         public int hw_params_set_rate( PcmHardwareParams params, uint val, int dir );
619         public int hw_params_set_rate_min( PcmHardwareParams params, out int val, out int dir );
620         public int hw_params_set_rate_max( PcmHardwareParams params, out int val, out int dir );
621         public int hw_params_set_rate_minmax( PcmHardwareParams params, out uint min, out int mindir, out int max, out int maxdir );
622         public int hw_params_set_rate_near( PcmHardwareParams params, ref int val, int dir );
623         public int hw_params_set_rate_first( PcmHardwareParams params, out int val, out int dir );
624         public int hw_params_set_rate_last( PcmHardwareParams params, out int val, out int dir );
625         public int hw_params_set_rate_resample( PcmHardwareParams params, uint val );
626         public int hw_params_get_rate_resample( PcmHardwareParams params, out int val );
627         public int hw_params_set_export_buffer( PcmHardwareParams params, uint val );
628         public int hw_params_get_export_buffer( PcmHardwareParams params, out int val );
629         public int hw_params_set_period_wakeup( PcmHardwareParams params, uint val );
630         public int hw_params_get_period_wakeup( PcmHardwareParams params, out int val );
631         public int hw_params_test_period_time( PcmHardwareParams params, uint val, int dir );
632         public int hw_params_set_period_time( PcmHardwareParams params, uint val, int dir );
633         public int hw_params_set_period_time_min( PcmHardwareParams params, out int val, out int dir );
634         public int hw_params_set_period_time_max( PcmHardwareParams params, out int val, out int dir );
635         public int hw_params_set_period_time_minmax( PcmHardwareParams params, out uint min, out int mindir, out int max, out int maxdir );
636         public int hw_params_set_period_time_near( PcmHardwareParams params, out int val, out int dir );
637         public int hw_params_set_period_time_first( PcmHardwareParams params, out int val, out int dir );
638         public int hw_params_set_period_time_last( PcmHardwareParams params, out int val, out int dir );
639         public int hw_params_test_period_size( PcmHardwareParams params, PcmUnsignedFrames frames, int dir );
640         public int hw_params_set_period_size( PcmHardwareParams params, PcmUnsignedFrames frames, int dir );
641         public int hw_params_set_period_size_min( PcmHardwareParams params, out PcmUnsignedFrames frames, out int dir );
642         public int hw_params_set_period_size_max( PcmHardwareParams params, out PcmUnsignedFrames frames, out int dir );
643         public int hw_params_set_period_size_minmax( PcmHardwareParams params, out PcmUnsignedFrames min, out int mindir, out PcmUnsignedFrames max, out int maxdir );
644         public int hw_params_set_period_size_near( PcmHardwareParams params, out PcmUnsignedFrames frames, out int dir );
645         public int hw_params_set_period_size_first( PcmHardwareParams params, out PcmUnsignedFrames frames, out int dir );
646         public int hw_params_set_period_size_last( PcmHardwareParams params, out PcmUnsignedFrames frames, out int dir );
647         public int hw_params_set_period_size_integer( PcmHardwareParams params );
648         public int hw_params_test_periods( PcmHardwareParams params, uint val, int dir );
649         public int hw_params_set_periods( PcmHardwareParams params, uint val, int dir );
650         public int hw_params_set_periods_min( PcmHardwareParams params, out int val, out int dir );
651         public int hw_params_set_periods_max( PcmHardwareParams params, out int val, out int dir );
652         public int hw_params_set_periods_minmax( PcmHardwareParams params, out uint min, out int mindir, out int max, out int maxdir );
653         public int hw_params_set_periods_near( PcmHardwareParams params, out int val, out int dir );
654         public int hw_params_set_periods_first( PcmHardwareParams params, out int val, out int dir );
655         public int hw_params_set_periods_last( PcmHardwareParams params, out int val, out int dir );
656         public int hw_params_set_periods_integer( PcmHardwareParams params );
657         public int hw_params_test_buffer_time( PcmHardwareParams params, uint val, int dir );
658         public int hw_params_set_buffer_time( PcmHardwareParams params, uint val, int dir );
659         public int hw_params_set_buffer_time_min( PcmHardwareParams params, out int val, out int dir );
660         public int hw_params_set_buffer_time_max( PcmHardwareParams params, out int val, out int dir );
661         public int hw_params_set_buffer_time_minmax( PcmHardwareParams params, out uint min, out int mindir, out int max, out int maxdir );
662         public int hw_params_set_buffer_time_near( PcmHardwareParams params, out int val, out int dir );
663         public int hw_params_set_buffer_time_first( PcmHardwareParams params, out int val, out int dir );
664         public int hw_params_set_buffer_time_last( PcmHardwareParams params, out int val, out int dir );
665         public int hw_params_test_buffer_size( PcmHardwareParams params, PcmUnsignedFrames frames );
666         public int hw_params_set_buffer_size( PcmHardwareParams params, PcmUnsignedFrames frames );
667         public int hw_params_set_buffer_size_min( PcmHardwareParams params, out PcmUnsignedFrames frames );
668         public int hw_params_set_buffer_size_max( PcmHardwareParams params, out PcmUnsignedFrames frames );
669         public int hw_params_set_buffer_size_minmax( PcmHardwareParams params, out PcmUnsignedFrames min, out PcmUnsignedFrames max );
670         public int hw_params_set_buffer_size_near( PcmHardwareParams params, out PcmUnsignedFrames frames );
671         public int hw_params_set_buffer_size_first( PcmHardwareParams params, out PcmUnsignedFrames frames );
672         public int hw_params_set_buffer_size_last( PcmHardwareParams params, out PcmUnsignedFrames frames );
674         // format conversion
675         public PcmSignedFrames bytes_to_frames( ssize_t bytes );
676         public ssize_t frames_to_bytes( PcmSignedFrames frames );
677         public long bytes_to_samples( ssize_t bytes );
678         public ssize_t samples_to_bytes( long samples );
679     }
681     [CCode (cprefix = "SND_MIXER_SABSTRACT_", cname = "snd_mixer_selem_regopt_abstract")]
682     public enum MixerAbstractionLevel
683     {
684         NONE,
685         BASIC
686     }
688     [CCode (cname = "struct snd_mixer_selem_regopt", destroy_function = "", cheader_filename = "alsa/mixer.h")]
689     public struct MixerRegistrationOptions
690     {
691         public int ver;
692         public MixerAbstractionLevel @abstract;
693         public string device;
694         public PcmDevice playback_pcm;
695         public PcmDevice capture_pcm;
696     }
698     [Compact]
699     [CCode (cprefix = "snd_mixer_class_", cname = "snd_mixer_class_t", free_function = "snd_mixer_class_close", cheader_filename = "alsa/mixer.h")]
700     public class MixerClass
701     {
702     }
704     [Compact]
705     [CCode (cprefix = "snd_mixer_", cname = "snd_mixer_t", free_function = "snd_mixer_close")]
706     public class Mixer
707     {
708         public static int open (out Mixer mixer, int t = 0 /* MixerOpenType t = 0 */ );
709         public int attach (string card = "default");
710         public int detach (string card = "default");
711         public uint get_count ();
712         public int load ();
714         [CCode (cname = "snd_mixer_selem_register")]
715         public int register (MixerRegistrationOptions? options = null, out MixerClass classp = null );
717         public MixerElement first_elem ();
718         public MixerElement last_elem ();
719     }
721     [Compact]
722     [CCode (cprefix = "snd_mixer_selem_", cname = "snd_mixer_elem_t", free_function = "")]
723     public class MixerElement
724     {
725         [CCode (cname = "snd_mixer_elem_next")]
726         public MixerElement next ();
727         [CCode (cname = "snd_mixer_elem_prev")]
728         public MixerElement prev ();
730         public void get_id (SimpleElementId eid);
731         public bool is_active ();
732         public bool is_playback_mono ();
733         public bool has_playback_channel (SimpleChannelId channel);
734         public bool is_capture_mono ();
735         public bool has_capture_channel (SimpleChannelId channel);
736         public int  get_capture_group ();
737         public bool has_common_volume ();
738         public bool has_playback_volume ();
739         public bool has_playback_volume_joined ();
740         public bool has_capture_volume ();
741         public bool has_capture_volume_joined ();
742         public bool has_common_switch ();
743         public bool has_playback_switch ();
744         public bool has_playback_switch_joined ();
745         public bool has_capture_switch ();
746         public bool has_capture_switch_joined ();
747         public bool has_capture_switch_exclusive ();
749         public int ask_playback_vol_dB (long val, out long dBval);
750         public int ask_capture_vol_dB (long val, out long dBval);
751         public int ask_playback_dB_vol (long dBval, int dir, out long val);
752         public int ask_capture_dB_vol (long dBval, int dir, out long val);
753         public int get_playback_volume (SimpleChannelId channel, out long val);
754         public int get_capture_volume (SimpleChannelId channel, out long val);
755         public int get_playback_dB (SimpleChannelId channel, out long val);
756         public int get_capture_dB (SimpleChannelId channel, out long val);
757         public int get_playback_switch (SimpleChannelId channel, out int val);
758         public int get_capture_switch (SimpleChannelId channel, out int val);
759         public int set_playback_volume (SimpleChannelId channel, long val);
760         public int set_capture_volume (SimpleChannelId channel, long val);
761         public int set_playback_dB (SimpleChannelId channel, long val, int dir);
762         public int set_capture_dB (SimpleChannelId channel, long val, int dir);
763         public int set_playback_volume_all (long val);
764         public int set_capture_volume_all (long val);
765         public int set_playback_dB_all (long val, int dir);
766         public int set_capture_dB_all (long val, int dir);
767         public int set_playback_switch (SimpleChannelId channel, int val);
768         public int set_capture_switch (SimpleChannelId channel, int val);
769         public int set_playback_switch_all (int val);
770         public int set_capture_switch_all (int val);
771         public int get_playback_volume_range (out long min, out long max);
772         public int get_playback_dB_range (out long min, out long max);
773         public int set_playback_volume_range (long min, long max);
774         public int get_capture_volume_range (out long min, out long max);
775         public int get_capture_dB_range (out long min, out long max);
776         public int set_capture_volume_range (long min, long max);
777         public int is_enumerated ();
778         public int is_enum_playback ();
779         public int is_enum_capture ();
780         public int get_enum_items ();
781         public int get_enum_item_name (uint idx, size_t maxlen, out string str);
782         public int get_enum_item (SimpleChannelId channel, out uint idxp);
783         public int set_enum_item (SimpleChannelId channel, uint idx);
784     }
786     [CCode (cprefix = "SND_MIXER_SCHN_", cname = "snd_mixer_selem_channel_id_t")]
787     public enum SimpleChannelId
788     {
789         UNKNOWN,
790         MONO,
791         FRONT_LEFT,
792         FRONT_RIGHT,
793         REAR_LEFT,
794         REAR_RIGHT,
795         FRONT_CENTER,
796         WOOFER,
797         SIDE_LEFT,
798         SIDE_RIGHT,
799         REAR_CENTER,
800         LAST
801     }
803     [Compact]
804     [CCode (cprefix = "snd_mixer_selem_id_", cname = "snd_mixer_selem_id_t", free_function = "")]
805     public class SimpleElementId
806     {
807         [CCode (cname = "snd_mixer_selem_id_malloc")]
808         public static int alloc (out SimpleElementId eid);
810         public unowned string get_name();
811         public uint get_index();
812     }
814     [CCode (cname = "snd_seq_client_type_t", cprefix = "SND_SEQ_", has_type_id = false)]
815     public enum SeqClientType
816     {
817         USER_CLIENT,
818         KERNEL_CLIENT
819     }
821     [CCode (cname = "snd_seq_event_type_t", cprefix = "SND_SEQ_EVENT_", has_type_id = false)]
822     public enum SeqEventType
823     {
824         SYSTEM,
825         RESULT,
826         NOTE,
827         NOTEON,
828         NOTEOFF,
829         KEYPRESS,
830         CONTROLLER,
831         PGMCHANGE,
832         CHANPRESS,
833         PITCHBEND,
834         CONTROL14,
835         NONREGPARAM,
836         REGPARAM,
837         SONGPOS,
838         SONGSEL,
839         QFRAME,
840         TIMESIGN,
841         KEYSIGN,
842         START,
843         CONTINUE,
844         STOP,
845         SETPOS_TICK,
846         SETPOS_TIME,
847         TEMPO,
848         CLOCK,
849         TICK,
850         QUEUE_SKEW,
851         SYNC_POS,
852         TUNE_REQUEST,
853         RESET,
854         SENSING,
855         ECHO,
856         OSS,
857         CLIENT_START,
858         CLIENT_EXIT,
859         CLIENT_CHANGE,
860         PORT_START,
861         PORT_EXIT,
862         PORT_CHANGE,
863         PORT_SUBSCRIBED,
864         PORT_UNSUBSCRIBED,
865         USR0,
866         USR1,
867         USR2,
868         USR3,
869         USR4,
870         USR5,
871         USR6,
872         USR7,
873         USR8,
874         USR9,
875         SYSEX,
876         BOUNCE,
877         USR_VAR0,
878         USR_VAR1,
879         USR_VAR2,
880         USR_VAR3,
881         USR_VAR4,
882         NONE
883     }
885     [CCode (cname = "int", cprefix = "SND_SEQ_OPEN_", has_type_id = false)]
886     public enum SeqOpenMode
887     {
888         OUTPUT,
889         INPUT,
890         DUPLEX
891     }
893     [CCode (cname = "uint", cprefix = "SND_SEQ_PORT_CAP_", has_type_id = false)]
894     [Flags]
895     public enum SeqPortCap
896     {
897         READ,
898         WRITE,
899         SYNC_READ,
900         SYNC_WRITE,
901         DUPLEX,
902         SUBS_READ,
903         SUBS_WRITE,
904         NO_EXPORT
905     }
907     [CCode (cname = "uint", cprefix = "SND_SEQ_PORT_TYPE_", has_type_id = false)]
908     [Flags]
909     public enum SeqPortType
910     {
911         SPECIFIC,
912         MIDI_GENERIC,
913         MIDI_GM,
914         MIDI_GS,
915         MIDI_XG,
916         MIDI_MT32,
917         MIDI_GM2,
918         SYNTH,
919         DIRECT_SAMPLE,
920         SAMPLE,
921         HARDWARE,
922         SOFTWARE,
923         SYNTHESIZER,
924         PORT,
925         APPLICATION
926     }
928     [CCode (cname = "snd_seq_query_subs_type_t", cprefix = "SND_SEQ_QUERY_SUBS_", has_type_id = false)]
929     public enum SeqQuerySubsType
930     {
931         READ,
932         WRITE
933     }
935     [CCode (cname = "int", cprefix = "SND_SEQ_TYPE_", has_type_id = false)]
936     public enum SeqType
937     {
938         HW,
939         SHM,
940         INET
941     }
943     [Compact]
944     [CCode (cname = "snd_seq_addr_t", free_function = "")]
945     public struct SeqAddr
946     {
947         public uint8 client;
948         public uint8 port;
949     }
951     [Compact]
952     [CCode (cname = "snd_seq_client_info_t", cprefix = "snd_seq_client_info_", free_function = "")]
953     public class SeqClientInfo
954     {
955         public static int alloca( out SeqClientInfo info );
956         public static int malloc( out SeqClientInfo info );
957         public void free();
958         public void copy( SeqClientInfo source );
959         public int get_client();
960         public SeqClientType get_type();
961         public unowned string get_name();
962         public int get_broadcast_filter();
963         public int get_error_bounce();
964         public unowned string get_event_filter();
965         public int get_num_ports();
966         public int get_event_lost();
967         public void set_client( int client );
968         public void set_name( string name );
969         public void set_broadcast_filter( int val );
970         public void set_error_bounce( int val );
971         public void set_event_filter( string filter );
972         public void event_filter_clear();
973         public void event_filter_add( SeqEventType event_type );
974         public void event_filter_del( SeqEventType event_type );
975         public void event_filter_check( SeqEventType event_type );
976     }
978     [CCode (cname = "snd_seq_connect_t", free_function = "", has_type_id = false)]
979     public struct SeqConnect
980     {
981         public SeqAddr sender;
982         public SeqAddr dest;
983     }
985     [Compact]
986     [CCode (cname = "snd_seq_t", cprefix = "snd_seq_", free_function = "")]
987     public class SeqDevice
988     {
989         public static int open( out SeqDevice seq, string name, SeqOpenMode streams, int mode );
990         public unowned string name();
991         public SeqType type();
992         public int close();
994         public int poll_descriptors_count( int events );
995         public int poll_descriptors( Posix.pollfd[] pfds, int events );
996         public int poll_descriptors_revents( Posix.pollfd[] pfds, out ushort revents );
997         public int nonblock( int nonblock );
998         public int client_id();
1000         public size_t get_output_buffer_size();
1001         public size_t get_input_buffer_size();
1002         public int set_output_buffer_size( size_t size );
1003         public int set_input_buffer_size( size_t size );
1005         public int create_simple_port( string name, SeqPortCap caps, SeqPortType type );
1006         public int delete_simple_port( int port );
1008         public int connect_from( int my_port, int src_client, int src_port );
1009         public int connect_to( int my_port, int dest_client, int dest_port );
1010         public int disconnect_from( int my_port, int src_client, int src_port );
1011         public int disconnect_to( int my_port, int dest_client, int dest_port );
1013         public int set_client_name( string name );
1014         public int set_client_event_filter( SeqEventType event_type );
1015         public int set_client_pool_output( size_t size );
1016         public int set_client_pool_output_room( size_t size );
1017         public int set_client_pool_input( size_t size );
1018         public int sync_output_queue();
1019         public int parse_address( SeqAddr addr, string str );
1020         public int reset_pool_output();
1021         public int reset_pool_input();
1023         public int query_next_client( SeqClientInfo info );
1024         public int query_next_port( SeqPortInfo info );
1025         public int query_port_subscribers( SeqQuerySubscribe subs );
1026         public int query_named_queue( string name );
1028         public int event_output( SeqEvent ev );
1029         public int event_output_buffer( SeqEvent ev );
1030         public int event_output_direct( SeqEvent ev );
1031         public int event_input( out SeqEvent ev );
1032         public int event_input_pending( bool fetch_sequencer );
1033         public int drain_output();
1034         public int event_output_pending();
1035         public int extract_output( out SeqEvent ev );
1036         public int drop_output();
1037         public int drop_output_buffer();
1038         public int drop_input();
1039         public int drop_input_buffer();
1040     }
1042     [Compact]
1043     [CCode (cname = "snd_seq_event_t", cprefix = "snd_seq_event_", free_function = "snd_seq_free_event")]
1044     public class SeqEvent
1045     {
1046         public size_t length();
1048         public SeqEventType type;
1049         public uint8 flags;
1050         public uint8 tag;
1052         public uint8 queue;
1053         public SeqTimestamp time;
1055         public SeqAddr source;
1056         public SeqAddr dest;
1058         [CCode (cname = "data.note")]
1059         public SeqEventNote note;
1060         [CCode (cname = "data.control")]
1061         public SeqEventControl control;
1062         [CCode (cname = "data.raw8")]
1063         public SeqEventRaw8 raw8;
1064         [CCode (cname = "data.raw32")]
1065         public SeqEventRaw32 raw32;
1066         [CCode (cname = "data.ext")]
1067         public SeqEventExt ext;
1068         [CCode (cname = "data.queue")]
1069         public SeqEventQueueControl queue_control;
1070         [CCode (cname = "data.time")]
1071         public SeqTimestamp timestamp;
1072         [CCode (cname = "data.addr")]
1073         public SeqAddr addr;
1074         [CCode (cname = "data.connect")]
1075         public SeqConnect connect;
1076         [CCode (cname = "data.result")]
1077         public SeqResult result;
1078     }
1080     [CCode (cname = "snd_seq_ev_ctrl_t", free_function = "", has_type_id = false)]
1081     public struct SeqEventControl
1082     {
1083         public uint8 channel;
1084         public uint8 unused[3];
1085         public uint param;
1086         public int value;
1087     }
1089     [CCode (cname = "snd_seq_ev_ext_t", free_function = "", has_type_id = false)]
1090     public struct SeqEventExt
1091     {
1092         public uint len;
1093         public void* ptr;
1094     }
1096     [CCode (cname = "snd_seq_ev_note_t", free_function = "", has_type_id = false)]
1097     public struct SeqEventNote
1098     {
1099         public uint8 channel;
1100         public uint8 note;
1101         public uint8 velocity;
1102         public uint8 off_velocity;
1103         public uint duration;
1104     }
1106     [CCode (cname = "snd_seq_ev_queue_control_t", free_function = "", has_type_id = false)]
1107     public struct SeqEventQueueControl
1108     {
1109         public uint8 queue;
1110         public uint8 unused[3];
1111         [CCode (cname = "param.value")]
1112         public int value;
1113         [CCode (cname = "param.time")]
1114         public SeqTimestamp time;
1115         [CCode (cname = "param.position")]
1116         public uint position;
1117         [CCode (cname = "param.skew")]
1118         public SeqQueueSkew skew;
1119         [CCode (cname = "param.d32")]
1120         public uint d32[2];
1121         [CCode (cname = "param.d8")]
1122         public uint8 d8[8];
1123     }
1125     [CCode (cname = "snd_seq_ev_raw8_t", free_function = "", has_type_id = false)]
1126     public struct SeqEventRaw8
1127     {
1128         public uint8 d[12];
1129     }
1131     [CCode (cname = "snd_seq_ev_raw32_t", free_function = "", has_type_id = false)]
1132     public struct SeqEventRaw32
1133     {
1134         public uint d[3];
1135     }
1137     [Compact]
1138     [CCode (cname = "snd_seq_port_info_t", cprefix = "snd_seq_port_info_", free_function = "")]
1139     public class SeqPortInfo
1140     {
1141         public static int alloca( out SeqPortInfo info );
1142         public static int malloc( out SeqPortInfo info );
1143         public void free();
1144         public void copy( SeqPortInfo source );
1145         public int get_client();
1146         public int get_port();
1147         public SeqAddr? get_addr();
1148         public unowned string get_name();
1149         public SeqPortCap get_capability();
1150         public SeqPortType get_type();
1151         public int get_midi_channels();
1152         public int get_midi_voices();
1153         public int get_synth_voices();
1154         public int get_read_use();
1155         public int get_write_use();
1156         public int get_port_specified();
1157         public int get_timestamping();
1158         public int get_timestamp_real();
1159         public int get_timestamp_queue();
1160         public void set_client( int client );
1161         public void set_port( int port );
1162         public void set_addr( SeqAddr addr );
1163         public void set_name( string name );
1164         public void set_capability( uint capability );
1165         public void set_type( uint type );
1166         public void set_midi_channels( int channels );
1167         public void set_midi_voices( int voices );
1168         public void set_synth_voices( int voices );
1169         public void set_port_specified( int val );
1170         public void set_timestamping( int enable );
1171         public void set_timestamp_real( int realtime );
1172         public void set_timestamp_queue( int queue );
1173     }
1175     [CCode (cname = "snd_seq_queue_skew_t", free_function = "", has_type_id = false)]
1176     public struct SeqQueueSkew
1177     {
1178         public uint value;
1179         public uint base;
1180     }
1182     [Compact]
1183     [CCode (cname = "snd_seq_query_subscribe_t", cprefix = "snd_seq_query_subscribe_")]
1184     public class SeqQuerySubscribe
1185     {
1186         public static int alloca( out SeqQuerySubscribe subscribe );
1187         public static int malloc( out SeqQuerySubscribe subscribe );
1188         public void free();
1189         public void copy( SeqQuerySubscribe source );
1190         public int get_client();
1191         public int get_port();
1192         public SeqAddr? get_root();
1193         public SeqQuerySubsType get_type();
1194         public int get_index();
1195         public int get_num_subs();
1196         public SeqAddr? get_addr();
1197         public int get_queue();
1198         public int get_exclusive();
1199         public int get_time_update();
1200         public int get_time_real();
1201         public void set_client( int client );
1202         public void set_port( int port );
1203         public void set_root( SeqAddr addr );
1204         public void set_type( SeqQuerySubsType type );
1205         public void set_index( int index );
1206     }
1208     [CCode (cname = "snd_seq_real_time_t", has_type_id = false)]
1209     public struct SeqRealTime
1210     {
1211         public uint tv_sec;
1212         public uint tv_nsec;
1213     }
1215     [CCode (cname = "snd_seq_result_t", has_type_id = false)]
1216     public struct SeqResult
1217     {
1218         public int event;
1219         public int result;
1220     }
1222     [SimpleType]
1223     [CCode (cname = "snd_seq_tick_time_t", has_type_id = false)]
1224     public struct SeqTickTime : uint
1225     {
1226     }
1228     [CCode (cname = "snd_seq_timestamp_t", free_function = "", has_type_id = false)]
1229     public struct SeqTimestamp
1230     {
1231         public SeqTickTime tick;
1232         public SeqRealTime time;
1233     }