1 /* 2 * SiS 7018, Trident 4D Wave DX/NX, Acer Lab M5451 Sound Driver. 3 * Copyright (c) 2002, 2008-2011 S.Zharski <imker@gmx.li> 4 * Distributed under the terms of the MIT license. 5 * 6 */ 7 #ifndef _SiS7018_MIXER_H_ 8 #define _SiS7018_MIXER_H_ 9 10 11 #include <OS.h> 12 13 #include "ac97.h" 14 #include "hmulti_audio.h" 15 16 17 class Device; 18 struct GainInfo; 19 struct MIXControlInfo; 20 21 class Mixer { 22 23 public: 24 Mixer(Device *cdc); 25 26 void Init(); 27 void Free(); 28 29 status_t GetMix(multi_mix_value_info *Info); 30 status_t SetMix(multi_mix_value_info *Info); 31 status_t ListMixControls(multi_mix_control_info* Info); 32 33 uint32 InputRates() { return fInputRates; } 34 uint32 OutputRates() { return fOutputRates; } 35 uint32 InputFormats() { return fInputFormats; } 36 uint32 OutputFormats() { return fOutputFormats; } 37 38 void SetOutputRate(uint32 rate); 39 40 private: 41 void _ReadSupportedFormats(); 42 bool _WaitPortReady(uint8 reg, uint32 mask, uint32* result = NULL); 43 bool _WaitSTimerReady(); 44 uint16 _ReadAC97(uint8 reg); 45 void _WriteAC97(uint8 reg, uint16 date); 46 static uint16 _ReadAC97(void* cookie, uint8 reg); 47 static void _WriteAC97(void* cookie, uint8 reg, uint16 data); 48 bool _CheckRegFeatures(uint8 AC97Reg, uint16& mask, uint16& result); 49 bool _CorrectMIXControlInfo(MIXControlInfo& info, GainInfo& gainInfo); 50 void _InitGainLimits(multi_mix_control& Control, GainInfo& Info); 51 int32 _CreateMIXControlGroup(multi_mix_control_info* MultiInfo, 52 int32& index, int32 parentIndex, MIXControlInfo& Info); 53 54 Device* fDevice; 55 ac97_dev* fAC97Dev; 56 uint8 fReadPort; 57 uint8 fWritePort; 58 uint32 fMaskRW; 59 uint32 fMaskRD; 60 uint32 fMaskWD; 61 62 bool fHasVRA; 63 uint32 fInputRates; 64 uint32 fOutputRates; 65 uint32 fInputFormats; 66 uint32 fOutputFormats; 67 }; 68 69 70 #endif // _SiS7018_MIXER_H_ 71 72