/[qemu]/qemu/audio/audio.h
ViewVC logotype

Diff of /qemu/audio/audio.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by bellard, Tue Nov 9 23:08:30 2004 UTC revision 1.3 by bellard, Sun Oct 30 18:58:22 2005 UTC
# Line 1  Line 1 
1  /*  /*
2   * QEMU Audio subsystem header   * QEMU Audio subsystem header
3   *   *
4   * Copyright (c) 2003-2004 Vassili Karpov (malc)   * Copyright (c) 2003-2005 Vassili Karpov (malc)
5   *   *
6   * Permission is hereby granted, free of charge, to any person obtaining a copy   * Permission is hereby granted, free of charge, to any person obtaining a copy
7   * of this software and associated documentation files (the "Software"), to deal   * of this software and associated documentation files (the "Software"), to deal
8   * in the Software without restriction, including without limitation the rights   * in the Software without restriction, including without limitation the rights
# Line 24  Line 24 
24  #ifndef QEMU_AUDIO_H  #ifndef QEMU_AUDIO_H
25  #define QEMU_AUDIO_H  #define QEMU_AUDIO_H
26    
27  #include "mixeng.h"  typedef void (*audio_callback_fn_t) (void *opaque, int avail);
28    
29  typedef enum {  typedef enum {
30    AUD_FMT_U8,    AUD_FMT_U8,
# Line 33  typedef enum { Line 33  typedef enum {
33    AUD_FMT_S16    AUD_FMT_S16
34  } audfmt_e;  } audfmt_e;
35    
36  typedef struct SWVoice SWVoice;  typedef struct SWVoiceOut SWVoiceOut;
37    typedef struct SWVoiceIn SWVoiceIn;
38    
39  SWVoice * AUD_open (SWVoice *sw, const char *name, int freq,  typedef struct QEMUAudioTimeStamp {
40                      int nchannels, audfmt_e fmt);      uint64_t old_ts;
41  void   AUD_init (void);  } QEMUAudioTimeStamp;
42  void   AUD_log (const char *cap, const char *fmt, ...)  
43      __attribute__ ((__format__ (__printf__, 2, 3)));;  void AUD_vlog (const char *cap, const char *fmt, va_list ap);
44  void   AUD_close (SWVoice *sw);  void AUD_log (const char *cap, const char *fmt, ...)
45  int    AUD_write (SWVoice *sw, void *pcm_buf, int size);  #ifdef __GNUC__
46  void   AUD_adjust (SWVoice *sw, int leftover);      __attribute__ ((__format__ (__printf__, 2, 3)))
47  void   AUD_reset (SWVoice *sw);  #endif
48  int    AUD_get_free (SWVoice *sw);      ;
49  int    AUD_get_buffer_size (SWVoice *sw);  
50  void   AUD_run (void);  void AUD_init (void);
51  void   AUD_enable (SWVoice *sw, int on);  void AUD_help (void);
52  int    AUD_calc_elapsed (SWVoice *sw);  
53    SWVoiceOut  *AUD_open_out (
54        SWVoiceOut *sw,
55        const char *name,
56        void *callback_opaque,
57        audio_callback_fn_t callback_fn,
58        int freq,
59        int nchannels,
60        audfmt_e fmt
61        );
62    void         AUD_close_out (SWVoiceOut *sw);
63    int          AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
64    int          AUD_get_buffer_size_out (SWVoiceOut *sw);
65    void         AUD_set_active_out (SWVoiceOut *sw, int on);
66    int          AUD_is_active_out (SWVoiceOut *sw);
67    void         AUD_init_time_stamp_out (SWVoiceOut *sw,
68                                          QEMUAudioTimeStamp *ts);
69    uint64_t     AUD_time_stamp_get_elapsed_usec_out (SWVoiceOut *sw,
70                                                      QEMUAudioTimeStamp *ts);
71    
72    SWVoiceIn   *AUD_open_in (
73        SWVoiceIn *sw,
74        const char *name,
75        void *callback_opaque,
76        audio_callback_fn_t callback_fn,
77        int freq,
78        int nchannels,
79        audfmt_e fmt
80        );
81    void         AUD_close_in (SWVoiceIn *sw);
82    int          AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
83    void         AUD_adjust_in (SWVoiceIn *sw, int leftover);
84    void         AUD_set_active_in (SWVoiceIn *sw, int on);
85    int          AUD_is_active_in (SWVoiceIn *sw);
86    void         AUD_init_time_stamp_in (SWVoiceIn *sw,
87                                         QEMUAudioTimeStamp *ts);
88    uint64_t     AUD_time_stamp_get_elapsed_usec_in (SWVoiceIn *sw,
89                                                     QEMUAudioTimeStamp *ts);
90    
91  static inline void *advance (void *p, int incr)  static inline void *advance (void *p, int incr)
92  {  {
# Line 59  static inline void *advance (void *p, in Line 97  static inline void *advance (void *p, in
97  uint32_t popcount (uint32_t u);  uint32_t popcount (uint32_t u);
98  inline uint32_t lsbindex (uint32_t u);  inline uint32_t lsbindex (uint32_t u);
99    
100    #ifdef __GNUC__
101    #define audio_MIN(a, b) ( __extension__ ({      \
102        __typeof (a) ta = a;                        \
103        __typeof (b) tb = b;                        \
104        ((ta)>(tb)?(tb):(ta));                      \
105    }))
106    
107    #define audio_MAX(a, b) ( __extension__ ({      \
108        __typeof (a) ta = a;                        \
109        __typeof (b) tb = b;                        \
110        ((ta)<(tb)?(tb):(ta));                      \
111    }))
112    #else
113  #define audio_MIN(a, b) ((a)>(b)?(b):(a))  #define audio_MIN(a, b) ((a)>(b)?(b):(a))
114  #define audio_MAX(a, b) ((a)<(b)?(b):(a))  #define audio_MAX(a, b) ((a)<(b)?(b):(a))
115    #endif
116    
117  #endif  /* audio.h */  #endif  /* audio.h */

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26