1 /* 2 * multiaudio replacement media addon for BeOS 3 * 4 * Copyright (c) 2002, 2003, Jerome Duval (jerome.duval@free.fr) 5 * 6 * All rights reserved. 7 * Redistribution and use in source and binary forms, with or without modification, 8 * are permitted provided that the following conditions are met: 9 * 10 * - Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 25 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 */ 28 #ifndef _MULTIAUDIODEVICE_H 29 #define _MULTIAUDIODEVICE_H 30 31 #include "multi_audio.h" 32 33 #define MAX_CONTROLS 128 34 #define MAX_CHANNELS 32 35 #define NB_BUFFERS 32 36 37 class MultiAudioDevice 38 { 39 public: 40 explicit MultiAudioDevice(const char *name, const char* path); 41 virtual ~MultiAudioDevice(void); 42 43 virtual status_t InitCheck(void) const; 44 45 static float convert_multiaudio_rate_to_media_rate(uint32 rate); 46 static uint32 convert_media_rate_to_multiaudio_rate(float rate); 47 static uint32 convert_multiaudio_format_to_media_format(uint32 fmt); 48 static uint32 convert_media_format_to_multiaudio_format(uint32 fmt); 49 static uint32 select_multiaudio_rate(uint32 rate); 50 static uint32 select_multiaudio_format(uint32 fmt); 51 52 int DoBufferExchange(multi_buffer_info *MBI); 53 int DoSetMix(multi_mix_value_info *MMVI); 54 int DoGetMix(multi_mix_value_info *MMVI); 55 56 private: 57 status_t InitDriver(); 58 59 int fd; //file descriptor for hw driver 60 char fDevice_name[32]; 61 char fDevice_path[32]; 62 63 public: 64 multi_description MD; 65 multi_channel_info MCI[MAX_CHANNELS]; 66 multi_format_info MFI; 67 multi_buffer_list MBL; 68 69 multi_mix_control_info MMCI; 70 multi_mix_control MMC[MAX_CONTROLS]; 71 72 buffer_desc play_buffer_list[NB_BUFFERS * MAX_CHANNELS]; 73 buffer_desc record_buffer_list[NB_BUFFERS * MAX_CHANNELS]; 74 buffer_desc *play_buffer_desc[NB_BUFFERS]; 75 buffer_desc *record_buffer_desc[NB_BUFFERS]; 76 77 private: 78 status_t fInitCheckStatus; 79 }; 80 81 #endif 82