mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
[AFV] First version of threaded CAfvClient
This commit is contained in:
committed by
Mat Sutcliffe
parent
d1006160f8
commit
d3a1eb1d60
@@ -36,32 +36,23 @@ namespace BlackSound
|
||||
{
|
||||
if (m_data->fileName.isEmpty()) { return false; }
|
||||
|
||||
QObject *parent = QCoreApplication::instance();
|
||||
Q_ASSERT(parent);
|
||||
CWorker *worker = CWorker::fromTask(parent, "loadResourceSound", [this]()
|
||||
CWavFile wavFile;
|
||||
m_data->samples.clear();
|
||||
if (wavFile.open(m_data->fileName))
|
||||
{
|
||||
CWavFile wavFile;
|
||||
|
||||
m_data->samples.clear();
|
||||
if (wavFile.open(m_data->fileName))
|
||||
if (wavFile.fileFormat().sampleType() == QAudioFormat::Float)
|
||||
{
|
||||
if (wavFile.fileFormat().sampleType() == QAudioFormat::Float)
|
||||
{
|
||||
// Not implemented
|
||||
// m_samples = convertFloatBytesTo16BitPCM(wavFile.audioData());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data->samples = convertBytesTo32BitFloatPCM(wavFile.audioData());
|
||||
}
|
||||
// Not implemented
|
||||
// m_samples = convertFloatBytesTo16BitPCM(wavFile.audioData());
|
||||
}
|
||||
});
|
||||
worker->then([this]()
|
||||
{
|
||||
m_data->isLoaded = true;
|
||||
});
|
||||
else
|
||||
{
|
||||
m_data->samples = convertBytesTo32BitFloatPCM(wavFile.audioData());
|
||||
}
|
||||
}
|
||||
|
||||
return worker ? true : false;
|
||||
m_data->isLoaded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CResourceSound::isSameFileName(const QString &fn) const
|
||||
|
||||
Reference in New Issue
Block a user