2 #ifndef AudioDevice_DEFINED
3 #define AudioDevice_DEFINED 1
9 typedef double PaTimestamp
;
11 typedef struct AudioDevice AudioDevice
;
13 typedef void (AudioDeviceCallback
)(void *);
23 AudioDeviceCallback
*needsDataCallback
;
24 void *needsDataCallbackContext
;
26 /* for speaker output */
27 unsigned long writeFrame
;
29 UArray
*nextWriteBuffer
;
32 unsigned long readFrame
;
34 UArray
*nextReadBuffer
;
39 int writeBufferIsEmpty
;
40 unsigned int lockSleepMicroSeconds
;
43 void AudioDevice_nanoSleep(AudioDevice
*self
);
45 AudioDevice
*AudioDevice_new(void);
46 void AudioDevice_free(AudioDevice
*self
);
48 int AudioDevice_framesPerBuffer(AudioDevice
*self
);
50 void AudioDevice_init(AudioDevice
*self
);
51 void AudioDevice_terminate(AudioDevice
*self
);
53 void AudioDevice_isListening_(AudioDevice
*self
, int v
);
54 int AudioDevice_isListening(AudioDevice
*self
);
56 void AudioDevice_open(AudioDevice
*self
);
57 void AudioDevice_openForReadingAndWriting(AudioDevice
*self
);
58 void AudioDevice_close(AudioDevice
*self
);
60 const char *AudioDevice_error(AudioDevice
*self
);
61 void AudioDevice_printError(AudioDevice
*self
);
62 void AudioDevice_checkForError(AudioDevice
*self
);
64 void AudioDevice_start(AudioDevice
*self
);
65 void AudioDevice_stop(AudioDevice
*self
);
67 int AudioDevice_isActive(AudioDevice
*self
);
68 int AudioDevice_streamTime(AudioDevice
*self
);
69 double AudioDevice_cpuLoad(AudioDevice
*self
);
72 int AudioDevice_callbackTest(
75 unsigned long framesPerBuffer
,
79 int AudioDevice_callbackInputTest(
82 unsigned long framesPerBuffer
,
86 int AudioDevice_callback(
89 unsigned long framesPerBuffer
,
94 int AudioDevice_swapWriteBuffers(AudioDevice
*self
);
95 int AudioDevice_swapReadBuffers(AudioDevice
*self
);
97 void AudioDevice_write_(AudioDevice
*self
, UArray
*buf
);
98 void AudioDevice_writeData_length_(AudioDevice
*self
, uint8_t *data
, size_t numBytes
);
99 UArray
*AudioDevice_read(AudioDevice
*self
);
100 void AudioDevice_clearBuffers(AudioDevice
*self
);
102 int AudioDevice_isLocked(AudioDevice
*self
);