Browse Source

AudioControlWM8731::inputLevel(float n)

dds
mxmxmx 9 years ago
parent
commit
d15c3642c6
2 changed files with 11 additions and 1 deletions
  1. +10
    -0
      control_wm8731.cpp
  2. +1
    -1
      control_wm8731.h

+ 10
- 0
control_wm8731.cpp View File

@@ -96,7 +96,17 @@ bool AudioControlWM8731::volumeInteger(unsigned int n)
return true;
}

bool AudioControlWM8731::inputLevel(float n)
{
// range is 0x00 (min) - 0x1F (max)

int _level = int(n * 31.f);

_level = _level > 0x1F ? 0x1F : _level;
write(WM8731_REG_LLINEIN, _level);
write(WM8731_REG_RLINEIN, _level);
return true;
}

/******************************************************************/


+ 1
- 1
control_wm8731.h View File

@@ -35,7 +35,7 @@ public:
bool enable(void);
bool disable(void) { return false; }
bool volume(float n) { return volumeInteger(n * 80.0 + 47.499); }
bool inputLevel(float n) { return false; }
bool inputLevel(float n); // range: 0.0f to 1.0f
bool inputSelect(int n) { return false; }
protected:
bool write(unsigned int reg, unsigned int val);

Loading…
Cancel
Save