mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-11 10:47:11 +01:00
center tuning and more
This commit is contained in:
parent
7ba6081cb3
commit
16d8a31c12
@ -13,6 +13,8 @@ namespace icons {
|
||||
ImTextureID MENU;
|
||||
ImTextureID MUTED;
|
||||
ImTextureID UNMUTED;
|
||||
ImTextureID NORMAL_TUNING;
|
||||
ImTextureID CENTER_TUNING;
|
||||
|
||||
GLuint loadTexture(std::string path) {
|
||||
int w,h,n;
|
||||
@ -35,5 +37,7 @@ namespace icons {
|
||||
MENU = (ImTextureID)(uintptr_t)loadTexture(ROOT_DIR "/res/icons/menu.png");
|
||||
MUTED = (ImTextureID)(uintptr_t)loadTexture(ROOT_DIR "/res/icons/muted.png");
|
||||
UNMUTED = (ImTextureID)(uintptr_t)loadTexture(ROOT_DIR "/res/icons/unmuted.png");
|
||||
NORMAL_TUNING = (ImTextureID)(uintptr_t)loadTexture(ROOT_DIR "/res/icons/normal_tuning.png");
|
||||
CENTER_TUNING = (ImTextureID)(uintptr_t)loadTexture(ROOT_DIR "/res/icons/center_tuning.png");
|
||||
}
|
||||
}
|
@ -10,6 +10,8 @@ namespace icons {
|
||||
extern ImTextureID MENU;
|
||||
extern ImTextureID MUTED;
|
||||
extern ImTextureID UNMUTED;
|
||||
extern ImTextureID NORMAL_TUNING;
|
||||
extern ImTextureID CENTER_TUNING;
|
||||
|
||||
GLuint loadTexture(std::string path);
|
||||
void load();
|
||||
|
@ -163,6 +163,8 @@ void windowInit() {
|
||||
// Add default main config to avoid having to ship one
|
||||
// Have a good directory system on both linux and windows (should fix occassional underruns)
|
||||
// Switch to double buffering
|
||||
// Fix gain not updated on startup, soapysdr
|
||||
// Fix memory leak when enabling and disabling repeatedly
|
||||
|
||||
// TODO for 0.2.6
|
||||
// Add a module add/remove/change order menu
|
||||
@ -232,6 +234,7 @@ void setVFO(double freq) {
|
||||
if (centerTuning) {
|
||||
gui::waterfall.setViewOffset((BW / 2.0) - (viewBW / 2.0));
|
||||
gui::waterfall.setCenterFrequency(freq);
|
||||
gui::waterfall.setViewOffset(0);
|
||||
sigpath::vfoManager.setCenterOffset(gui::waterfall.selectedVFO, 0);
|
||||
sigpath::sourceManager.tune(freq);
|
||||
return;
|
||||
@ -310,6 +313,9 @@ void drawWindow() {
|
||||
|
||||
if (vfo != NULL) {
|
||||
if (vfo->centerOffsetChanged) {
|
||||
if (centerTuning) {
|
||||
setVFO(gui::waterfall.getCenterFrequency() + vfo->generalOffset);
|
||||
}
|
||||
gui::freqSelect.setFrequency(gui::waterfall.getCenterFrequency() + vfo->generalOffset);
|
||||
gui::freqSelect.frequencyChanged = false;
|
||||
core::configManager.aquire();
|
||||
@ -401,12 +407,37 @@ void drawWindow() {
|
||||
ImGui::SameLine();
|
||||
|
||||
//ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 8);
|
||||
sigpath::sinkManager.showVolumeSlider(gui::waterfall.selectedVFO, "##_sdrpp_main_volume_", 248, 30, 5);
|
||||
sigpath::sinkManager.showVolumeSlider(gui::waterfall.selectedVFO, "##_sdrpp_main_volume_", 248, 30, 5, true);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
gui::freqSelect.draw();
|
||||
|
||||
//ImGui::SameLine();
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 9);
|
||||
if (centerTuning) {
|
||||
ImGui::PushID(ImGui::GetID("sdrpp_ena_st_btn"));
|
||||
if (ImGui::ImageButton(icons::CENTER_TUNING, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5)) {
|
||||
centerTuning = false;
|
||||
core::configManager.aquire();
|
||||
core::configManager.conf["centerTuning"] = centerTuning;
|
||||
core::configManager.release(true);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
else { // TODO: Might need to check if there even is a device
|
||||
ImGui::PushID(ImGui::GetID("sdrpp_dis_st_btn"));
|
||||
if (ImGui::ImageButton(icons::NORMAL_TUNING, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5)) {
|
||||
centerTuning = true;
|
||||
setVFO(gui::freqSelect.frequency);
|
||||
core::configManager.aquire();
|
||||
core::configManager.conf["centerTuning"] = centerTuning;
|
||||
core::configManager.release(true);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
// Logo button
|
||||
|
@ -151,7 +151,10 @@ void FrequencySelect::draw() {
|
||||
frequency = freq;
|
||||
|
||||
ImGui::PopFont();
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::SetCursorPosX(digitBottomMaxs[11].x + 17);
|
||||
|
||||
//ImGui::NewLine();
|
||||
}
|
||||
|
||||
void FrequencySelect::setFrequency(uint64_t freq) {
|
||||
|
@ -164,7 +164,7 @@ void SinkManager::setStreamSink(std::string name, std::string providerName) {
|
||||
spdlog::warn("setStreamSink is NOT implemented!!!");
|
||||
}
|
||||
|
||||
void SinkManager::showVolumeSlider(std::string name, std::string prefix, float width, float btnHeight, int btwBorder) {
|
||||
void SinkManager::showVolumeSlider(std::string name, std::string prefix, float width, float btnHeight, int btwBorder, bool sameLine) {
|
||||
// TODO: Replace map with some hashmap for it to be faster
|
||||
float height = ImGui::GetTextLineHeightWithSpacing() + 2;
|
||||
float sliderHeight = height;
|
||||
@ -185,6 +185,7 @@ void SinkManager::showVolumeSlider(std::string name, std::string prefix, float w
|
||||
ImGui::SetCursorPosY(ypos + ((height - sliderHeight) / 2.0f) + btwBorder);
|
||||
ImGui::SliderFloat((prefix + name).c_str(), &dummy, 0.0f, 1.0f, "");
|
||||
style::endDisabled();
|
||||
if (sameLine) { ImGui::SetCursorPosY(ypos); }
|
||||
return;
|
||||
}
|
||||
|
||||
@ -221,6 +222,7 @@ void SinkManager::showVolumeSlider(std::string name, std::string prefix, float w
|
||||
saveStreamConfig(name);
|
||||
core::configManager.release(true);
|
||||
}
|
||||
if (sameLine) { ImGui::SetCursorPosY(ypos); }
|
||||
//ImGui::SetCursorPosY(ypos);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
|
||||
void setStreamSink(std::string name, std::string providerName);
|
||||
|
||||
void showVolumeSlider(std::string name, std::string prefix, float width, float btnHeight = -1.0f, int btwBorder = 0);
|
||||
void showVolumeSlider(std::string name, std::string prefix, float width, float btnHeight = -1.0f, int btwBorder = 0, bool sameLine = false);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* bindStream(std::string name);
|
||||
void unbindStream(std::string name, dsp::stream<dsp::stereo_t>* stream);
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"bandPlan": "General",
|
||||
"bandPlanEnabled": true,
|
||||
"centerTuning": false,
|
||||
"centerTuning": true,
|
||||
"fftHeight": 300,
|
||||
"frequency": 100100000,
|
||||
"frequency": 99000000,
|
||||
"max": 0.0,
|
||||
"maximized": false,
|
||||
"menuOrder": [
|
||||
@ -41,7 +41,7 @@
|
||||
"Radio": {
|
||||
"muted": false,
|
||||
"sink": "Audio",
|
||||
"volume": 0.29591837525367737
|
||||
"volume": 0.47959184646606445
|
||||
},
|
||||
"Radio 1": {
|
||||
"muted": false,
|
||||
|
BIN
root_dev/res/icons/center_tuning.png
Normal file
BIN
root_dev/res/icons/center_tuning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
BIN
root_dev/res/icons/normal_tuning.png
Normal file
BIN
root_dev/res/icons/normal_tuning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Loading…
Reference in New Issue
Block a user