Skip to content

Commit

Permalink
update gain
Browse files Browse the repository at this point in the history
  • Loading branch information
paulh002 committed Jun 21, 2022
1 parent f07c95e commit b9de449
Show file tree
Hide file tree
Showing 22 changed files with 7 additions and 4 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This file was last opened by PID 17852
This file was last opened by PID 33640
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions AudioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ bool AudioOutput::open(std::string device)
}
}
info = this->getDeviceInfo(parameters.deviceId);
alsa_device = parameters.deviceId - 1;
parameters.nChannels = info.outputChannels;
printf("audio device = %d %s samplerate %d channels %d\n", parameters.deviceId, device.c_str(), m_sampleRate, parameters.nChannels);
err = this->openStream(&parameters, NULL, RTAUDIO_FLOAT64, m_sampleRate, &bufferFrames, &Audioout, (void *)databuffer, NULL);
Expand Down Expand Up @@ -269,7 +270,7 @@ int lookup_id(snd_ctl_elem_id_t* id, snd_ctl_t* handle)
return 0;
}

int controle_alsa(int device, int element, int ivalue)
int AudioOutput::controle_alsa(int element, int ivalue)
{
char str[80];
int err;
Expand All @@ -279,7 +280,7 @@ int controle_alsa(int device, int element, int ivalue)
snd_ctl_elem_id_alloca(&id);
snd_ctl_elem_value_alloca(&value);

sprintf(str, "hw:%d", device);
sprintf(str, "hw:%d", alsa_device);
if ((err = snd_ctl_open(&handle, str, 0)) < 0) {
fprintf(stderr, "Card open error: %s\n", snd_strerror(err));
return err;
Expand Down
2 changes: 2 additions & 0 deletions AudioOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class AudioOutput :
unsigned int get_samplerate() { return m_sampleRate; }
unsigned int getDevices();
unsigned int get_device() { return parameters.deviceId;}
int controle_alsa(int element, int ivalue);

protected:
void samplesToInt16(const SampleVector& samples,
Expand All @@ -48,6 +49,7 @@ class AudioOutput :
double m_volume;
string m_error;
atomic<int> underrun;
int alsa_device;
map<int, std::string> device_map;
};

Expand Down
2 changes: 1 addition & 1 deletion SoapyHifiBerrySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void SoapyHifiBerry::setGain(const int direction, const size_t channel, const do
SoapySDR_log(SOAPY_SDR_INFO, "SoapyHifiBerry::setGain called");

if (direction == SOAPY_SDR_RX)
controle_alsa(3, 21, (int) value); // numid = 21, iface = MIXER, name = 'ADC Capture Volume'
uptr_audiooutput->controle_alsa(21, (int) value); // numid = 21, iface = MIXER, name = 'ADC Capture Volume'

}

Expand Down

0 comments on commit b9de449

Please sign in to comment.