mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	Audio modulators audio feedback: new member attributes
This commit is contained in:
		
							parent
							
								
									2c72e885ec
								
							
						
					
					
						commit
						ac9704fda5
					
				| @ -57,6 +57,7 @@ AMMod::AMMod(DeviceAPI *deviceAPI) : | ||||
|     m_outputSampleRate(48000), | ||||
|     m_inputFrequencyOffset(0), | ||||
|     m_audioFifo(4800), | ||||
|     m_feedbackAudioFifo(4800), | ||||
| 	m_settingsMutex(QMutex::Recursive), | ||||
| 	m_fileSize(0), | ||||
| 	m_recordLength(0), | ||||
| @ -70,10 +71,17 @@ AMMod::AMMod(DeviceAPI *deviceAPI) : | ||||
| 	m_audioBuffer.resize(1<<14); | ||||
| 	m_audioBufferFill = 0; | ||||
| 
 | ||||
| 	m_feedbackAudioBuffer.resize(1<<14); | ||||
| 	m_feedbackAudioBufferFill = 0; | ||||
| 
 | ||||
| 	m_magsq = 0.0; | ||||
| 
 | ||||
| 	DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(&m_audioFifo, getInputMessageQueue()); | ||||
| 	m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate(); | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_feedbackAudioFifo, getInputMessageQueue()); | ||||
|     m_feedbackAudioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate(); | ||||
| 
 | ||||
| 	m_toneNco.setFreq(1000.0, m_audioSampleRate); | ||||
|     m_cwKeyer.setSampleRate(m_audioSampleRate); | ||||
|     m_cwKeyer.reset(); | ||||
| @ -98,6 +106,7 @@ AMMod::~AMMod() | ||||
|     m_deviceAPI->removeChannelSource(m_threadedChannelizer); | ||||
|     delete m_threadedChannelizer; | ||||
|     delete m_channelizer; | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_feedbackAudioFifo); | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -273,7 +273,6 @@ private: | ||||
|     int m_outputSampleRate; | ||||
|     int m_inputFrequencyOffset; | ||||
|     AMModSettings m_settings; | ||||
|     quint32 m_audioSampleRate; | ||||
| 
 | ||||
|     NCO m_carrierNco; | ||||
|     NCOF m_toneNco; | ||||
| @ -286,10 +285,16 @@ private: | ||||
|     double m_magsq; | ||||
|     MovingAverageUtil<double, double, 16> m_movingAverage; | ||||
| 
 | ||||
|     quint32 m_audioSampleRate; | ||||
|     AudioVector m_audioBuffer; | ||||
|     uint m_audioBufferFill; | ||||
| 
 | ||||
|     AudioFifo m_audioFifo; | ||||
| 
 | ||||
|     quint32 m_feedbackAudioSampleRate; | ||||
|     AudioVector m_feedbackAudioBuffer; | ||||
|     uint m_feedbackAudioBufferFill; | ||||
|     AudioFifo m_feedbackAudioFifo; | ||||
| 
 | ||||
|     SampleVector m_sampleBuffer; | ||||
|     QMutex m_settingsMutex; | ||||
| 
 | ||||
|  | ||||
| @ -42,6 +42,8 @@ void AMModSettings::resetToDefaults() | ||||
|     m_title = "AM Modulator"; | ||||
|     m_modAFInput = AMModInputAF::AMModInputNone; | ||||
|     m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackVolumeFactor = 1.0f; | ||||
|     m_useReverseAPI = false; | ||||
|     m_reverseAPIAddress = "127.0.0.1"; | ||||
|     m_reverseAPIPort = 8888; | ||||
| @ -76,6 +78,8 @@ QByteArray AMModSettings::serialize() const | ||||
|     s.writeU32(14, m_reverseAPIPort); | ||||
|     s.writeU32(15, m_reverseAPIDeviceIndex); | ||||
|     s.writeU32(16, m_reverseAPIChannelIndex); | ||||
|     s.writeString(17, m_feedbackAudioDeviceName); | ||||
|     s.writeReal(18, m_feedbackVolumeFactor); | ||||
| 
 | ||||
