mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	Renamed sdrbase AudioInput to AudioInputDevice
This commit is contained in:
		
							parent
							
								
									0d6e629436
								
							
						
					
					
						commit
						00b234b85c
					
				| @ -33,10 +33,8 @@ | ||||
| #include "audioinput.h" | ||||
| #include "audioinputthread.h" | ||||
| 
 | ||||
| MESSAGE_CLASS_DEFINITION(AudioInputSource::AudioInput::MsgConfigureAudioInput, Message) | ||||
| MESSAGE_CLASS_DEFINITION(AudioInputSource::AudioInput::MsgStartStop, Message) | ||||
| 
 | ||||
| namespace AudioInputSource { | ||||
| MESSAGE_CLASS_DEFINITION(AudioInput::MsgConfigureAudioInput, Message) | ||||
| MESSAGE_CLASS_DEFINITION(AudioInput::MsgStartStop, Message) | ||||
| 
 | ||||
| AudioInput::AudioInput(DeviceAPI *deviceAPI) : | ||||
|     m_deviceAPI(deviceAPI), | ||||
| @ -521,5 +519,3 @@ void AudioInput::networkManagerFinished(QNetworkReply *reply) | ||||
| 
 | ||||
|     reply->deleteLater(); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -26,7 +26,7 @@ | ||||
| #include <QNetworkRequest> | ||||
| 
 | ||||
| #include "dsp/devicesamplesource.h" | ||||
| #include "audio/audioinput.h" | ||||
| #include "audio/audioinputdevice.h" | ||||
| #include "audio/audiofifo.h" | ||||
| 
 | ||||
| #include "audioinputsettings.h" | ||||
| @ -36,9 +36,6 @@ class QNetworkReply; | ||||
| class DeviceAPI; | ||||
| class AudioInputThread; | ||||
| 
 | ||||
| // AudioInput is used in sdrbase/audio/audioinput.h
 | ||||
| namespace AudioInputSource { | ||||
| 
 | ||||
| class AudioInput : public DeviceSampleSource { | ||||
|     Q_OBJECT | ||||
| public: | ||||
| @ -134,7 +131,7 @@ public: | ||||
| 
 | ||||
| private: | ||||
|     DeviceAPI *m_deviceAPI; | ||||
|     ::AudioInput m_audioInput; | ||||
|     AudioInputDevice m_audioInput; | ||||
|     AudioFifo m_fifo; | ||||
|     QMutex m_mutex; | ||||
|     AudioInputSettings m_settings; | ||||
| @ -156,6 +153,4 @@ private slots: | ||||
|     void networkManagerFinished(QNetworkReply *reply); | ||||
| }; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // INCLUDE_AUDIOINPUT_H
 | ||||
|  | ||||
| @ -39,7 +39,7 @@ AudioInputGui::AudioInputGui(DeviceUISet *deviceUISet, QWidget* parent) : | ||||
|     m_settings(), | ||||
|     m_sampleSource(NULL) | ||||
| { | ||||
|     m_sampleSource = (AudioInputSource::AudioInput*) m_deviceUISet->m_deviceAPI->getSampleSource(); | ||||
|     m_sampleSource = (AudioInput*) m_deviceUISet->m_deviceAPI->getSampleSource(); | ||||
| 
 | ||||
|     ui->setupUi(this); | ||||
| 
 | ||||
| @ -94,18 +94,18 @@ bool AudioInputGui::deserialize(const QByteArray& data) | ||||
| 
 | ||||
| bool AudioInputGui::handleMessage(const Message& message) | ||||
| { | ||||
|     if (AudioInputSource::AudioInput::MsgConfigureAudioInput::match(message)) | ||||
|     if (AudioInput::MsgConfigureAudioInput::match(message)) | ||||
|     { | ||||
|         const AudioInputSource::AudioInput::MsgConfigureAudioInput& cfg = (AudioInputSource::AudioInput::MsgConfigureAudioInput&) message; | ||||
|         const AudioInput::MsgConfigureAudioInput& cfg = (AudioInput::MsgConfigureAudioInput&) message; | ||||
|         m_settings = cfg.getSettings(); | ||||
|         blockApplySettings(true); | ||||
|         displaySettings(); | ||||
|         blockApplySettings(false); | ||||
|         return true; | ||||
|     } | ||||
|     else if (AudioInputSource::AudioInput::MsgStartStop::match(message)) | ||||
|     else if (AudioInput::MsgStartStop::match(message)) | ||||
|     { | ||||
|         AudioInputSource::AudioInput::MsgStartStop& notif = (AudioInputSource::AudioInput::MsgStartStop&) message; | ||||
|         AudioInput::MsgStartStop& notif = (AudioInput::MsgStartStop&) message; | ||||
|         blockApplySettings(true); | ||||
|         ui->startStop->setChecked(notif.getStartStop()); | ||||
|         blockApplySettings(false); | ||||
| @ -262,7 +262,7 @@ void AudioInputGui::on_startStop_toggled(bool checked) | ||||
| { | ||||
|     if (m_doApplySettings) | ||||
|     { | ||||
|         AudioInputSource::AudioInput::MsgStartStop *message = AudioInputSource::AudioInput::MsgStartStop::create(checked); | ||||
|         AudioInput::MsgStartStop *message = AudioInput::MsgStartStop::create(checked); | ||||
|         m_sampleSource->getInputMessageQueue()->push(message); | ||||
|     } | ||||
| } | ||||
| @ -277,7 +277,7 @@ void AudioInputGui::updateHardware() | ||||
| { | ||||
|     if (m_doApplySettings) | ||||
|     { | ||||
|         AudioInputSource::AudioInput::MsgConfigureAudioInput* message = AudioInputSource::AudioInput::MsgConfigureAudioInput::create(m_settings, m_forceSettings); | ||||
|         AudioInput::MsgConfigureAudioInput* message = AudioInput::MsgConfigureAudioInput::create(m_settings, m_forceSettings); | ||||
|         m_sampleSource->getInputMessageQueue()->push(message); | ||||
|         m_forceSettings = false; | ||||
|         m_updateTimer.stop(); | ||||
|  | ||||
| @ -31,7 +31,7 @@ | ||||
| const PluginDescriptor AudioInputPlugin::m_pluginDescriptor = { | ||||
|     QString("AudioInput"), | ||||
|     QString("Audio Input"), | ||||
|     QString("4.22.0"), | ||||
|     QString("6.0.0"), | ||||
|     QString("(c) Jon Beniston, M7RCE and Edouard Griffiths, F4EXB"), | ||||
|     QString("https://github.com/f4exb/sdrangel"), | ||||
|     true, | ||||
| @ -136,7 +136,7 @@ DeviceSampleSource *AudioInputPlugin::createSampleSourcePluginInstance(const QSt | ||||
| { | ||||
|     if (sourceId == m_deviceTypeID) | ||||
|     { | ||||
|         AudioInputSource::AudioInput* input = new AudioInputSource::AudioInput(deviceAPI); | ||||
|         AudioInput* input = new AudioInput(deviceAPI); | ||||
|         return input; | ||||
|     } | ||||
|     else | ||||
|  | ||||
| @ -33,7 +33,7 @@ int AudioInputWebAPIAdapter::webapiSettingsGet( | ||||
|     (void) errorMessage; | ||||
|     response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings()); | ||||
|     response.getAirspyHfSettings()->init(); | ||||
|     AudioInputSource::AudioInput::webapiFormatDeviceSettings(response, m_settings); | ||||
|     AudioInput::webapiFormatDeviceSettings(response, m_settings); | ||||
|     return 200; | ||||
| } | ||||
| 
 | ||||
| @ -44,6 +44,6 @@ int AudioInputWebAPIAdapter::webapiSettingsPutPatch( | ||||
|         QString& errorMessage) | ||||
| { | ||||
|     (void) errorMessage; | ||||
|     AudioInputSource::AudioInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response); | ||||
|     AudioInput::webapiUpdateDeviceSettings(m_settings, deviceSettingsKeys, response); | ||||
|     return 200; | ||||
| } | ||||
|  | ||||
| @ -25,7 +25,7 @@ | ||||
| #include <QNetworkRequest> | ||||
| 
 | ||||
| #include "dsp/devicesamplesource.h" | ||||
| #include "audio/audioinput.h" | ||||
| #include "audio/audioinputdevice.h" | ||||
| #include "audio/audiofifo.h" | ||||
| 
 | ||||
| #include "fcdprosettings.h" | ||||
| @ -156,7 +156,7 @@ public: | ||||
| private: | ||||
| 	DeviceAPI *m_deviceAPI; | ||||
| 	hid_device *m_dev; | ||||
|     AudioInput m_fcdAudioInput; | ||||
|     AudioInputDevice m_fcdAudioInput; | ||||
|     AudioFifo m_fcdFIFO; | ||||
| 	QMutex m_mutex; | ||||
| 	FCDProSettings m_settings; | ||||
|  | ||||
| @ -25,7 +25,7 @@ | ||||
| #include <QNetworkRequest> | ||||
| 
 | ||||
| #include "dsp/devicesamplesource.h" | ||||
| #include "audio/audioinput.h" | ||||
| #include "audio/audioinputdevice.h" | ||||
| #include "audio/audiofifo.h" | ||||
| 
 | ||||
| #include "fcdproplussettings.h" | ||||
| @ -145,7 +145,7 @@ public: | ||||
| private: | ||||
| 	DeviceAPI *m_deviceAPI; | ||||
| 	hid_device *m_dev; | ||||
| 	AudioInput m_fcdAudioInput; | ||||
| 	AudioInputDevice m_fcdAudioInput; | ||||
| 	AudioFifo m_fcdFIFO; | ||||
| 	QMutex m_mutex; | ||||
| 	FCDProPlusSettings m_settings; | ||||
|  | ||||
| @ -76,7 +76,7 @@ set(sdrbase_SOURCES | ||||
|     audio/audiog722.cpp | ||||
|     audio/audioopus.cpp | ||||
|     audio/audiooutput.cpp | ||||
|     audio/audioinput.cpp | ||||
|     audio/audioinputdevice.cpp | ||||
|     audio/audionetsink.cpp | ||||
|     audio/audioresampler.cpp | ||||
| 
 | ||||
| @ -216,7 +216,7 @@ set(sdrbase_HEADERS | ||||
|     audio/audiog722.h | ||||
|     audio/audiooutput.h | ||||
|     audio/audioopus.h | ||||
|     audio/audioinput.h | ||||
|     audio/audioinputdevice.h | ||||
|     audio/audionetsink.h | ||||
|     audio/audioresampler.h | ||||
| 
 | ||||
|  | ||||
| @ -312,7 +312,7 @@ void AudioDeviceManager::addAudioSource(AudioFifo* audioFifo, MessageQueue *samp | ||||
|     qDebug("AudioDeviceManager::addAudioSource: %d: %p", inputDeviceIndex, audioFifo); | ||||
| 
 | ||||
|     if (m_audioInputs.find(inputDeviceIndex) == m_audioInputs.end()) { | ||||
|         m_audioInputs[inputDeviceIndex] = new AudioInput(); | ||||
|         m_audioInputs[inputDeviceIndex] = new AudioInputDevice(); | ||||
|     } | ||||
| 
 | ||||
|     if ((m_audioInputs[inputDeviceIndex]->getNbFifos() == 0) && | ||||
| @ -570,7 +570,7 @@ void AudioDeviceManager::setInputDeviceInfo(int inputDeviceIndex, const InputDev | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     AudioInput *audioInput = m_audioInputs[inputDeviceIndex]; | ||||
|     AudioInputDevice *audioInput = m_audioInputs[inputDeviceIndex]; | ||||
| 
 | ||||
|     if (oldDeviceInfo.sampleRate != deviceInfo.sampleRate) | ||||
|     { | ||||
|  | ||||
| @ -24,7 +24,7 @@ | ||||
| #include <QMap> | ||||
| #include <QAudioDeviceInfo> | ||||
| 
 | ||||
| #include "audio/audioinput.h" | ||||
| #include "audio/audioinputdevice.h" | ||||
| #include "audio/audiooutput.h" | ||||
| #include "export.h" | ||||
| 
 | ||||
| @ -133,7 +133,7 @@ private: | ||||
|     QMap<AudioFifo*, int> m_audioSourceFifos; //< audio source FIFO to audio input device index-1 map
 | ||||
|     QMap<AudioFifo*, MessageQueue*> m_audioFifoToSourceMessageQueues; //!< audio source FIFO to attached source message queue
 | ||||
|     QMap<int, QList<MessageQueue*> > m_inputDeviceSourceMessageQueues; //!< sink message queues attached to device
 | ||||
|     QMap<int, AudioInput*> m_audioInputs; //!< audio device index to audio input map (index -1 is default device)
 | ||||
|     QMap<int, AudioInputDevice*> m_audioInputs; //!< audio device index to audio input map (index -1 is default device)
 | ||||
|     QMap<QString, InputDeviceInfo> m_audioInputInfos; //!< audio device name to audio input device info
 | ||||
| 
 | ||||
|     bool m_defaultOutputStarted; //!< True if the default audio output (-1) has already been started
 | ||||
|  | ||||
| @ -19,10 +19,10 @@ | ||||
| #include <QAudioFormat> | ||||
| #include <QAudioDeviceInfo> | ||||
| #include <QAudioInput> | ||||
| #include "audio/audioinput.h" | ||||
| #include "audio/audioinputdevice.h" | ||||
| #include "audio/audiofifo.h" | ||||
| 
 | ||||
| AudioInput::AudioInput() : | ||||
| AudioInputDevice::AudioInputDevice() : | ||||
| 	m_mutex(QMutex::Recursive), | ||||
| 	m_audioInput(0), | ||||
| 	m_audioUsageCount(0), | ||||
| @ -32,7 +32,7 @@ AudioInput::AudioInput() : | ||||
| { | ||||
| } | ||||
| 
 | ||||
| AudioInput::~AudioInput() | ||||
| AudioInputDevice::~AudioInputDevice() | ||||
| { | ||||
| 	stop(); | ||||
| 
 | ||||
| @ -46,7 +46,7 @@ AudioInput::~AudioInput() | ||||
| 	m_audioFifos.clear(); | ||||
| } | ||||
| 
 | ||||
| bool AudioInput::start(int device, int rate) | ||||
| bool AudioInputDevice::start(int device, int rate) | ||||
| { | ||||
| 	if (m_audioUsageCount == 0) | ||||
| 	{ | ||||
| @ -56,7 +56,7 @@ bool AudioInput::start(int device, int rate) | ||||
|         if (device < 0) | ||||
|         { | ||||
|             devInfo = QAudioDeviceInfo::defaultInputDevice(); | ||||
|             qWarning("AudioInput::start: using default device %s", qPrintable(devInfo.defaultInputDevice().deviceName())); | ||||
|             qWarning("AudioInputDevice::start: using default device %s", qPrintable(devInfo.defaultInputDevice().deviceName())); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
| @ -65,12 +65,12 @@ bool AudioInput::start(int device, int rate) | ||||
|             if (device < devicesInfo.size()) | ||||
|             { | ||||
|                 devInfo = devicesInfo[device]; | ||||
|                 qWarning("AudioInput::start: using audio device #%d: %s", device, qPrintable(devInfo.deviceName())); | ||||
|                 qWarning("AudioInputDevice::start: using audio device #%d: %s", device, qPrintable(devInfo.deviceName())); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 devInfo = QAudioDeviceInfo::defaultInputDevice(); | ||||
|                 qWarning("AudioInput::start: audio device #%d does not exist. Using default device %s", device, qPrintable(devInfo.deviceName())); | ||||
|                 qWarning("AudioInputDevice::start: audio device #%d does not exist. Using default device %s", device, qPrintable(devInfo.deviceName())); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| @ -86,17 +86,17 @@ bool AudioInput::start(int device, int rate) | ||||
|         if (!devInfo.isFormatSupported(m_audioFormat)) | ||||
|         { | ||||
|             m_audioFormat = devInfo.nearestFormat(m_audioFormat); | ||||
|             qWarning("AudioInput::start: %d Hz S16_LE audio format not supported. Nearest is sampleRate: %d channelCount: %d sampleSize: %d sampleType: %d", | ||||
|             qWarning("AudioInputDevice::start: %d Hz S16_LE audio format not supported. Nearest is sampleRate: %d channelCount: %d sampleSize: %d sampleType: %d", | ||||
|                     rate, m_audioFormat.sampleRate(), m_audioFormat.channelCount(), m_audioFormat.sampleSize(), (int) m_audioFormat.sampleType()); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             qInfo("AudioInput::start: audio format OK"); | ||||
|             qInfo("AudioInputDevice::start: audio format OK"); | ||||
|         } | ||||
| 
 | ||||
|         if (m_audioFormat.sampleSize() != 16) | ||||
|         { | ||||
|             qWarning("AudioInput::start: Audio device '%s' failed", qPrintable(devInfo.defaultInputDevice().deviceName())); | ||||
|             qWarning("AudioInputDevice::start: Audio device '%s' failed", qPrintable(devInfo.defaultInputDevice().deviceName())); | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
| @ -109,7 +109,7 @@ bool AudioInput::start(int device, int rate) | ||||
| 
 | ||||
|         if (m_audioInput->state() != QAudio::ActiveState) | ||||
|         { | ||||
|             qWarning("AudioInput::start: cannot start"); | ||||
|             qWarning("AudioInputDevice::start: cannot start"); | ||||
|         } | ||||
| 	} | ||||
| 
 | ||||
| @ -118,9 +118,9 @@ bool AudioInput::start(int device, int rate) | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| void AudioInput::stop() | ||||
| void AudioInputDevice::stop() | ||||
| { | ||||
|     qDebug("AudioInput::stop"); | ||||
|     qDebug("AudioInputDevice::stop"); | ||||
| 
 | ||||
|     if (m_audioUsageCount > 0) | ||||
|     { | ||||
| @ -128,7 +128,7 @@ void AudioInput::stop() | ||||
| 
 | ||||
|         if (m_audioUsageCount == 0) | ||||
|         { | ||||
|             qDebug("AudioInput::stop: effectively close QIODevice"); | ||||
|             qDebug("AudioInputDevice::stop: effectively close QIODevice"); | ||||
|             QMutexLocker mutexLocker(&m_mutex); | ||||
|             QIODevice::close(); | ||||
| 
 | ||||
| @ -139,28 +139,28 @@ void AudioInput::stop() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void AudioInput::addFifo(AudioFifo* audioFifo) | ||||
| void AudioInputDevice::addFifo(AudioFifo* audioFifo) | ||||
| { | ||||
| 	QMutexLocker mutexLocker(&m_mutex); | ||||
| 
 | ||||
| 	m_audioFifos.push_back(audioFifo); | ||||
| } | ||||
| 
 | ||||
| void AudioInput::removeFifo(AudioFifo* audioFifo) | ||||
| void AudioInputDevice::removeFifo(AudioFifo* audioFifo) | ||||
| { | ||||
| 	QMutexLocker mutexLocker(&m_mutex); | ||||
| 
 | ||||
| 	m_audioFifos.remove(audioFifo); | ||||
| } | ||||
| 
 | ||||
| qint64 AudioInput::readData(char* data, qint64 maxLen) | ||||
| qint64 AudioInputDevice::readData(char* data, qint64 maxLen) | ||||
| { | ||||
| 	Q_UNUSED(data); | ||||
| 	Q_UNUSED(maxLen); | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| qint64 AudioInput::writeData(const char *data, qint64 len) | ||||
| qint64 AudioInputDevice::writeData(const char *data, qint64 len) | ||||
| { | ||||
|     // Study this mutex on OSX, for now deadlocks possible
 | ||||
|     // Removed as it may indeed cause lockups and is in fact useless.
 | ||||
| @ -172,12 +172,12 @@ qint64 AudioInput::writeData(const char *data, qint64 len) | ||||
|     		|| (m_audioFormat.sampleType() != QAudioFormat::SignedInt) | ||||
| 			|| (m_audioFormat.byteOrder() != QAudioFormat::LittleEndian)) | ||||
|     { | ||||
|     	qCritical("AudioInput::writeData: invalid format not S16LE"); | ||||
|     	qCritical("AudioInputDevice::writeData: invalid format not S16LE"); | ||||
|     	return 0; | ||||
|     } | ||||
| 
 | ||||
|     if (m_audioFormat.channelCount() != 2) { | ||||
|     	qCritical("AudioInput::writeData: invalid format not stereo"); | ||||
|     	qCritical("AudioInputDevice::writeData: invalid format not stereo"); | ||||
|     	return 0; | ||||
|     } | ||||
| 
 | ||||
| @ -189,7 +189,7 @@ qint64 AudioInput::writeData(const char *data, qint64 len) | ||||
| 	return len; | ||||
| } | ||||
| 
 | ||||
| void AudioInput::setVolume(float volume) | ||||
| void AudioInputDevice::setVolume(float volume) | ||||
| { | ||||
|     m_volume = volume; | ||||
|     if (m_audioInput != nullptr) | ||||
| @ -15,8 +15,8 @@ | ||||
| // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | ||||
| ///////////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| #ifndef SDRBASE_AUDIO_AUDIOINPUT_H_ | ||||
| #define SDRBASE_AUDIO_AUDIOINPUT_H_ | ||||
| #ifndef SDRBASE_AUDIO_AUDIOINPUTDEVICE_H_ | ||||
| #define SDRBASE_AUDIO_AUDIOINPUTDEVICE_H_ | ||||
| 
 | ||||
| #include <QMutex> | ||||
| #include <QIODevice> | ||||
| @ -30,10 +30,10 @@ class AudioFifo; | ||||
| class AudioOutputPipe; | ||||
| 
 | ||||
| 
 | ||||
| class SDRBASE_API AudioInput : public QIODevice { | ||||
| class SDRBASE_API AudioInputDevice : public QIODevice { | ||||
| public: | ||||
| 	AudioInput(); | ||||
| 	virtual ~AudioInput(); | ||||
| 	AudioInputDevice(); | ||||
| 	virtual ~AudioInputDevice(); | ||||
| 
 | ||||
| 	bool start(int device, int rate); | ||||
| 	void stop(); | ||||
| @ -67,4 +67,4 @@ private: | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #endif /* SDRBASE_AUDIO_AUDIOINPUT_H_ */ | ||||
| #endif /* SDRBASE_AUDIO_AUDIOINPUTDEVICE_H_ */ | ||||
| @ -25,7 +25,6 @@ | ||||
| 
 | ||||
| #include "audio/audiodevicemanager.h" | ||||
| #include "audio/audiooutput.h" | ||||
| #include "audio/audioinput.h" | ||||
| #include "export.h" | ||||
| #include "ambe/ambeengine.h" | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user