From 7a8cab7879324e8e1ec2df07a3a227a92653860f Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 16 May 2022 20:51:15 +0200 Subject: [PATCH 1/2] Fixed missing bits in API. Fixes #1247 --- CHANGELOG | 20 +- CMakeLists.txt | 2 +- debian/changelog | 20 +- plugins/feature/simpleptt/simplepttworker.cpp | 15 +- sdrbase/maincore.cpp | 10 +- sdrbase/maincore.h | 48 -- sdrbase/resources/webapi/doc/html2/index.html | 466 +----------------- .../resources/webapi/doc/swagger/swagger.yaml | 31 -- sdrbase/webapi/webapiadapter.cpp | 28 +- sdrbase/webapi/webapiadapter.h | 5 - sdrbase/webapi/webapiadapterinterface.cpp | 1 - sdrbase/webapi/webapiadapterinterface.h | 17 - sdrbase/webapi/webapirequestmapper.cpp | 42 -- sdrbase/webapi/webapirequestmapper.h | 1 - sdrgui/limerfegui/limerfeusbdialog.cpp | 8 - sdrgui/mainwindow.cpp | 137 +++-- sdrsrv/mainserver.cpp | 17 +- swagger/sdrangel/api/swagger/swagger.yaml | 31 -- swagger/sdrangel/code/html2/index.html | 466 +----------------- .../code/qt5/client/SWGDeviceSetApi.cpp | 54 -- .../code/qt5/client/SWGDeviceSetApi.h | 5 - 21 files changed, 102 insertions(+), 1322 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7a0763aee..3d7efd219 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,17 @@ -sdrangel (7.0.0-beta.3) unstable; urgency=medium +sdrangel (7.0.0beta4-1) unstable; urgency=medium + + * Fixed missing bits in API. Fixes #1247 + + -- Edouard Griffiths, F4EXB Mon, 16 May 2022 18:43:31 +0200 + +sdrangel (7.0.0beta3-1) unstable; urgency=medium * MainServer: fix adding unique featureset * Fix typing errors in readme's. PR #1245 -- Edouard Griffiths, F4EXB Sun, 15 May 2022 21:34:30 +0200 -sdrangel (7.0.0-beta.2) unstable; urgency=medium +sdrangel (7.0.0beta2-1) unstable; urgency=medium * Fixed remaining v7 branch references * SSB and NFM demod: do not process samples if channel sample rate is not set yet (==0) @@ -13,19 +19,19 @@ sdrangel (7.0.0-beta.2) unstable; urgency=medium -- Edouard Griffiths, F4EXB Sun, 15 May 2022 09:33:12 +0200 -sdrangel (7.0.0-beta.1) unstable; urgency=medium +sdrangel (7.0.0beta1-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-beta.1 -- Edouard Griffiths, F4EXB Sat, 14 May 2022 18:33:12 +0200 -sdrangel (7.0.0-alpha.4) unstable; urgency=medium +sdrangel (7.0.0alpha4-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.4 -- Edouard Griffiths, F4EXB Sat, 14 May 2022 11:33:12 +0200 -sdrangel (7.0.0-alpha.3) unstable; urgency=medium +sdrangel (7.0.0alpha3-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.3 @@ -40,13 +46,13 @@ sdrangel (6.20.3-1) unstable; urgency=medium -- Edouard Griffiths, F4EXB Wed, 29 Apr 2022 11:33:12 +0200 -sdrangel (7.0.0-alpha.2) unstable; urgency=medium +sdrangel (7.0.0alpha2-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.2 -- Edouard Griffiths, F4EXB Thu, 28 Apr 2022 11:33:12 +0200 -sdrangel (7.0.0-alpha.1) unstable; urgency=medium +sdrangel (7.0.0alpha1-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bdd5c3fb..1349588be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(sdrangel_VERSION_MAJOR "7") set(sdrangel_VERSION_MINOR "0") set(sdrangel_VERSION_PATCH "0") -set(sdrangel_VERSION_SUFFIX "beta.3") +set(sdrangel_VERSION_SUFFIX "beta.4") # SDRAngel cmake options option(DEBUG_OUTPUT "Print debug messages" OFF) diff --git a/debian/changelog b/debian/changelog index cfa80f0b7..d02013cb8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,17 @@ -sdrangel (7.0.0-beta.3) unstable; urgency=medium +sdrangel (7.0.0beta4-1) unstable; urgency=medium + + * Fixed missing bits in API. Fixes #1247 + + -- Edouard Griffiths, F4EXB Mon, 16 May 2022 18:43:31 +0200 + +sdrangel (7.0.0beta3-1) unstable; urgency=medium * MainServer: fix adding unique featureset * Fix typing errors in readme's. PR #1245 -- Edouard Griffiths, F4EXB Sun, 15 May 2022 21:34:30 +0200 -sdrangel (7.0.0-beta.2) unstable; urgency=medium +sdrangel (7.0.0beta2-1) unstable; urgency=medium * Fixed remaining v7 branch references * SSB and NFM demod: do not process samples if channel sample rate is not set yet (==0) @@ -13,19 +19,19 @@ sdrangel (7.0.0-beta.2) unstable; urgency=medium -- Edouard Griffiths, F4EXB Sun, 15 May 2022 09:33:12 +0200 -sdrangel (7.0.0-beta.1) unstable; urgency=medium +sdrangel (7.0.0beta1-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-beta.1 -- Edouard Griffiths, F4EXB Sat, 14 May 2022 18:33:12 +0200 -sdrangel (7.0.0-alpha.4) unstable; urgency=medium +sdrangel (7.0.0alpha4-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.4 -- Edouard Griffiths, F4EXB Sat, 14 May 2022 11:33:12 +0200 -sdrangel (7.0.0-alpha.3) unstable; urgency=medium +sdrangel (7.0.0alpha3-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.3 @@ -40,13 +46,13 @@ sdrangel (6.20.3-1) unstable; urgency=medium -- Edouard Griffiths, F4EXB Wed, 29 Apr 2022 11:33:12 +0200 -sdrangel (7.0.0-alpha.2) unstable; urgency=medium +sdrangel (7.0.0alpha2-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.2 -- Edouard Griffiths, F4EXB Thu, 28 Apr 2022 11:33:12 +0200 -sdrangel (7.0.0-alpha.1) unstable; urgency=medium +sdrangel (7.0.0alpha1-1) unstable; urgency=medium * See: https://github.com/f4exb/sdrangel/releases/tag/v7.0.0-alpha.1 diff --git a/plugins/feature/simpleptt/simplepttworker.cpp b/plugins/feature/simpleptt/simplepttworker.cpp index 29e97f6ae..5c8a79db8 100644 --- a/plugins/feature/simpleptt/simplepttworker.cpp +++ b/plugins/feature/simpleptt/simplepttworker.cpp @@ -226,20 +226,7 @@ void SimplePTTWorker::updateHardware() SWGSDRangel::SWGErrorResponse error; m_updateTimer.stop(); m_mutex.unlock(); - - if (turnDevice(true)) - { - m_webAPIAdapterInterface->devicesetFocusPatch( - m_tx ? m_settings.m_txDeviceSetIndex : m_settings.m_rxDeviceSetIndex, response, error); - - if (m_msgQueueToGUI) - { - SimplePTTReport::MsgRadioState *msg = SimplePTTReport::MsgRadioState::create( - m_tx ? SimplePTTReport::RadioTx : SimplePTTReport::RadioRx - ); - m_msgQueueToGUI->push(msg); - } - } + turnDevice(true); } bool SimplePTTWorker::turnDevice(bool on) diff --git a/sdrbase/maincore.cpp b/sdrbase/maincore.cpp index 242faa779..ee84eda5f 100644 --- a/sdrbase/maincore.cpp +++ b/sdrbase/maincore.cpp @@ -29,7 +29,6 @@ #include "maincore.h" -MESSAGE_CLASS_DEFINITION(MainCore::MsgDeviceSetFocus, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgDVSerial, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteInstance, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadPreset, Message) @@ -45,8 +44,6 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgSaveFeatureSetPreset, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteFeatureSetPreset, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgAddDeviceSet, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgRemoveLastDeviceSet, Message) -MESSAGE_CLASS_DEFINITION(MainCore::MsgAddFeatureSet, Message) -MESSAGE_CLASS_DEFINITION(MainCore::MsgRemoveLastFeatureSet, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgSetDevice, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgAddChannel, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteChannel, Message) @@ -164,6 +161,13 @@ Feature *MainCore::getFeature(unsigned int featureSetIndex, int featureIndex) void MainCore::appendFeatureSet() { int newIndex = m_featureSets.size(); + + if (newIndex != 0) + { + qWarning("MainCore::appendFeatureSet: attempt to add more than one feature set (%d)", newIndex); + return; + } + FeatureSet *featureSet = new FeatureSet(newIndex); m_featureSets.push_back(featureSet); m_featureSetsMap.insert(featureSet, newIndex); diff --git a/sdrbase/maincore.h b/sdrbase/maincore.h index 18b29e7a0..b4d77e8a4 100644 --- a/sdrbase/maincore.h +++ b/sdrbase/maincore.h @@ -58,26 +58,6 @@ class SDRBASE_API MainCore : public QObject { Q_OBJECT public: - class SDRBASE_API MsgDeviceSetFocus : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDeviceSetIndex() const { return m_deviceSetIndex; } - - static MsgDeviceSetFocus* create(int deviceSetIndex) - { - return new MsgDeviceSetFocus(deviceSetIndex); - } - - private: - int m_deviceSetIndex; - - MsgDeviceSetFocus(int deviceSetIndex) : - Message(), - m_deviceSetIndex(deviceSetIndex) - { } - }; - class SDRBASE_API MsgDVSerial : public Message { MESSAGE_CLASS_DECLARATION @@ -376,34 +356,6 @@ public: { } }; - class SDRBASE_API MsgAddFeatureSet : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgAddFeatureSet* create() { - return new MsgAddFeatureSet(); - } - - private: - MsgAddFeatureSet() : - Message() - { } - }; - - class SDRBASE_API MsgRemoveLastFeatureSet : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgRemoveLastFeatureSet* create() { - return new MsgRemoveLastFeatureSet(); - } - - private: - MsgRemoveLastFeatureSet() : - Message() - { } - }; - class SDRBASE_API MsgSetDevice : public Message { MESSAGE_CLASS_DECLARATION diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 2f3e60c3e..c3b88a7da 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -14552,9 +14552,6 @@ margin-bottom: 20px;
  • devicesetDeviceWorkspacePut
  • -
  • - devicesetFocusPatch -
  • devicesetGet
  • @@ -26686,467 +26683,6 @@ $(document).ready(function() {
    -
    -
    -
    -

    devicesetFocusPatch

    -

    -
    -
    -
    -

    -

    Set focus on device set (GUI only)

    -

    -
    -
    /sdrangel/deviceset/{deviceSetIndex}/focus
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X PATCH "http://localhost/sdrangel/deviceset/{deviceSetIndex}/focus"
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.DeviceSetApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.DeviceSetApi;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    -
    -DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    -
    -[apiInstance devicesetFocusPatchWith:deviceSetIndex
    -              completionHandler: ^(SuccessResponse output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.DeviceSetApi()
    -
    -var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    -
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.devicesetFocusPatch(deviceSetIndex, callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class devicesetFocusPatchExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new DeviceSetApi();
    -            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    -
    -            try
    -            {
    -                SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling DeviceSetApi.devicesetFocusPatch: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\DeviceSetApi();
    -$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -
    -try {
    -    $result = $api_instance->devicesetFocusPatch($deviceSetIndex);
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling DeviceSetApi->devicesetFocusPatch: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::DeviceSetApi;
    -
    -my $api_instance = SWGSDRangel::DeviceSetApi->new();
    -my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    -
    -eval { 
    -    my $result = $api_instance->devicesetFocusPatch(deviceSetIndex => $deviceSetIndex);
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling DeviceSetApi->devicesetFocusPatch: $@\n";
    -}
    -
    - -
    -
    from __future__ import print_statement
    -import time
    -import swagger_sdrangel
    -from swagger_sdrangel.rest import ApiException
    -from pprint import pprint
    -
    -# create an instance of the API class
    -api_instance = swagger_sdrangel.DeviceSetApi()
    -deviceSetIndex = 56 # Integer | Index of device set in the device set list
    -
    -try: 
    -    api_response = api_instance.deviceset_focus_patch(deviceSetIndex)
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling DeviceSetApi->devicesetFocusPatch: %s\n" % e)
    -
    -
    - -

    Parameters

    - -
    Path parameters
    - - - - - - - - - -
    NameDescription
    deviceSetIndex* - - -
    -
    -
    - - Integer - - -
    - Index of device set in the device set list -
    -
    -
    - Required -
    -
    -
    -
    - - - - - -

    Responses

    -

    Status: 202 - Message to focus on device set was sent successfully

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 400 - Unsupported (srver instance)

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 404 - Invalid index

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 500 - Error

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 501 - Function not implemented

    - - - -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    @@ -60155,7 +59691,7 @@ except ApiException as e:
    - Generated 2022-05-14T13:17:30.416+02:00 + Generated 2022-05-16T19:55:17.622+02:00
    diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 28903444e..a81ae6e1a 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1381,37 +1381,6 @@ paths: "501": $ref: "#/responses/Response_501" - /sdrangel/deviceset/{deviceSetIndex}/focus: - x-swagger-router-controller: deviceset - patch: - description: Set focus on device set (GUI only) - operationId: devicesetFocusPatch - tags: - - DeviceSet - parameters: - - in: path - name: deviceSetIndex - type: integer - required: true - description: Index of device set in the device set list - responses: - "202": - description: Message to focus on device set was sent successfully - schema: - $ref: "#/definitions/SuccessResponse" - "400": - description: Unsupported (srver instance) - schema: - $ref: "#/definitions/ErrorResponse" - "404": - description: Invalid index - schema: - $ref: "#/definitions/ErrorResponse" - "500": - $ref: "#/responses/Response_500" - "501": - $ref: "#/responses/Response_501" - /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings: x-swagger-router-controller: deviceset get: diff --git a/sdrbase/webapi/webapiadapter.cpp b/sdrbase/webapi/webapiadapter.cpp index 0e2b859ef..ea5885018 100644 --- a/sdrbase/webapi/webapiadapter.cpp +++ b/sdrbase/webapi/webapiadapter.cpp @@ -2059,9 +2059,7 @@ int WebAPIAdapter::instanceDeviceSetDelete( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - unsigned int minFeatureSets = QCoreApplication::applicationName() == "SDRangelSrv" ? 0 : 1; - - if (m_mainCore->m_deviceSets.size() > minFeatureSets) + if (m_mainCore->m_deviceSets.size() > 0) { MainCore::MsgRemoveLastDeviceSet *msg = MainCore::MsgRemoveLastDeviceSet::create(); m_mainCore->m_mainMessageQueue->push(msg); @@ -2129,30 +2127,6 @@ int WebAPIAdapter::devicesetGet( } } -int WebAPIAdapter::devicesetFocusPatch( - int deviceSetIndex, - SWGSDRangel::SWGSuccessResponse& response, - SWGSDRangel::SWGErrorResponse& error) -{ - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) - { - MainCore::MsgDeviceSetFocus *msg = MainCore::MsgDeviceSetFocus::create(deviceSetIndex); - m_mainCore->m_mainMessageQueue->push(msg); - - response.init(); - *response.getMessage() = QString("Message to focus on device set (MsgDeviceSetFocus) was submitted successfully"); - - return 202; - } - else - { - error.init(); - *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); - - return 404; - } -} - int WebAPIAdapter::devicesetSpectrumSettingsGet( int deviceSetIndex, SWGSDRangel::SWGGLSpectrum& response, diff --git a/sdrbase/webapi/webapiadapter.h b/sdrbase/webapi/webapiadapter.h index f8966aefc..0608f0060 100644 --- a/sdrbase/webapi/webapiadapter.h +++ b/sdrbase/webapi/webapiadapter.h @@ -289,11 +289,6 @@ public: SWGSDRangel::SWGDeviceSet& response, SWGSDRangel::SWGErrorResponse& error); - virtual int devicesetFocusPatch( - int deviceSetIndex, - SWGSDRangel::SWGSuccessResponse& response, - SWGSDRangel::SWGErrorResponse& error); - virtual int devicesetSpectrumSettingsGet( int deviceSetIndex, SWGSDRangel::SWGGLSpectrum& response, diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index 2bef497f6..3c10c31a0 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -55,7 +55,6 @@ QString WebAPIAdapterInterface::featuresetFeatureURL("/sdrangel/featureset/featu QString WebAPIAdapterInterface::featuresetPresetURL("/sdrangel/featureset/preset"); std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$"); -std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0-9]{1,2})/focus$"); std::regex WebAPIAdapterInterface::devicesetSpectrumSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/spectrum/settings$"); std::regex WebAPIAdapterInterface::devicesetSpectrumServerURLRe("^/sdrangel/deviceset/([0-9]{1,2})/spectrum/server$"); std::regex WebAPIAdapterInterface::devicesetSpectrumWorkspaceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/spectrum/workspace$"); diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index 0e91f9a53..41a9e2c3b 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -985,22 +985,6 @@ public: return 501; } - /** - * Handler of /sdrangel/deviceset/{devicesetIndex}/focus (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels - * returns the Http status code (default 501: not implemented) - */ - virtual int devicesetFocusPatch( - int deviceSetIndex, - SWGSDRangel::SWGSuccessResponse& response, - SWGSDRangel::SWGErrorResponse& error) - { - (void) deviceSetIndex; - (void) response; - error.init(); - *error.getMessage() = QString("Function not implemented"); - return 501; - } - /** * Handler of /sdrangel/deviceset/{devicesetIndex}/spectrum/settings (GET) * returns the Http status code (default 501: not implemented) @@ -1825,7 +1809,6 @@ public: static QString featuresetFeatureURL; static QString featuresetPresetURL; static std::regex devicesetURLRe; - static std::regex devicesetFocusURLRe; static std::regex devicesetSpectrumSettingsURLRe; static std::regex devicesetSpectrumServerURLRe; static std::regex devicesetSpectrumWorkspaceURLRe; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 2c5b42369..449870e42 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -193,8 +193,6 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http devicesetService(std::string(desc_match[1]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceURLRe)) { devicesetDeviceService(std::string(desc_match[1]), request, response); - } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetFocusURLRe)) { - devicesetFocusService(std::string(desc_match[1]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetSpectrumSettingsURLRe)) { devicesetSpectrumSettingsService(std::string(desc_match[1]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetSpectrumServerURLRe)) { @@ -2079,46 +2077,6 @@ void WebAPIRequestMapper::devicesetService(const std::string& indexStr, qtwebapp } } -void WebAPIRequestMapper::devicesetFocusService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) -{ - SWGSDRangel::SWGErrorResponse errorResponse; - response.setHeader("Content-Type", "application/json"); - response.setHeader("Access-Control-Allow-Origin", "*"); - - try - { - int deviceSetIndex = boost::lexical_cast(indexStr); - - if (request.getMethod() == "PATCH") - { - SWGSDRangel::SWGSuccessResponse normalResponse; - int status = m_adapter->devicesetFocusPatch(deviceSetIndex, normalResponse, errorResponse); - - response.setStatus(status); - - if (status/100 == 2) { - response.write(normalResponse.asJson().toUtf8()); - } else { - response.write(errorResponse.asJson().toUtf8()); - } - } - else - { - response.setStatus(405,"Invalid HTTP method"); - errorResponse.init(); - *errorResponse.getMessage() = "Invalid HTTP method"; - response.write(errorResponse.asJson().toUtf8()); - } - } - catch (const boost::bad_lexical_cast &e) - { - errorResponse.init(); - *errorResponse.getMessage() = "Wrong integer conversion on device set index"; - response.setStatus(400,"Invalid data"); - response.write(errorResponse.asJson().toUtf8()); - } -} - void WebAPIRequestMapper::devicesetSpectrumSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) { SWGSDRangel::SWGErrorResponse errorResponse; diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index 663ac030f..048d4a02b 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -88,7 +88,6 @@ private: void instanceWorkspaceService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); - void devicesetFocusService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetSpectrumSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetSpectrumServerService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetSpectrumWorkspaceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); diff --git a/sdrgui/limerfegui/limerfeusbdialog.cpp b/sdrgui/limerfegui/limerfeusbdialog.cpp index 6aefec1f1..8ba429a22 100644 --- a/sdrgui/limerfegui/limerfeusbdialog.cpp +++ b/sdrgui/limerfegui/limerfeusbdialog.cpp @@ -664,10 +664,6 @@ void LimeRFEUSBDialog::stopStartRx(bool start) if (deviceSourceEngine->initAcquisition()) { deviceSourceEngine->startAcquisition(); } - - MainCore *mainCore = MainCore::instance(); - MainCore::MsgDeviceSetFocus *msg = MainCore::MsgDeviceSetFocus::create(m_rxDeviceSetIndex[rxDeviceSetSequence]); - mainCore->getMainMessageQueue()->push(msg); } else { @@ -690,10 +686,6 @@ void LimeRFEUSBDialog::stopStartTx(bool start) if (deviceSinkEngine->initGeneration()) { deviceSinkEngine->startGeneration(); } - - MainCore *mainCore = MainCore::instance(); - MainCore::MsgDeviceSetFocus *msg = MainCore::MsgDeviceSetFocus::create(m_txDeviceSetIndex[txDeviceSetSequence]); - mainCore->getMainMessageQueue()->push(msg); } else { diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 5c108f105..d3a626702 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -1075,11 +1075,17 @@ void MainWindow::removeLastDeviceSet() void MainWindow::addFeatureSet() { - int tabIndex = m_featureUIs.size(); + int newFeatureSetIndex = m_featureUIs.size(); + + if (newFeatureSetIndex != 0) + { + qWarning("MainWindow::addFeatureSet: attempt to add more than one feature set (%d)", newFeatureSetIndex); + return; + } + m_mainCore->appendFeatureSet(); - m_featureUIs.push_back(new FeatureUISet(tabIndex, m_mainCore->m_featureSets[tabIndex])); - // ui->tabFeatures->addTab(m_featureUIs.back()->m_featureWindow, QString("F%1").arg(tabIndex)); - emit m_mainCore->featureSetAdded(tabIndex); + m_featureUIs.push_back(new FeatureUISet(newFeatureSetIndex, m_mainCore->m_featureSets[newFeatureSetIndex])); + emit m_mainCore->featureSetAdded(newFeatureSetIndex); } void MainWindow::removeFeatureSet(unsigned int tabIndex) @@ -1572,11 +1578,10 @@ bool MainWindow::handleMessage(const Message& cmd) } else if (MainCore::MsgSavePreset::match(cmd)) { - // MainCore::MsgSavePreset& notif = (MainCore::MsgSavePreset&) cmd; - // saveDeviceSetPresetSettings(notif.getPreset(), notif.getDeviceSetIndex()); - // if (notif.isNewPreset()) { ui->presetTree->setCurrentItem(addPresetToTree(notif.getPreset())); } - // m_mainCore->m_settings.sortPresets(); - // m_mainCore->m_settings.save(); + MainCore::MsgSavePreset& notif = (MainCore::MsgSavePreset&) cmd; + saveDeviceSetPresetSettings(notif.getPreset(), notif.getDeviceSetIndex()); + m_mainCore->m_settings.sortPresets(); + m_mainCore->m_settings.save(); return true; } else if (MainCore::MsgLoadFeatureSetPreset::match(cmd)) @@ -1650,22 +1655,22 @@ bool MainWindow::handleMessage(const Message& cmd) MainCore::MsgAddDeviceSet& notif = (MainCore::MsgAddDeviceSet&) cmd; int direction = notif.getDirection(); - // TODO: implement add workspace API. Will have to give the workspace index that will be ignored - // in Server flavor. Set nullptr for workspace if index is out of bonds - - if (direction == 1) { // Single stream Tx - sampleSinkAdd(nullptr, nullptr, -1); // create with file output device by default - } else if (direction == 0) { // Single stream Rx - sampleSourceAdd(nullptr, nullptr, -1); // create with file input device by default - } else if (direction == 2) { // MIMO - sampleMIMOAdd(nullptr, nullptr, -1); // create with testMI MIMO device y default + if (m_workspaces.size() > 0) + { + if (direction == 1) { // Single stream Tx + sampleSinkAdd(m_workspaces[0], m_workspaces[0], -1); // create with file output device by default + } else if (direction == 0) { // Single stream Rx + sampleSourceAdd(m_workspaces[0], m_workspaces[0], -1); // create with file input device by default + } else if (direction == 2) { // MIMO + sampleMIMOAdd(m_workspaces[0], m_workspaces[0], -1); // create with testMI MIMO device by default + } } return true; } else if (MainCore::MsgRemoveLastDeviceSet::match(cmd)) { - if (m_deviceUIs.size() > 1) { + if (m_deviceUIs.size() > 0) { removeLastDeviceSet(); } @@ -1674,59 +1679,49 @@ bool MainWindow::handleMessage(const Message& cmd) else if (MainCore::MsgSetDevice::match(cmd)) { MainCore::MsgSetDevice& notif = (MainCore::MsgSetDevice&) cmd; + int deviceSetIndex = notif.getDeviceSetIndex(); - // TODO: implement add workspace API. Will have to give the workspace index that will be ignored - // in Server flavor. Set nullptr for workspace if index is out of bonds - - sampleDeviceChange(notif.getDeviceType(), notif.getDeviceSetIndex(), notif.getDeviceIndex(), nullptr); - - return true; - } - else if (MainCore::MsgAddFeatureSet::match(cmd)) - { - addFeatureSet(); - return true; - } - else if (MainCore::MsgRemoveLastFeatureSet::match(cmd)) - { - if (m_mainCore->m_featureSets.size() != 0) { - removeFeatureSet(m_mainCore->m_featureSets.size() - 1); + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_deviceUIs.size())) + { + Workspace *workspace = m_workspaces[m_deviceUIs[deviceSetIndex]->m_deviceGUI->getWorkspaceIndex()]; + sampleDeviceChange(notif.getDeviceType(), notif.getDeviceSetIndex(), notif.getDeviceIndex(), workspace); } return true; } else if (MainCore::MsgAddChannel::match(cmd)) { - // MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd; - // ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex()); - // int currentChannelTabIndex = ui->tabChannels->currentIndex(); + MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd; + int deviceSetIndex = notif.getDeviceSetIndex(); - // if (currentChannelTabIndex >= 0) - // { - // DeviceUISet *deviceUI = m_deviceUIs[currentChannelTabIndex]; - // int channelRegistrationIndex; + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_deviceUIs.size())) + { + DeviceUISet *deviceUISet = m_deviceUIs[deviceSetIndex]; + int deviceWorkspaceIndex = deviceUISet->m_deviceGUI->getWorkspaceIndex(); + deviceWorkspaceIndex = deviceWorkspaceIndex < m_workspaces.size() ? deviceWorkspaceIndex : 0; + int channelRegistrationIndex; - // if (deviceUI->m_deviceMIMOEngine) - // { - // int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels(); - // int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels(); - // int direction = notif.getDirection(); + if (deviceUISet->m_deviceMIMOEngine) + { + int nbMIMOChannels = deviceUISet->getNumberOfAvailableMIMOChannels(); + int nbRxChannels = deviceUISet->getNumberOfAvailableRxChannels(); + int direction = notif.getDirection(); - // if (direction == 2) { - // channelRegistrationIndex = notif.getChannelRegistrationIndex(); - // } else if (direction == 0) { - // channelRegistrationIndex = nbMIMOChannels + notif.getChannelRegistrationIndex(); - // } else { - // channelRegistrationIndex = nbMIMOChannels + nbRxChannels + notif.getChannelRegistrationIndex(); - // } - // } - // else - // { - // channelRegistrationIndex = notif.getChannelRegistrationIndex(); - // } + if (direction == 2) { + channelRegistrationIndex = notif.getChannelRegistrationIndex(); + } else if (direction == 0) { + channelRegistrationIndex = nbMIMOChannels + notif.getChannelRegistrationIndex(); + } else { + channelRegistrationIndex = nbMIMOChannels + nbRxChannels + notif.getChannelRegistrationIndex(); + } + } + else + { + channelRegistrationIndex = notif.getChannelRegistrationIndex(); + } - // channelAddClicked(channelRegistrationIndex); - // } + channelAddClicked(m_workspaces[deviceWorkspaceIndex], deviceSetIndex, channelRegistrationIndex); + } return true; } @@ -1736,28 +1731,20 @@ bool MainWindow::handleMessage(const Message& cmd) deleteChannel(notif.getDeviceSetIndex(), notif.getChannelIndex()); return true; } - else if (MainCore::MsgDeviceSetFocus::match(cmd)) - { - // MainCore::MsgDeviceSetFocus& notif = (MainCore::MsgDeviceSetFocus&) cmd; - // int index = notif.getDeviceSetIndex(); - // if ((index >= 0) && (index < (int) m_deviceUIs.size())) { - // ui->tabInputsView->setCurrentIndex(index); - // } - - return true; - } else if (MainCore::MsgAddFeature::match(cmd)) { - // MainCore::MsgAddFeature& notif = (MainCore::MsgAddFeature&) cmd; - // ui->tabFeatures->setCurrentIndex(notif.getFeatureSetIndex()); - // featureAddClicked(notif.getFeatureRegistrationIndex()); + MainCore::MsgAddFeature& notif = (MainCore::MsgAddFeature&) cmd; + + if (m_workspaces.size() > 0) { + featureAddClicked(m_workspaces[0], notif.getFeatureRegistrationIndex()); + } return true; } else if (MainCore::MsgDeleteFeature::match(cmd)) { MainCore::MsgDeleteFeature& notif = (MainCore::MsgDeleteFeature&) cmd; - deleteFeature(notif.getFeatureSetIndex(), notif.getFeatureIndex()); + deleteFeature(0, notif.getFeatureIndex()); return true; } else if (MainCore::MsgMoveDeviceUIToWorkspace::match(cmd)) diff --git a/sdrsrv/mainserver.cpp b/sdrsrv/mainserver.cpp index e0597cc42..2d084e654 100644 --- a/sdrsrv/mainserver.cpp +++ b/sdrsrv/mainserver.cpp @@ -200,19 +200,6 @@ bool MainServer::handleMessage(const Message& cmd) } return true; } - else if (MainCore::MsgAddFeatureSet::match(cmd)) - { - addFeatureSet(); - return true; - } - else if (MainCore::MsgRemoveLastFeatureSet::match(cmd)) - { - if (m_mainCore->m_featureSets.size() != 0) { - removeFeatureSet(m_mainCore->m_featureSets.size() - 1); - } - - return true; - } else if (MainCore::MsgAddChannel::match(cmd)) { MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd; @@ -228,14 +215,14 @@ bool MainServer::handleMessage(const Message& cmd) else if (MainCore::MsgAddFeature::match(cmd)) { MainCore::MsgAddFeature& notif = (MainCore::MsgAddFeature&) cmd; - addFeature(notif.getFeatureSetIndex(), notif.getFeatureRegistrationIndex()); + addFeature(0, notif.getFeatureRegistrationIndex()); return true; } else if (MainCore::MsgDeleteFeature::match(cmd)) { MainCore::MsgDeleteFeature& notif = (MainCore::MsgDeleteFeature&) cmd; - deleteFeature(notif.getFeatureSetIndex(), notif.getFeatureIndex()); + deleteFeature(0, notif.getFeatureIndex()); return true; } else if (MainCore::MsgApplySettings::match(cmd)) diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index ed69f07ed..bc41da17a 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1381,37 +1381,6 @@ paths: "501": $ref: "#/responses/Response_501" - /sdrangel/deviceset/{deviceSetIndex}/focus: - x-swagger-router-controller: deviceset - patch: - description: Set focus on device set (GUI only) - operationId: devicesetFocusPatch - tags: - - DeviceSet - parameters: - - in: path - name: deviceSetIndex - type: integer - required: true - description: Index of device set in the device set list - responses: - "202": - description: Message to focus on device set was sent successfully - schema: - $ref: "#/definitions/SuccessResponse" - "400": - description: Unsupported (srver instance) - schema: - $ref: "#/definitions/ErrorResponse" - "404": - description: Invalid index - schema: - $ref: "#/definitions/ErrorResponse" - "500": - $ref: "#/responses/Response_500" - "501": - $ref: "#/responses/Response_501" - /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings: x-swagger-router-controller: deviceset get: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 2f3e60c3e..c3b88a7da 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -14552,9 +14552,6 @@ margin-bottom: 20px;
  • devicesetDeviceWorkspacePut
  • -
  • - devicesetFocusPatch -
  • devicesetGet
  • @@ -26686,467 +26683,6 @@ $(document).ready(function() {
    -
    -
    -
    -

    devicesetFocusPatch

    -

    -
    -
    -
    -

    -

    Set focus on device set (GUI only)

    -

    -
    -
    /sdrangel/deviceset/{deviceSetIndex}/focus
    -

    -

    Usage and SDK Samples

    -

    - - -
    -
    -
    curl -X PATCH "http://localhost/sdrangel/deviceset/{deviceSetIndex}/focus"
    -
    -
    -
    import SWGSDRangel.*;
    -import SWGSDRangel.auth.*;
    -import SWGSDRangel.model.*;
    -import SWGSDRangel.api.DeviceSetApi;
    -
    -import java.io.File;
    -import java.util.*;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    import SWGSDRangel.api.DeviceSetApi;
    -
    -public class DeviceSetApiExample {
    -
    -    public static void main(String[] args) {
    -        DeviceSetApi apiInstance = new DeviceSetApi();
    -        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -        try {
    -            SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
    -            System.out.println(result);
    -        } catch (ApiException e) {
    -            System.err.println("Exception when calling DeviceSetApi#devicesetFocusPatch");
    -            e.printStackTrace();
    -        }
    -    }
    -}
    -
    - -
    -
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    -
    -DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    -
    -[apiInstance devicesetFocusPatchWith:deviceSetIndex
    -              completionHandler: ^(SuccessResponse output, NSError* error) {
    -                            if (output) {
    -                                NSLog(@"%@", output);
    -                            }
    -                            if (error) {
    -                                NSLog(@"Error: %@", error);
    -                            }
    -                        }];
    -
    -
    - -
    -
    var SdRangel = require('sd_rangel');
    -
    -var api = new SdRangel.DeviceSetApi()
    -
    -var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    -
    -
    -var callback = function(error, data, response) {
    -  if (error) {
    -    console.error(error);
    -  } else {
    -    console.log('API called successfully. Returned data: ' + data);
    -  }
    -};
    -api.devicesetFocusPatch(deviceSetIndex, callback);
    -
    -
    - - -
    -
    using System;
    -using System.Diagnostics;
    -using SWGSDRangel.Api;
    -using SWGSDRangel.Client;
    -using SWGSDRangel.Model;
    -
    -namespace Example
    -{
    -    public class devicesetFocusPatchExample
    -    {
    -        public void main()
    -        {
    -            
    -            var apiInstance = new DeviceSetApi();
    -            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    -
    -            try
    -            {
    -                SuccessResponse result = apiInstance.devicesetFocusPatch(deviceSetIndex);
    -                Debug.WriteLine(result);
    -            }
    -            catch (Exception e)
    -            {
    -                Debug.Print("Exception when calling DeviceSetApi.devicesetFocusPatch: " + e.Message );
    -            }
    -        }
    -    }
    -}
    -
    -
    - -
    -
    <?php
    -require_once(__DIR__ . '/vendor/autoload.php');
    -
    -$api_instance = new Swagger\Client\Api\DeviceSetApi();
    -$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    -
    -try {
    -    $result = $api_instance->devicesetFocusPatch($deviceSetIndex);
    -    print_r($result);
    -} catch (Exception $e) {
    -    echo 'Exception when calling DeviceSetApi->devicesetFocusPatch: ', $e->getMessage(), PHP_EOL;
    -}
    -?>
    -
    - -
    -
    use Data::Dumper;
    -use SWGSDRangel::Configuration;
    -use SWGSDRangel::DeviceSetApi;
    -
    -my $api_instance = SWGSDRangel::DeviceSetApi->new();
    -my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    -
    -eval { 
    -    my $result = $api_instance->devicesetFocusPatch(deviceSetIndex => $deviceSetIndex);
    -    print Dumper($result);
    -};
    -if ($@) {
    -    warn "Exception when calling DeviceSetApi->devicesetFocusPatch: $@\n";
    -}
    -
    - -
    -
    from __future__ import print_statement
    -import time
    -import swagger_sdrangel
    -from swagger_sdrangel.rest import ApiException
    -from pprint import pprint
    -
    -# create an instance of the API class
    -api_instance = swagger_sdrangel.DeviceSetApi()
    -deviceSetIndex = 56 # Integer | Index of device set in the device set list
    -
    -try: 
    -    api_response = api_instance.deviceset_focus_patch(deviceSetIndex)
    -    pprint(api_response)
    -except ApiException as e:
    -    print("Exception when calling DeviceSetApi->devicesetFocusPatch: %s\n" % e)
    -
    -
    - -

    Parameters

    - -
    Path parameters
    - - - - - - - - - -
    NameDescription
    deviceSetIndex* - - -
    -
    -
    - - Integer - - -
    - Index of device set in the device set list -
    -
    -
    - Required -
    -
    -
    -
    - - - - - -

    Responses

    -

    Status: 202 - Message to focus on device set was sent successfully

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 400 - Unsupported (srver instance)

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 404 - Invalid index

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 500 - Error

    - - - -
    -
    -
    - -
    - -
    -
    - -

    Status: 501 - Function not implemented

    - - - -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    @@ -60155,7 +59691,7 @@ except ApiException as e:
    - Generated 2022-05-14T13:17:30.416+02:00 + Generated 2022-05-16T19:55:17.622+02:00
    diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp index 74d9496f1..46230ed91 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp @@ -1388,60 +1388,6 @@ SWGDeviceSetApi::devicesetDeviceWorkspacePutCallback(SWGHttpRequestWorker * work } } -void -SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) { - QString fullPath; - fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/focus"); - - QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); - fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); - - - SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); - SWGHttpRequestInput input(fullPath, "PATCH"); - - - - - - foreach(QString key, this->defaultHeaders.keys()) { - input.headers.insert(key, this->defaultHeaders.value(key)); - } - - connect(worker, - &SWGHttpRequestWorker::on_execution_finished, - this, - &SWGDeviceSetApi::devicesetFocusPatchCallback); - - worker->execute(&input); -} - -void -SWGDeviceSetApi::devicesetFocusPatchCallback(SWGHttpRequestWorker * worker) { - QString msg; - QString error_str = worker->error_str; - QNetworkReply::NetworkError error_type = worker->error_type; - - if (worker->error_type == QNetworkReply::NoError) { - msg = QString("Success! %1 bytes").arg(worker->response.length()); - } - else { - msg = "Error: " + worker->error_str; - } - - - QString json(worker->response); - SWGSuccessResponse* output = static_cast(create(json, QString("SWGSuccessResponse"))); - worker->deleteLater(); - - if (worker->error_type == QNetworkReply::NoError) { - emit devicesetFocusPatchSignal(output); - } else { - emit devicesetFocusPatchSignalE(output, error_type, error_str); - emit devicesetFocusPatchSignalEFull(worker, error_type, error_str); - } -} - void SWGDeviceSetApi::devicesetGet(qint32 device_set_index) { QString fullPath; diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h index 101adafae..81ac095eb 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h @@ -71,7 +71,6 @@ public: void devicesetDeviceSubsystemRunPost(qint32 device_set_index, qint32 subsystem_index, SWGDeviceSettings& body); void devicesetDeviceWorkspaceGet(qint32 device_set_index); void devicesetDeviceWorkspacePut(qint32 device_set_index, SWGWorkspaceInfo& body); - void devicesetFocusPatch(qint32 device_set_index); void devicesetGet(qint32 device_set_index); void devicesetSpectrumServerDelete(qint32 device_set_index); void devicesetSpectrumServerGet(qint32 device_set_index); @@ -109,7 +108,6 @@ private: void devicesetDeviceSubsystemRunPostCallback (SWGHttpRequestWorker * worker); void devicesetDeviceWorkspaceGetCallback (SWGHttpRequestWorker * worker); void devicesetDeviceWorkspacePutCallback (SWGHttpRequestWorker * worker); - void devicesetFocusPatchCallback (SWGHttpRequestWorker * worker); void devicesetGetCallback (SWGHttpRequestWorker * worker); void devicesetSpectrumServerDeleteCallback (SWGHttpRequestWorker * worker); void devicesetSpectrumServerGetCallback (SWGHttpRequestWorker * worker); @@ -147,7 +145,6 @@ signals: void devicesetDeviceSubsystemRunPostSignal(SWGDeviceState* summary); void devicesetDeviceWorkspaceGetSignal(SWGWorkspaceInfo* summary); void devicesetDeviceWorkspacePutSignal(SWGSuccessResponse* summary); - void devicesetFocusPatchSignal(SWGSuccessResponse* summary); void devicesetGetSignal(SWGDeviceSet* summary); void devicesetSpectrumServerDeleteSignal(SWGSuccessResponse* summary); void devicesetSpectrumServerGetSignal(SWGSpectrumServer* summary); @@ -184,7 +181,6 @@ signals: void devicesetDeviceSubsystemRunPostSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceWorkspaceGetSignalE(SWGWorkspaceInfo* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceWorkspacePutSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); - void devicesetFocusPatchSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetGetSignalE(SWGDeviceSet* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetSpectrumServerDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetSpectrumServerGetSignalE(SWGSpectrumServer* summary, QNetworkReply::NetworkError error_type, QString& error_str); @@ -221,7 +217,6 @@ signals: void devicesetDeviceSubsystemRunPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceWorkspaceGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceWorkspacePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void devicesetFocusPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetSpectrumServerDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetSpectrumServerGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); From cc8b2e6462457fd36735dd12dc5b95427dbf4ae3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 17 May 2022 19:55:40 +0200 Subject: [PATCH 2/2] Fixed audio FIFO write overflows in modulators using audio input. Also fixes #1236 in SSB modulator --- plugins/channeltx/modam/ammodbaseband.cpp | 16 ++++++++++++---- plugins/channeltx/modam/ammodsource.cpp | 2 ++ .../channeltx/modfreedv/freedvmodbaseband.cpp | 18 +++++++++++++----- .../channeltx/modfreedv/freedvmodsource.cpp | 1 + plugins/channeltx/modnfm/nfmmodbaseband.cpp | 16 ++++++++++++---- plugins/channeltx/modnfm/nfmmodsource.cpp | 2 ++ plugins/channeltx/modssb/ssbmodbaseband.cpp | 16 ++++++++++++---- plugins/channeltx/modssb/ssbmodbaseband.h | 2 +- plugins/channeltx/modssb/ssbmodsource.cpp | 5 ++++- plugins/channeltx/modssb/ssbmodsource.h | 6 +++--- plugins/channeltx/modwfm/wfmmodbaseband.cpp | 16 ++++++++++++---- plugins/channeltx/modwfm/wfmmodsource.cpp | 2 ++ 12 files changed, 76 insertions(+), 26 deletions(-) diff --git a/plugins/channeltx/modam/ammodbaseband.cpp b/plugins/channeltx/modam/ammodbaseband.cpp index 14d0ba1fe..989b59c05 100644 --- a/plugins/channeltx/modam/ammodbaseband.cpp +++ b/plugins/channeltx/modam/ammodbaseband.cpp @@ -40,9 +40,6 @@ AMModBaseband::AMModBaseband() : Qt::QueuedConnection ); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(m_source.getAudioFifo(), getInputMessageQueue()); - m_source.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate()); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(m_source.getFeedbackAudioFifo(), getInputMessageQueue()); m_source.applyFeedbackAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate()); @@ -199,7 +196,6 @@ void AMModBaseband::applySettings(const AMModSettings& settings, bool force) AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); audioDeviceManager->removeAudioSource(getAudioFifo()); - audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); int audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex); if (getAudioSampleRate() != audioSampleRate) @@ -210,6 +206,18 @@ void AMModBaseband::applySettings(const AMModSettings& settings, bool force) } } + if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) + { + AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); + int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); + + if (settings.m_modAFInput == AMModSettings::AMModInputAudio) { + audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); + } else { + audioDeviceManager->removeAudioSource(getAudioFifo()); + } + } + if ((settings.m_feedbackAudioDeviceName != m_settings.m_feedbackAudioDeviceName) || force) { AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); diff --git a/plugins/channeltx/modam/ammodsource.cpp b/plugins/channeltx/modam/ammodsource.cpp index 8acc72b3e..7ce953f43 100644 --- a/plugins/channeltx/modam/ammodsource.cpp +++ b/plugins/channeltx/modam/ammodsource.cpp @@ -37,6 +37,8 @@ AMModSource::AMModSource() : m_ifstream(nullptr), m_mutex(QMutex::Recursive) { + m_audioFifo.setLabel("AMModSource.m_audioFifo"); + m_feedbackAudioFifo.setLabel("AMModSource.m_feedbackAudioFifo"); m_audioBuffer.resize(24000); m_audioBufferFill = 0; m_audioReadBuffer.resize(24000); diff --git a/plugins/channeltx/modfreedv/freedvmodbaseband.cpp b/plugins/channeltx/modfreedv/freedvmodbaseband.cpp index 0eb676b57..4d382d367 100644 --- a/plugins/channeltx/modfreedv/freedvmodbaseband.cpp +++ b/plugins/channeltx/modfreedv/freedvmodbaseband.cpp @@ -40,9 +40,6 @@ FreeDVModBaseband::FreeDVModBaseband() : Qt::QueuedConnection ); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(m_source.getAudioFifo(), getInputMessageQueue()); - m_source.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate()); - connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); } @@ -195,7 +192,6 @@ void FreeDVModBaseband::applySettings(const FreeDVModSettings& settings, bool fo AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); audioDeviceManager->removeAudioSource(getAudioFifo()); - audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); int audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex); if (getAudioSampleRate() != audioSampleRate) { @@ -203,6 +199,18 @@ void FreeDVModBaseband::applySettings(const FreeDVModSettings& settings, bool fo } } + if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) + { + AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); + int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); + + if (settings.m_modAFInput == FreeDVModSettings::FreeDVModInputAudio) { + audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); + } else { + audioDeviceManager->removeAudioSource(getAudioFifo()); + } + } + m_source.applySettings(settings, force); m_settings = settings; @@ -211,4 +219,4 @@ void FreeDVModBaseband::applySettings(const FreeDVModSettings& settings, bool fo int FreeDVModBaseband::getChannelSampleRate() const { return m_channelizer->getChannelSampleRate(); -} \ No newline at end of file +} diff --git a/plugins/channeltx/modfreedv/freedvmodsource.cpp b/plugins/channeltx/modfreedv/freedvmodsource.cpp index 0a65c5dd7..4df1ca2e8 100644 --- a/plugins/channeltx/modfreedv/freedvmodsource.cpp +++ b/plugins/channeltx/modfreedv/freedvmodsource.cpp @@ -49,6 +49,7 @@ FreeDVModSource::FreeDVModSource() : m_scaleFactor(SDR_TX_SCALEF), m_mutex(QMutex::Recursive) { + m_audioFifo.setLabel("FreeDVModSource.m_audioFifo"); m_SSBFilter = new fftfilt(m_lowCutoff / m_audioSampleRate, m_hiCutoff / m_audioSampleRate, m_ssbFftLen); m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size std::fill(m_SSBFilterBuffer, m_SSBFilterBuffer+(m_ssbFftLen>>1), Complex{0,0}); diff --git a/plugins/channeltx/modnfm/nfmmodbaseband.cpp b/plugins/channeltx/modnfm/nfmmodbaseband.cpp index fc821e8da..083524e45 100644 --- a/plugins/channeltx/modnfm/nfmmodbaseband.cpp +++ b/plugins/channeltx/modnfm/nfmmodbaseband.cpp @@ -40,9 +40,6 @@ NFMModBaseband::NFMModBaseband() : Qt::QueuedConnection ); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(m_source.getAudioFifo(), getInputMessageQueue()); - m_source.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate()); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(m_source.getFeedbackAudioFifo(), getInputMessageQueue()); m_source.applyFeedbackAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate()); @@ -199,7 +196,6 @@ void NFMModBaseband::applySettings(const NFMModSettings& settings, bool force) AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); audioDeviceManager->removeAudioSource(getAudioFifo()); - audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); int audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex); if (getAudioSampleRate() != audioSampleRate) @@ -210,6 +206,18 @@ void NFMModBaseband::applySettings(const NFMModSettings& settings, bool force) } } + if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) + { + AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); + int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); + + if (settings.m_modAFInput == NFMModSettings::NFMModInputAudio) { + audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); + } else { + audioDeviceManager->removeAudioSource(getAudioFifo()); + } + } + if ((settings.m_feedbackAudioDeviceName != m_settings.m_feedbackAudioDeviceName) || force) { AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); diff --git a/plugins/channeltx/modnfm/nfmmodsource.cpp b/plugins/channeltx/modnfm/nfmmodsource.cpp index a8b6e53ca..032dc1b27 100644 --- a/plugins/channeltx/modnfm/nfmmodsource.cpp +++ b/plugins/channeltx/modnfm/nfmmodsource.cpp @@ -40,6 +40,8 @@ NFMModSource::NFMModSource() : m_ifstream(nullptr), m_mutex(QMutex::Recursive) { + m_audioFifo.setLabel("NFMModSource.m_audioFifo"); + m_feedbackAudioFifo.setLabel("NFMModSource.m_feedbackAudioFifo"); m_audioBuffer.resize(24000); m_audioBufferFill = 0; m_audioReadBuffer.resize(24000); diff --git a/plugins/channeltx/modssb/ssbmodbaseband.cpp b/plugins/channeltx/modssb/ssbmodbaseband.cpp index 9c10252b8..1102b2d51 100644 --- a/plugins/channeltx/modssb/ssbmodbaseband.cpp +++ b/plugins/channeltx/modssb/ssbmodbaseband.cpp @@ -41,9 +41,6 @@ SSBModBaseband::SSBModBaseband() : Qt::QueuedConnection ); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(m_source.getAudioFifo(), getInputMessageQueue()); - m_source.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate()); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(m_source.getFeedbackAudioFifo(), getInputMessageQueue()); m_source.applyFeedbackAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate()); @@ -205,7 +202,6 @@ void SSBModBaseband::applySettings(const SSBModSettings& settings, bool force) AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); audioDeviceManager->removeAudioSource(getAudioFifo()); - audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); int audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex); if (getAudioSampleRate() != audioSampleRate) @@ -218,6 +214,18 @@ void SSBModBaseband::applySettings(const SSBModSettings& settings, bool force) } } + if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) + { + AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); + int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); + + if (settings.m_modAFInput == SSBModSettings::SSBModInputAudio) { + audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); + } else { + audioDeviceManager->removeAudioSource(getAudioFifo()); + } + } + if ((settings.m_feedbackAudioDeviceName != m_settings.m_feedbackAudioDeviceName) || force) { AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); diff --git a/plugins/channeltx/modssb/ssbmodbaseband.h b/plugins/channeltx/modssb/ssbmodbaseband.h index b60268a30..5776698f8 100644 --- a/plugins/channeltx/modssb/ssbmodbaseband.h +++ b/plugins/channeltx/modssb/ssbmodbaseband.h @@ -72,7 +72,7 @@ public: void setInputFileStream(std::ifstream *ifstream) { m_source.setInputFileStream(ifstream); } AudioFifo *getAudioFifo() { return m_source.getAudioFifo(); } AudioFifo *getFeedbackAudioFifo() { return m_source.getFeedbackAudioFifo(); } - void setSpectrumSink(SpectrumVis *sampleSink) { m_spectrumVis = sampleSink; m_source.setSpectrumSink((BasebandSampleSink *) sampleSink); } + void setSpectrumSink(SpectrumVis *sampleSink) { m_spectrumVis = sampleSink; m_source.setSpectrumSink(sampleSink); } void setChannel(ChannelAPI *channel); signals: diff --git a/plugins/channeltx/modssb/ssbmodsource.cpp b/plugins/channeltx/modssb/ssbmodsource.cpp index 0dfd298a7..f22457de0 100644 --- a/plugins/channeltx/modssb/ssbmodsource.cpp +++ b/plugins/channeltx/modssb/ssbmodsource.cpp @@ -17,7 +17,7 @@ #include -#include "dsp/basebandsamplesink.h" +#include "dsp/spectrumvis.h" #include "dsp/misc.h" #include "dsp/datafifo.h" #include "util/messagequeue.h" @@ -31,6 +31,7 @@ const int SSBModSource::m_levelNbSamples = 480; // every 10ms SSBModSource::SSBModSource() : m_channelSampleRate(48000), m_channelFrequencyOffset(0), + m_spectrumSink(nullptr), m_audioSampleRate(48000), m_audioFifo(12000), m_feedbackAudioFifo(48000), @@ -40,6 +41,8 @@ SSBModSource::SSBModSource() : m_ifstream(nullptr), m_mutex(QMutex::Recursive) { + m_audioFifo.setLabel("SSBModSource.m_audioFifo"); + m_feedbackAudioFifo.setLabel("SSBModSource.m_feedbackAudioFifo"); m_SSBFilter = new fftfilt(m_settings.m_lowCutoff / m_audioSampleRate, m_settings.m_bandwidth / m_audioSampleRate, m_ssbFftLen); m_DSBFilter = new fftfilt((2.0f * m_settings.m_bandwidth) / m_audioSampleRate, 2 * m_ssbFftLen); m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size diff --git a/plugins/channeltx/modssb/ssbmodsource.h b/plugins/channeltx/modssb/ssbmodsource.h index 76275cb12..8618dbca0 100644 --- a/plugins/channeltx/modssb/ssbmodsource.h +++ b/plugins/channeltx/modssb/ssbmodsource.h @@ -36,8 +36,8 @@ #include "ssbmodsettings.h" -class BasebandSampleSink; class ChannelAPI; +class SpectrumVis; class SSBModSource : public QObject, public ChannelSampleSource { @@ -68,7 +68,7 @@ public: } void applySettings(const SSBModSettings& settings, bool force = false); void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = 0); - void setSpectrumSink(BasebandSampleSink *sampleSink) { m_spectrumSink = sampleSink; } + void setSpectrumSink(SpectrumVis *sampleSink) { m_spectrumSink = sampleSink; } private: int m_channelSampleRate; @@ -101,7 +101,7 @@ private: int m_DSBFilterBufferIndex; static const int m_ssbFftLen; - BasebandSampleSink* m_spectrumSink; + SpectrumVis* m_spectrumSink; SampleVector m_sampleBuffer; fftfilt::cmplx m_sum; diff --git a/plugins/channeltx/modwfm/wfmmodbaseband.cpp b/plugins/channeltx/modwfm/wfmmodbaseband.cpp index ee02b0446..a335e5e30 100644 --- a/plugins/channeltx/modwfm/wfmmodbaseband.cpp +++ b/plugins/channeltx/modwfm/wfmmodbaseband.cpp @@ -40,9 +40,6 @@ WFMModBaseband::WFMModBaseband() : Qt::QueuedConnection ); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(m_source.getAudioFifo(), getInputMessageQueue()); - m_source.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate()); - DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(m_source.getFeedbackAudioFifo(), getInputMessageQueue()); m_source.applyFeedbackAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate()); @@ -198,7 +195,6 @@ void WFMModBaseband::applySettings(const WFMModSettings& settings, bool force) AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); audioDeviceManager->removeAudioSource(getAudioFifo()); - audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); int audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex); if (getAudioSampleRate() != audioSampleRate) { @@ -206,6 +202,18 @@ void WFMModBaseband::applySettings(const WFMModSettings& settings, bool force) } } + if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) + { + AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager(); + int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName); + + if (settings.m_modAFInput == WFMModSettings::WFMModInputAudio) { + audioDeviceManager->addAudioSource(getAudioFifo(), getInputMessageQueue(), audioDeviceIndex); + } else { + audioDeviceManager->removeAudioSource(getAudioFifo()); + } + } + m_source.applySettings(settings, force); m_settings = settings; diff --git a/plugins/channeltx/modwfm/wfmmodsource.cpp b/plugins/channeltx/modwfm/wfmmodsource.cpp index b195fd485..9b4868cef 100644 --- a/plugins/channeltx/modwfm/wfmmodsource.cpp +++ b/plugins/channeltx/modwfm/wfmmodsource.cpp @@ -39,6 +39,8 @@ WFMModSource::WFMModSource() : m_ifstream(nullptr), m_mutex(QMutex::Recursive) { + m_audioFifo.setLabel("WFMModSource.m_audioFifo"); + m_feedbackAudioFifo.setLabel("WFMModSource.m_feedbackAudioFifo"); m_rfFilter = new fftfilt(-62500.0 / 384000.0, 62500.0 / 384000.0, m_rfFilterFFTLength); m_rfFilterBuffer = new Complex[m_rfFilterFFTLength]; std::fill(m_rfFilterBuffer, m_rfFilterBuffer+m_rfFilterFFTLength, Complex{0,0});