|     return s.final(); | ||||
| } | ||||
| @ -138,6 +142,8 @@ bool AMModSettings::deserialize(const QByteArray& data) | ||||
|         m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readU32(16, &utmp, 0); | ||||
|         m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readString(17, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName); | ||||
|         d.readReal(18, &m_feedbackVolumeFactor, 1.0); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @ -43,7 +43,9 @@ struct AMModSettings | ||||
|     quint32 m_rgbColor; | ||||
|     QString m_title; | ||||
|     AMModInputAF m_modAFInput; | ||||
|     QString m_audioDeviceName; | ||||
|     QString m_audioDeviceName;         //!< This is the audio device you get the audio samples from
 | ||||
|     QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
 | ||||
|     float m_feedbackVolumeFactor; | ||||
|     bool m_useReverseAPI; | ||||
|     QString m_reverseAPIAddress; | ||||
|     uint16_t m_reverseAPIPort; | ||||
|  | ||||
| @ -68,6 +68,7 @@ FreeDVMod::FreeDVMod(DeviceAPI *deviceAPI) : | ||||
| 	m_SSBFilterBufferIndex(0), | ||||
|     m_sampleSink(0), | ||||
|     m_audioFifo(4800), | ||||
|     m_feedbackAudioFifo(4800), | ||||
| 	m_settingsMutex(QMutex::Recursive), | ||||
| 	m_fileSize(0), | ||||
| 	m_recordLength(0), | ||||
| @ -89,6 +90,9 @@ FreeDVMod::FreeDVMod(DeviceAPI *deviceAPI) : | ||||
| 	DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(&m_audioFifo, getInputMessageQueue()); | ||||
|     m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate(); | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_feedbackAudioFifo, getInputMessageQueue()); | ||||
|     m_feedbackAudioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate(); | ||||
| 
 | ||||
|     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}); | ||||
| @ -96,6 +100,9 @@ FreeDVMod::FreeDVMod(DeviceAPI *deviceAPI) : | ||||
| 	m_audioBuffer.resize(1<<14); | ||||
| 	m_audioBufferFill = 0; | ||||
| 
 | ||||
| 	m_feedbackAudioBuffer.resize(1<<14); | ||||
| 	m_feedbackAudioBufferFill = 0; | ||||
| 
 | ||||
|     m_sum.real(0.0f); | ||||
|     m_sum.imag(0.0f); | ||||
|     m_undersampleCount = 0; | ||||
| @ -124,6 +131,7 @@ FreeDVMod::~FreeDVMod() | ||||
|     disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); | ||||
|     delete m_networkManager; | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_feedbackAudioFifo); | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo); | ||||
| 
 | ||||
|     m_deviceAPI->removeChannelSourceAPI(this); | ||||
|  | ||||
| @ -286,7 +286,6 @@ private: | ||||
|     Real m_lowCutoff; | ||||
|     Real m_hiCutoff; | ||||
|     FreeDVModSettings m_settings; | ||||
|     quint32 m_audioSampleRate; | ||||
| 
 | ||||
|     NCOF m_carrierNco; | ||||
|     NCOF m_toneNco; | ||||
| @ -310,10 +309,16 @@ private: | ||||
|     double m_magsq; | ||||
|     MovingAverageUtil<double, double, 16> m_movingAverage; | ||||
| 
 | ||||
|     quint32 m_audioSampleRate; | ||||
|     AudioVector m_audioBuffer; | ||||
|     uint m_audioBufferFill; | ||||
| 
 | ||||
|     AudioFifo m_audioFifo; | ||||
| 
 | ||||
|     quint32 m_feedbackAudioSampleRate; | ||||
|     AudioVector m_feedbackAudioBuffer; | ||||
|     uint m_feedbackAudioBufferFill; | ||||
|     AudioFifo m_feedbackAudioFifo; | ||||
| 
 | ||||
|     QMutex m_settingsMutex; | ||||
| 
 | ||||
