mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 21:40:52 -05:00 
			
		
		
		
	Changes for 48000 Hz Audio in samplerate
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3577 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									b1378a3a86
								
							
						
					
					
						commit
						f35913f34c
					
				
							
								
								
									
										15
									
								
								Detector.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								Detector.cpp
									
									
									
									
									
								
							@ -6,6 +6,10 @@
 | 
			
		||||
 | 
			
		||||
#include "commons.h"
 | 
			
		||||
 | 
			
		||||
extern "C" {
 | 
			
		||||
void   fil4_(qint16*, qint32*, qint16*, qint32*);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds, unsigned framesPerSignal, QObject * parent)
 | 
			
		||||
  : AudioDevice (parent)
 | 
			
		||||
  , m_frameRate (frameRate)
 | 
			
		||||
@ -31,8 +35,8 @@ void Detector::clear ()
 | 
			
		||||
  // jt9com_.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0])));
 | 
			
		||||
  jt9com_.kin = 0;
 | 
			
		||||
 | 
			
		||||
  // fill buffer with zeros (G4WJS commented out because it might cause decoder hangs)
 | 
			
		||||
  // qFill (jt9com_.d2, jt9com_.d2 + sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]), 0);
 | 
			
		||||
  // fill buffer with zeros
 | 
			
		||||
  qFill (jt9com_.d2, jt9com_.d2 + sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]), 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
qint64 Detector::writeData (char const * data, qint64 maxSize)
 | 
			
		||||
@ -49,10 +53,13 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
 | 
			
		||||
	  qDebug () << "dropped " << maxSize / sizeof (jt9com_.d2[0]) - framesAccepted << " frames of data on the floor!";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      store (data, framesAccepted, &jt9com_.d2[jt9com_.kin]);
 | 
			
		||||
      qint32 m_n1,m_n2;
 | 
			
		||||
      m_n1 = framesAccepted;
 | 
			
		||||
      fil4_((qint16 *)data, &m_n1, m_translate, &m_n2);
 | 
			
		||||
      store ((char const *) m_translate, m_n2, &jt9com_.d2[jt9com_.kin]);
 | 
			
		||||
 | 
			
		||||
      unsigned lastSignalIndex (jt9com_.kin / m_framesPerSignal);
 | 
			
		||||
      jt9com_.kin += framesAccepted;
 | 
			
		||||
      jt9com_.kin += m_n2;
 | 
			
		||||
      unsigned currentSignalIndex (jt9com_.kin / m_framesPerSignal);
 | 
			
		||||
 | 
			
		||||
      if (currentSignalIndex != lastSignalIndex && m_monitoring)
 | 
			
		||||
 | 
			
		||||
@ -49,6 +49,7 @@ private:
 | 
			
		||||
  unsigned m_framesPerSignal;
 | 
			
		||||
  bool volatile m_monitoring;
 | 
			
		||||
  bool m_starting;
 | 
			
		||||
  qint16 m_translate[20000];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -48,7 +48,7 @@ void SoundInput::start(QAudioDeviceInfo const& device, unsigned channels, int fr
 | 
			
		||||
  QAudioFormat format (device.preferredFormat());
 | 
			
		||||
  format.setChannelCount (channels);
 | 
			
		||||
  format.setCodec ("audio/pcm");
 | 
			
		||||
  format.setSampleRate (12000);
 | 
			
		||||
  format.setSampleRate (48000);
 | 
			
		||||
  format.setSampleType (QAudioFormat::SignedInt);
 | 
			
		||||
  format.setSampleSize (16);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user