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

  • 大小: 265KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-30
  • 語言: 其他
  • 標(biāo)簽: Qt??SDL??

資源簡(jiǎn)介

Qt+SDL錄音并實(shí)時(shí)放音,類似KTV歌唱的

資源截圖

代碼片段和文件信息

#include?“audioengine.h“
#include?
#include?

extern?“C“{
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
}

int?volume?=?128;

struct?Node
{
????char?*?data;
????Node?*?next;
};

QList?dataList;
SDL_mutex?*mutex;


void?packet_queue_init()
{
????mutex?=?SDL_CreateMutex();
}

int?packet_queue_put(QByteArray?array)
{
????SDL_LockMutex(mutex);
????dataList.append(array);
????SDL_UnlockMutex(mutex);
}

static?QByteArray?packet_queue_get()
{
????SDL_LockMutex(mutex);

????QByteArray?array;

????if?(!dataList.isEmpty())
????{
????????array?=?dataList.at(0);
????????dataList.removeAt(0);
????}
????SDL_UnlockMutex(mutex);
????return?array;
}

void?audio_callback(void?*userdata?Uint8?*stream?int?len)
{
????QByteArray?array?=?packet_queue_get();
????if?(!array.isEmpty())
????{
????????SDL_MixAudio(stream(uint8_t?*?)array.data()array.size()volume);
????}
}

const?qint64?BufferDurationUs???????=?10?*?1000000;
const?int????NotifyIntervalMs???????=?100;

AudioEngine::AudioEngine(Qobject?*parent)?:
????Qobject(parent)
????m_audioInputDevice(QAudioDeviceInfo::defaultInputDevice())
{
????initial();
????packet_queue_init();
????openSDL();

????startRrcording();
}

void?AudioEngine::?initial()
{
????m_format.setFrequency(8000);
????m_format.setChannels(1);
????m_format.setSampleSize(16);
????m_format.setSampleType(QAudioFormat::SignedInt);
????m_format.setByteOrder(QAudioFormat::LittleEndian);
????m_format.setCodec(“AUDIO_S16“);

????QAudioDeviceInfo?info(QAudioDeviceInfo::defaultInputDevice());
????if?(!info.isFormatSupported(m_format))
????{
????????m_format?=?info.nearestFormat(m_format);
????}
????m_audioInput?=?new?QAudioInput(m_audioInputDevice?m_format?this);

????m_audioInput->setNotifyInterval(512);
}

void?AudioEngine::startRrcording()
{

????if?(m_audioInput)
????{
?????????connect(m_audioInput?SIGNAL(notify())this?SLOT(audioNotify()));
?????????m_audioInputIODevice?=?m_audioInput->start();
?????????connect(m_audioInputIODevice?SIGNAL(readyRead())this?SLOT(audioDataReady()));
????}
}

void?AudioEngine::audioDataReady()
{
????QByteArray?array?=?m_audioInputIODevice->readAll();
????packet_queue_put(array);
}

void?AudioEngine::stopRecording()
{
????if?(m_audioInput)?{
????????m_audioInput->stop();
????????QCoreApplication::instance()->processEvents();
????????m_audioInput->disconnect();
????}
????m_audioInputIODevice?=?0;
}

bool?AudioEngine::openSDL()
{
????SDL_LockAudio();
????SDL_AudioSpec?spec;
????SDL_AudioSpec?wanted_spec;
????wanted_spec.freq?=?8000;
????wanted_spec.format?=?AUDIO_S16;
????wanted_spec.channels?=?1;
????wanted_spec.silence?=?0;
????wanted_spec.samples?=?256;//SDL_AUDIO_BUFFER_SIZE;
????wanted_

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????3286??2013-02-17?22:23??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\audioengine.cpp

?????文件????????619??2013-02-17?22:22??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\audioengine.h

?????文件????????486??2013-02-16?18:59??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\audiorecord.pro

?????文件????????189??2011-11-03?16:04??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\main.cpp

?????文件????????443??2013-02-17?22:09??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\mainwindow.cpp

?????文件????????423??2011-11-03?17:33??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\mainwindow.h

?????文件????????580??2013-02-16?18:59??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\mainwindow.ui

?????文件???????5230??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\begin_code.h

?????文件???????1482??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\close_code.h

?????文件??????37206??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\doxyfile

?????文件???????3233??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL.h

?????文件???????1933??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_active.h

?????文件??????11215??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_audio.h

?????文件????????986??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_byteorder.h

?????文件???????6048??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_cdrom.h

?????文件???????1474??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config.h

?????文件???????1474??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config.h.default

?????文件???????7864??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config.h.in

?????文件???????2803??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_dreamcast.h

?????文件???????2801??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_macos.h

?????文件???????4193??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_macosx.h

?????文件???????1982??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_minimal.h

?????文件???????2979??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_nds.h

?????文件???????3635??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_os2.h

?????文件???????3107??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_symbian.h

?????文件???????4574??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_config_win32.h

?????文件????????869??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_copying.h

?????文件???????2221??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_cpuinfo.h

?????文件???????6055??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_endian.h

?????文件???????1874??2012-01-19?14:30??Qt+SDL錄音并實(shí)時(shí)放音(有雜音待解決)\源代碼\audiorecord\SDL\include\SDL_error.h

............此處省略36個(gè)文件信息

評(píng)論

共有 條評(píng)論