|     std::ifstream m_ifstream; | ||||
|  | ||||
| @ -42,6 +42,8 @@ void FreeDVModSettings::resetToDefaults() | ||||
|     m_title = "FreeDV Modulator"; | ||||
|     m_modAFInput = FreeDVModInputAF::FreeDVModInputNone; | ||||
|     m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackVolumeFactor = 1.0f; | ||||
|     m_freeDVMode = FreeDVMode::FreeDVMode2400A; | ||||
|     m_gaugeInputElseModem = false; | ||||
|     m_useReverseAPI = false; | ||||
| @ -84,6 +86,8 @@ QByteArray FreeDVModSettings::serialize() const | ||||
|     s.writeU32(24, m_reverseAPIPort); | ||||
|     s.writeU32(25, m_reverseAPIDeviceIndex); | ||||
|     s.writeU32(26, m_reverseAPIChannelIndex); | ||||
|     s.writeString(27, m_feedbackAudioDeviceName); | ||||
|     s.writeReal(28, m_feedbackVolumeFactor); | ||||
| 
 | ||||
|     return s.final(); | ||||
| } | ||||
| @ -162,6 +166,8 @@ bool FreeDVModSettings::deserialize(const QByteArray& data) | ||||
|         m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readU32(26, &utmp, 0); | ||||
|         m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readString(27, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName); | ||||
|         d.readReal(28, &m_feedbackVolumeFactor, 1.0); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @ -55,6 +55,8 @@ struct FreeDVModSettings | ||||
|     QString m_title; | ||||
|     FreeDVModInputAF m_modAFInput; | ||||
|     QString m_audioDeviceName; | ||||
|     QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
 | ||||
|     float m_feedbackVolumeFactor; | ||||
|     FreeDVMode m_freeDVMode; | ||||
|     bool m_gaugeInputElseModem; //!< Volume gauge shows speech input level else modem level
 | ||||
| 
 | ||||
|  | ||||
| @ -60,6 +60,7 @@ NFMMod::NFMMod(DeviceAPI *deviceAPI) : | ||||
| 	m_inputFrequencyOffset(0), | ||||
| 	m_modPhasor(0.0f), | ||||
|     m_audioFifo(4800), | ||||
|     m_feedbackAudioFifo(4800), | ||||
| 	m_settingsMutex(QMutex::Recursive), | ||||
| 	m_fileSize(0), | ||||
| 	m_recordLength(0), | ||||
| @ -73,11 +74,17 @@ NFMMod::NFMMod(DeviceAPI *deviceAPI) : | ||||
| 	m_audioBuffer.resize(1<<14); | ||||
| 	m_audioBufferFill = 0; | ||||
| 
 | ||||
| 	m_feedbackAudioBuffer.resize(1<<14); | ||||
| 	m_feedbackAudioBufferFill = 0; | ||||
| 
 | ||||
| 	m_magsq = 0.0; | ||||
| 
 | ||||
| 	DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(&m_audioFifo, getInputMessageQueue()); | ||||
| 	m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate(); | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_feedbackAudioFifo, getInputMessageQueue()); | ||||
|     m_feedbackAudioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate(); | ||||
| 
 | ||||
|     m_lowpass.create(301, m_audioSampleRate, 250.0); | ||||
| 	m_toneNco.setFreq(1000.0, m_audioSampleRate); | ||||
| 	m_ctcssNco.setFreq(88.5, m_audioSampleRate); | ||||
| @ -100,6 +107,7 @@ NFMMod::~NFMMod() | ||||
| { | ||||
|     disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); | ||||
|     delete m_networkManager; | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_feedbackAudioFifo); | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo); | ||||
|     m_deviceAPI->removeChannelSourceAPI(this); | ||||
|     m_deviceAPI->removeChannelSource(m_threadedChannelizer); | ||||
|  | ||||
| @ -275,7 +275,6 @@ private: | ||||
|     int m_outputSampleRate; | ||||
|     int m_inputFrequencyOffset; | ||||
|     NFMModSettings m_settings; | ||||
|     quint32 m_audioSampleRate; | ||||
| 
 | ||||
|     NCO m_carrierNco; | ||||
|     NCOF m_toneNco; | ||||
| @ -292,10 +291,16 @@ private: | ||||
|     double m_magsq; | ||||
|     MovingAverageUtil<double, double, 16> m_movingAverage; | ||||
| 
 | ||||
|     quint32 m_audioSampleRate; | ||||
|     AudioVector m_audioBuffer; | ||||
|     uint m_audioBufferFill; | ||||
| 
 | ||||
|     AudioFifo m_audioFifo; | ||||
| 
 | ||||
