1 /* 2 * Copyright (c) 2002-2007, Jerome Duval (jerome.duval@free.fr) 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef MULTI_AUDIO_DEVICE_H 6 #define MULTI_AUDIO_DEVICE_H 7 8 9 #include "hmulti_audio.h" 10 11 12 #define MAX_CONTROLS 128 13 #define MAX_CHANNELS 32 14 #define MAX_BUFFERS 32 15 16 17 class MultiAudioDevice { 18 public: 19 MultiAudioDevice(const char* name, const char* path); 20 ~MultiAudioDevice(); 21 22 status_t InitCheck() const; 23 24 const multi_description& Description() const { return fDescription; } 25 const multi_format_info& FormatInfo() const { return fFormatInfo; } 26 const multi_buffer_list& BufferList() const { return fBufferList; } 27 const multi_mix_control_info& MixControlInfo() const 28 { return fMixControlInfo; } 29 30 status_t BufferExchange(multi_buffer_info* bufferInfo); 31 status_t SetMix(multi_mix_value_info* mixValueInfo); 32 status_t GetMix(multi_mix_value_info* mixValueInfo); 33 34 status_t SetInputFrameRate(uint32 multiAudioRate); 35 status_t SetOutputFrameRate(uint32 multiAudioRate); 36 37 private: 38 status_t _InitDriver(); 39 status_t _GetBuffers(); 40 41 private: 42 status_t fInitStatus; 43 int fDevice; 44 char fPath[B_PATH_NAME_LENGTH]; 45 46 multi_description fDescription; 47 multi_channel_info fChannelInfo[MAX_CHANNELS]; 48 multi_format_info fFormatInfo; 49 multi_buffer_list fBufferList; 50 51 multi_mix_control_info fMixControlInfo; 52 multi_mix_control fMixControl[MAX_CONTROLS]; 53 54 buffer_desc fPlayBufferList[MAX_BUFFERS * MAX_CHANNELS]; 55 buffer_desc fRecordBufferList[MAX_BUFFERS * MAX_CHANNELS]; 56 buffer_desc* fPlayBuffers[MAX_BUFFERS]; 57 buffer_desc* fRecordBuffers[MAX_BUFFERS]; 58 }; 59 60 #endif // MULTI_AUDIO_DEVICE_H 61