91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 46KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-08
  • 語言: 其他
  • 標簽: Qt??音頻??

資源簡介

實時錄音與播放的內存實現 Qt代碼。下載前請先閱讀http://blog.csdn.net/kakadiablo/article/details/7561509#comments

資源截圖

代碼片段和文件信息

#include?“bufferInheritedfromQIODevice.h“

const?qint64?BufferDurationUs???????=?10?*?1000000;??//?10second

Generator::Generator(QByteArray?buffer)
{
????m_GeneratorBuffer?=?buffer;
????m_pos=0;
}

Generator::~Generator()
{
}

void?Generator::start()
{
????open(QIODevice::ReadOnly);
}

void?Generator::stop()
{
????m_pos?=?0;
????close();
}


qint64?Generator::readData(char?*data?qint64?len)
{
????qDebug()?<????qint64?total?=?0;
????while?(len?-?total?>?0)?{
????????const?qint64?chunk?=?qMin((m_GeneratorBuffer.size()?-?m_pos)?len?-?total);
????????memcpy(data?+?total?m_GeneratorBuffer.constData()?+?m_pos?chunk);
????????m_pos?=?(m_pos?+?chunk)?%?m_GeneratorBuffer.size();
????????total?+=?chunk;
????????qDebug()?<????}
????return?total;
}

qint64?Generator::writeData(const?char?*data?qint64?len)
{
????Q_UNUSED(data);
????Q_UNUSED(len);

????return?0;
}

qint64?Generator::bytesAvailable()?const
{
????return?m_GeneratorBuffer.size()?+?QIODevice::bytesAvailable();
}

void?bufferPlayback::startPlayback()
{
????if?(m_audioOutput)?{
????????m_mode?=?QAudio::AudioOutput;
????????m_dataLengthPlay?=?0;
????????m_generator->start();
????????m_audioOutput->start(m_generator);
????}
}

bufferPlayback::bufferPlayback()
????:???m_mode(QAudio::AudioInput)
???????m_audioInput(0)
???????m_audioInputDevice(QAudioDeviceInfo::defaultInputDevice())
???????m_audioInputIODevice(0)
???????m_audioOutputDevice(QAudioDeviceInfo::defaultOutputDevice())
???????m_audioOutput(0)
???????m_bufferLength(0)
???????m_dataLengthPlay(0)
???????m_dataLengthRecord(0)
{
????selectFormat();
????initialize();
????QList?inputDevices?=?QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
????m_audioInputDevice?=?inputDevices.at(0);
????QList?outputDevices?=?QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
????m_audioOutputDevice?=?outputDevices.at(0);
????QTimer::singleShot(3000?reinterpret_castject*>(this)?SLOT(startPlayback()));
????startRecording();
????qDebug()?<????qDebug()?<
}

bufferPlayback::~bufferPlayback()
{
????delete?m_audioInput;
????delete?m_audioOutput;
????delete?m_generator;
}

qint64?bufferPlayback::audioLength(const?QAudioFormat?&format?qint64?microSeconds)
{
????qint64?result?=?(format.frequency()?*?format.channels()?*?(format.sampleSize()?/?8))
????????????*?microSeconds?/?1000000;
????result?-=?result?%?(format.channelCount()?*?format.sampleSize());
????return?result;
}

qint64?bufferPlayback::bufferLength()?const
{
????return?m_bufferLength;
}

void?bufferPlayback::initialize()
{
????m_bufferLength?=?audioLength(format?BufferDurationUs);
????m_buffer.resize(m_bufferLength);
????m_buffer.fill(0);
????m_audioInput?=?new?QAudioInput(m_audioInputD

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????417??2012-05-08?15:44??3?methods\bufferCircularPlaybackInheritedFromQIODevice\bufferCircularPlaybackInheritedFromQIODevice.pro

?????文件??????46208??2012-07-02?23:33??3?methods\bufferCircularPlaybackInheritedFromQIODevice\bufferCircularPlaybackInheritedFromQIODevice.pro.user

?????文件???????5738??2012-05-13?01:40??3?methods\bufferCircularPlaybackInheritedFromQIODevice\bufferInheritedfromQIODevice.cpp

?????文件???????2043??2012-07-02?23:30??3?methods\bufferCircularPlaybackInheritedFromQIODevice\bufferInheritedfromQIODevice.h

?????文件????????196??2012-05-08?15:32??3?methods\bufferCircularPlaybackInheritedFromQIODevice\main.cpp

?????文件????????654??2012-05-08?15:27??3?methods\bufferCircularPlaybackInheritedFromQIODevice\mainwindow.ui

?????文件???????7331??2012-05-12?01:29??3?methods\inheritedVersion3\inheritedVersion3.cpp

?????文件???????2521??2012-05-12?01:29??3?methods\inheritedVersion3\inheritedVersion3.h

?????文件????????368??2012-07-02?23:33??3?methods\inheritedVersion3\inheritedVersion3.pro

?????文件??????45938??2012-07-02?23:33??3?methods\inheritedVersion3\inheritedVersion3.pro.user

?????文件????????201??2012-07-02?23:32??3?methods\inheritedVersion3\main.cpp

?????文件????????654??2012-05-12?01:19??3?methods\inheritedVersion3\mainwindow.ui

?????文件???????4958??2012-05-21?23:20??3?methods\mybuffer\deployment.pri

?????文件????????182??2012-05-21?23:29??3?methods\mybuffer\main.cpp

?????文件???????5591??2012-05-21?23:29??3?methods\mybuffer\mainwindow.cpp

?????文件???????1455??2012-05-21?23:29??3?methods\mybuffer\mainwindow.h

?????文件????????554??2012-05-21?23:20??3?methods\mybuffer\mainwindow.ui

?????文件????????232??2012-05-21?23:20??3?methods\mybuffer\mybuffer.desktop

?????文件???????1758??2012-05-21?23:33??3?methods\mybuffer\mybuffer.pro

?????文件?????121628??2012-06-02?21:35??3?methods\mybuffer\mybuffer.pro.user

?????文件???????6596??2012-05-21?23:20??3?methods\mybuffer\mybuffer.svg

?????文件???????3400??2012-05-21?23:20??3?methods\mybuffer\mybuffer64.png

?????文件???????4945??2012-05-21?23:20??3?methods\mybuffer\mybuffer80.png

?????文件????????297??2012-05-21?23:20??3?methods\mybuffer\mybuffer_harmattan.desktop

?????文件????????110??2012-05-21?23:20??3?methods\mybuffer\qtc_packaging\debian_fremantle\changelog

?????文件??????????2??2012-05-21?23:20??3?methods\mybuffer\qtc_packaging\debian_fremantle\compat

?????文件???????4908??2012-05-21?23:20??3?methods\mybuffer\qtc_packaging\debian_fremantle\control

?????文件???????1371??2012-05-21?23:20??3?methods\mybuffer\qtc_packaging\debian_fremantle\copyright

?????文件????????138??2012-05-21?23:20??3?methods\mybuffer\qtc_packaging\debian_fremantle\README

?????文件???????1933??2012-05-21?23:20??3?methods\mybuffer\qtc_packaging\debian_fremantle\rules

............此處省略18個文件信息

評論

共有 條評論