|     quint32 m_feedbackAudioSampleRate; | ||||
|     AudioVector m_feedbackAudioBuffer; | ||||
|     uint m_feedbackAudioBufferFill; | ||||
|     AudioFifo m_feedbackAudioFifo; | ||||
| 
 | ||||
|     SampleVector m_sampleBuffer; | ||||
|     QMutex m_settingsMutex; | ||||
| 
 | ||||
|  | ||||
| @ -60,6 +60,8 @@ void NFMModSettings::resetToDefaults() | ||||
|     m_title = "NFM Modulator"; | ||||
|     m_modAFInput = NFMModInputAF::NFMModInputNone; | ||||
|     m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackVolumeFactor = 1.0f; | ||||
|     m_useReverseAPI = false; | ||||
|     m_reverseAPIAddress = "127.0.0.1"; | ||||
|     m_reverseAPIPort = 8888; | ||||
| @ -97,6 +99,8 @@ QByteArray NFMModSettings::serialize() const | ||||
|     s.writeU32(17, m_reverseAPIPort); | ||||
|     s.writeU32(18, m_reverseAPIDeviceIndex); | ||||
|     s.writeU32(19, m_reverseAPIChannelIndex); | ||||
|     s.writeString(20, m_feedbackAudioDeviceName); | ||||
|     s.writeReal(21, m_feedbackVolumeFactor); | ||||
| 
 | ||||
|     return s.final(); | ||||
| } | ||||
| @ -164,6 +168,8 @@ bool NFMModSettings::deserialize(const QByteArray& data) | ||||
|         m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readU32(19, &utmp, 0); | ||||
|         m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readString(20, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName); | ||||
|         d.readReal(21, &m_feedbackVolumeFactor, 1.0); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @ -51,7 +51,9 @@ struct NFMModSettings | ||||
|     quint32 m_rgbColor; | ||||
|     QString m_title; | ||||
|     NFMModInputAF m_modAFInput; | ||||
|     QString m_audioDeviceName; | ||||
|     QString m_audioDeviceName;         //!< This is the audio device you get the audio samples from
 | ||||
|     QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
 | ||||
|     float m_feedbackVolumeFactor; | ||||
|     bool m_useReverseAPI; | ||||
|     QString m_reverseAPIAddress; | ||||
|     uint16_t m_reverseAPIPort; | ||||
|  | ||||
| @ -66,6 +66,7 @@ SSBMod::SSBMod(DeviceAPI *deviceAPI) : | ||||
| 	m_DSBFilterBufferIndex(0), | ||||
|     m_sampleSink(0), | ||||
|     m_audioFifo(4800), | ||||
|     m_feedbackAudioFifo(4800), | ||||
| 	m_settingsMutex(QMutex::Recursive), | ||||
| 	m_fileSize(0), | ||||
| 	m_recordLength(0), | ||||
| @ -80,6 +81,9 @@ SSBMod::SSBMod(DeviceAPI *deviceAPI) : | ||||
| 	DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(&m_audioFifo, getInputMessageQueue()); | ||||
|     m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate(); | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_feedbackAudioFifo, getInputMessageQueue()); | ||||
|     m_feedbackAudioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate(); | ||||
| 
 | ||||
|     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
 | ||||
| @ -92,6 +96,9 @@ SSBMod::SSBMod(DeviceAPI *deviceAPI) : | ||||
| 	m_audioBuffer.resize(1<<14); | ||||
| 	m_audioBufferFill = 0; | ||||
| 
 | ||||
| 	m_feedbackAudioBuffer.resize(1<<14); | ||||
| 	m_feedbackAudioBufferFill = 0; | ||||
| 
 | ||||
|     m_sum.real(0.0f); | ||||
|     m_sum.imag(0.0f); | ||||
|     m_undersampleCount = 0; | ||||
| @ -130,6 +137,7 @@ SSBMod::~SSBMod() | ||||
|     disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); | ||||
|     delete m_networkManager; | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_feedbackAudioFifo); | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo); | ||||
| 
 | ||||
|     m_deviceAPI->removeChannelSourceAPI(this); | ||||
|  | ||||
| @ -278,7 +278,6 @@ private: | ||||
|     int m_outputSampleRate; | ||||
|     int m_inputFrequencyOffset; | ||||
|     SSBModSettings m_settings; | ||||
|     quint32 m_audioSampleRate; | ||||
| 
 | ||||
