Skip to content

Commit

Permalink
add 384 DAC samplerate
Browse files Browse the repository at this point in the history
  • Loading branch information
paulh002 committed Sep 1, 2023
1 parent 6eb0472 commit 263c077
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions SoapyHifiBerrySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
**********************************************************************/

const cfg::File::ConfigMap defaultOptions = {
{"si5351", {{"correction", cfg::makeOption("0")}, {"disabletxoutput", cfg::makeOption("on")}, {"mode", cfg::makeOption("single")}, {"multiplier", cfg::makeOption("4")}, {"rxdrive", cfg::makeOption("8")}, {"txdrive", cfg::makeOption("8")}}},
{"sound", {{"device", cfg::makeOption("snd_rpi_hifiberry_dacplusadcpro")}, {"samplerate", cfg::makeOption("192000")}, {"input", cfg::makeOption("DIFF")}}}};
{"si5351", {{"correction", cfg::makeOption("0")}, {"correction_tx", cfg::makeOption("0")}, {"disabletxoutput", cfg::makeOption("on")}, {"mode", cfg::makeOption("IQMULTI")}, {"multiplier", cfg::makeOption("1")}, {"rxdrive", cfg::makeOption("8")}, {"txdrive", cfg::makeOption("8")}}},
{"sound", {{"device", cfg::makeOption("snd_rpi_hifiberry_dacplusadcpro")}, {"samplerate", cfg::makeOption("192000")}, {"samplerate_tx", cfg::makeOption("384000")}, {"input", cfg::makeOption("DIFF")}}}};

int SoapyHifiBerry::get_int(string section, string key)
{
Expand Down Expand Up @@ -55,6 +55,9 @@ SoapyHifiBerry::SoapyHifiBerry(const SoapySDR::Kwargs &args)
multiplier = 1;

int samplerate = SoapyHifiBerry::get_int("sound", "samplerate");
int samplerate_tx = SoapyHifiBerry::get_int("sound", "samplerate_tx");
if (!samplerate_tx)
samplerate_tx = samplerate;
int driveConfig = SoapyHifiBerry::get_int("si5351", "rxdrive");
switch (driveConfig)
{
Expand Down Expand Up @@ -90,7 +93,7 @@ SoapyHifiBerry::SoapyHifiBerry(const SoapySDR::Kwargs &args)
}

uptr_HifiBerryAudioOutputput = make_unique<HifiBerryAudioOutputput>(samplerate, &source_buffer_tx, RtAudio::LINUX_ALSA);
uptr_HifiBerryAudioInput = make_unique<HifiBerryAudioInput>(samplerate, true, &source_buffer_rx, RtAudio::LINUX_ALSA);
uptr_HifiBerryAudioInput = make_unique<HifiBerryAudioInput>(samplerate_tx, true, &source_buffer_rx, RtAudio::LINUX_ALSA);

std::vector<std::string> devices;
uptr_HifiBerryAudioOutputput->listDevices(devices);
Expand Down Expand Up @@ -236,7 +239,7 @@ std::string SoapyHifiBerry::getHardwareKey(void) const
{
SoapySDR_log(SOAPY_SDR_INFO, "SoapyHifiBerry::getHardwareKey called");

return "v0.1";
return "v0.2";
}

SoapySDR::Kwargs SoapyHifiBerry::getHardwareInfo(void) const
Expand All @@ -248,7 +251,7 @@ SoapySDR::Kwargs SoapyHifiBerry::getHardwareInfo(void) const
int count = 0;

char version[100];
snprintf(version, 100, "%u.%u", 0, 1); //0.1
snprintf(version, 100, "%u.%u", 0, 2); //0.1
info["Version HifiBerry"] = version;
return info;
}
Expand Down Expand Up @@ -293,6 +296,7 @@ std::vector<double> SoapyHifiBerry::listSampleRates(const int direction, const s
options.push_back(0.048e6);
options.push_back(0.096e6);
options.push_back(0.192e6);
options.push_back(0.384e6);
}
return (options);
}
Expand Down
4 changes: 2 additions & 2 deletions SoapyHifiBerryStreaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ SoapySDR::RangeList SoapyHifiBerry::getSampleRateRange(const int direction, cons
SoapySDR::RangeList rangeList;

if (direction == SOAPY_SDR_RX)
rangeList.push_back(SoapySDR::Range(48000.0, 96000.0, 192000.0));
rangeList.push_back(SoapySDR::Range(48000.0, 192000.0));
if (direction == SOAPY_SDR_TX)
rangeList.push_back(SoapySDR::Range(48000.0, 96000.0, 192000.0));
rangeList.push_back(SoapySDR::Range(48000.0, 384000.0));

return rangeList;
}
Expand Down

0 comments on commit 263c077

Please sign in to comment.