|     NCOF m_carrierNco; | ||||
|     NCOF m_toneNco; | ||||
| @ -305,10 +304,16 @@ private: | ||||
|     double m_magsq; | ||||
|     MovingAverageUtil<double, double, 16> m_movingAverage; | ||||
| 
 | ||||
|     quint32 m_audioSampleRate; | ||||
|     AudioVector m_audioBuffer; | ||||
|     uint m_audioBufferFill; | ||||
| 
 | ||||
|     AudioFifo m_audioFifo; | ||||
| 
 | ||||
|     quint32 m_feedbackAudioSampleRate; | ||||
|     AudioVector m_feedbackAudioBuffer; | ||||
|     uint m_feedbackAudioBufferFill; | ||||
|     AudioFifo m_feedbackAudioFifo; | ||||
| 
 | ||||
|     QMutex m_settingsMutex; | ||||
| 
 | ||||
|     std::ifstream m_ifstream; | ||||
|  | ||||
| @ -63,6 +63,8 @@ void SSBModSettings::resetToDefaults() | ||||
|     m_title = "SSB Modulator"; | ||||
|     m_modAFInput = SSBModInputAF::SSBModInputNone; | ||||
|     m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackVolumeFactor = 1.0f; | ||||
|     m_useReverseAPI = false; | ||||
|     m_reverseAPIAddress = "127.0.0.1"; | ||||
|     m_reverseAPIPort = 8888; | ||||
| @ -107,6 +109,8 @@ QByteArray SSBModSettings::serialize() const | ||||
|     s.writeU32(24, m_reverseAPIPort); | ||||
|     s.writeU32(25, m_reverseAPIDeviceIndex); | ||||
|     s.writeU32(26, m_reverseAPIChannelIndex); | ||||
|     s.writeString(27, m_feedbackAudioDeviceName); | ||||
|     s.writeReal(28, m_feedbackVolumeFactor); | ||||
| 
 | ||||
|     return s.final(); | ||||
| } | ||||
| @ -188,6 +192,8 @@ bool SSBModSettings::deserialize(const QByteArray& data) | ||||
|         m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readU32(26, &utmp, 0); | ||||
|         m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readString(27, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName); | ||||
|         d.readReal(28, &m_feedbackVolumeFactor, 1.0); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @ -55,7 +55,9 @@ struct SSBModSettings | ||||
| 
 | ||||
|     QString m_title; | ||||
|     SSBModInputAF m_modAFInput; | ||||
|     QString m_audioDeviceName; | ||||
|     QString m_audioDeviceName;         //!< This is the audio device you get the audio samples from
 | ||||
|     QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
 | ||||
|     float m_feedbackVolumeFactor; | ||||
| 
 | ||||
|     bool m_useReverseAPI; | ||||
|     QString m_reverseAPIAddress; | ||||
|  | ||||
| @ -60,6 +60,7 @@ WFMMod::WFMMod(DeviceAPI *deviceAPI) : | ||||
|     m_inputFrequencyOffset(0), | ||||
| 	m_modPhasor(0.0f), | ||||
|     m_audioFifo(4800), | ||||
|     m_feedbackAudioFifo(4800), | ||||
| 	m_settingsMutex(QMutex::Recursive), | ||||
|     m_fileSize(0), | ||||
| 	m_recordLength(0), | ||||
| @ -79,11 +80,17 @@ WFMMod::WFMMod(DeviceAPI *deviceAPI) : | ||||
| 	m_audioBuffer.resize(1<<14); | ||||
| 	m_audioBufferFill = 0; | ||||
| 
 | ||||
| 	m_feedbackAudioBuffer.resize(1<<14); | ||||
| 	m_feedbackAudioBufferFill = 0; | ||||
| 
 | ||||
| 	m_magsq = 0.0; | ||||
| 
 | ||||
| 	DSPEngine::instance()->getAudioDeviceManager()->addAudioSource(&m_audioFifo, getInputMessageQueue()); | ||||
|     m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate(); | ||||
| 
 | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_feedbackAudioFifo, getInputMessageQueue()); | ||||
|     m_feedbackAudioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate(); | ||||
| 
 | ||||
| 	m_toneNcoRF.setFreq(1000.0, m_outputSampleRate); | ||||
|     m_cwKeyer.setSampleRate(m_outputSampleRate); | ||||
|     m_cwKeyer.reset(); | ||||
| @ -104,6 +111,7 @@ WFMMod::~WFMMod() | ||||
| { | ||||
|     disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); | ||||
|     delete m_networkManager; | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSink(&m_feedbackAudioFifo); | ||||
|     DSPEngine::instance()->getAudioDeviceManager()->removeAudioSource(&m_audioFifo); | ||||
|     m_deviceAPI->removeChannelSourceAPI(this); | ||||
|     m_deviceAPI->removeChannelSource(m_threadedChannelizer); | ||||
|  | ||||
| @ -274,7 +274,6 @@ private: | ||||
|     int m_outputSampleRate; | ||||
|     int m_inputFrequencyOffset; | ||||
|     WFMModSettings m_settings; | ||||
|     quint32 m_audioSampleRate; | ||||
| 
 | ||||
|     NCO m_carrierNco; | ||||
|     NCOF m_toneNcoRF; | ||||
| @ -293,10 +292,16 @@ private: | ||||
|     double m_magsq; | ||||
|     MovingAverageUtil<double, double, 16> m_movingAverage; | ||||
| 
 | ||||
|     quint32 m_audioSampleRate; | ||||
|     AudioVector m_audioBuffer; | ||||
|     uint m_audioBufferFill; | ||||
| 
 | ||||
|     AudioFifo m_audioFifo; | ||||
| 
 | ||||
|     quint32 m_feedbackAudioSampleRate; | ||||
|     AudioVector m_feedbackAudioBuffer; | ||||
|     uint m_feedbackAudioBufferFill; | ||||
|     AudioFifo m_feedbackAudioFifo; | ||||
| 
 | ||||
|     SampleVector m_sampleBuffer; | ||||
|     QMutex m_settingsMutex; | ||||
| 
 | ||||
|  | ||||
| @ -50,6 +50,8 @@ void WFMModSettings::resetToDefaults() | ||||
|     m_title = "WFM Modulator"; | ||||
|     m_modAFInput = WFMModInputNone; | ||||
|     m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackAudioDeviceName = AudioDeviceManager::m_defaultDeviceName; | ||||
|     m_feedbackVolumeFactor = 1.0f; | ||||
|     m_useReverseAPI = false; | ||||
|     m_reverseAPIAddress = "127.0.0.1"; | ||||
|     m_reverseAPIPort = 8888; | ||||
| @ -85,6 +87,8 @@ QByteArray WFMModSettings::serialize() const | ||||
|     s.writeU32(15, m_reverseAPIPort); | ||||
|     s.writeU32(16, m_reverseAPIDeviceIndex); | ||||
|     s.writeU32(17, m_reverseAPIChannelIndex); | ||||
|     s.writeString(18, m_feedbackAudioDeviceName); | ||||
|     s.writeReal(19, m_feedbackVolumeFactor); | ||||
| 
 | ||||
|     return s.final(); | ||||
| } | ||||
| @ -148,6 +152,8 @@ bool WFMModSettings::deserialize(const QByteArray& data) | ||||
|         m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readU32(17, &utmp, 0); | ||||
|         m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; | ||||
|         d.readString(18, &m_feedbackAudioDeviceName, AudioDeviceManager::m_defaultDeviceName); | ||||
|         d.readReal(19, &m_feedbackVolumeFactor, 1.0); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| @ -47,7 +47,9 @@ struct WFMModSettings | ||||
|     quint32 m_rgbColor; | ||||
|     QString m_title; | ||||
|     WFMModInputAF m_modAFInput; | ||||
|     QString m_audioDeviceName; | ||||
|     QString m_audioDeviceName;         //!< This is the audio device you get the audio samples from
 | ||||
|     QString m_feedbackAudioDeviceName; //!< This is the audio device you send the audio samples to for audio feedback
 | ||||
|     float m_feedbackVolumeFactor; | ||||
|     bool m_useReverseAPI; | ||||
|     QString m_reverseAPIAddress; | ||||
|     uint16_t m_reverseAPIPort; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user