//声卡采样格式 QAudioFormat format; // set up the format you want, eg. format.setSampleRate(8000); format.setChannelCount(1); format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); //format.setByteOrder(QAudioFormat::BigEndian); format.setSampleType(QAudioFormat::UnSignedInt); //format.setSampleType(QAudioFormat::SignedInt); QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); if (!info.isFormatSupported(format)) { qWarning()<<"default format not supported try to use nearest"; format = info.nearestFormat(format); } audio_in = new QAudioInput(format, this); myBuffer_in = audio_in->start(); connect(myBuffer_in, SIGNAL(readyRead()), SLOT(readMore())); // Records audio for 3000ms qDebug() <<"record begin!" << format.sampleSize();
QAudioFormat format; // set up the format you want, eg. format.setSampleRate(8000); format.setChannelCount(1); format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); //format.setByteOrder(QAudioFormat::BigEndian); format.setSampleType(QAudioFormat::UnSignedInt); //format.setSampleType(QAudioFormat::SignedInt); QAudioDeviceInfo info = QAudioDeviceInfo::defaultOutputDevice(); if (!info.isFormatSupported(format)) { qWarning()<<"111default format not supported try to use nearest"; format = info.nearestFormat(format); }
/*--------------------------------------------------------------------------------* * * * This material is trade secret owned by VoiceAge Corporation * * and is strictly confidential and shall remain as such. * * * * Copyright ?1995-2001 VoiceAge Corporation. All Rights Reserved. No part of * * this material may be reproduced, stored in a retrieval system, or transmitted, * * in any form or by any means, including, but not limited to, photocopying, * * electronic, mechanical, recording, or otherwise, without the prior written * * permission of VoiceAge Corporation. * * * * This material is subject to continuous developments and improvements. All * * warranties implied or expressed, including but not limited to implied * * warranties of merchantability, or fitness for purpose, are excluded. * * * * ACELP and VoiceAge are registered trademark and trademark of VoiceAge * * Corporation in Canada and / or other countries. Any unauthorized use is * * strictly prohibited. * * * *--------------------------------------------------------------------------------* * * * VoiceAge Corporation * * 750, Chemin Lucerne * * Suite 250 * * Ville Mont-Royal (Quebec) * * Canada, H3R 2H6 * * * * Tel. (514) 737-4940, fax. (514) 908-2037 * * * *--------------------------------------------------------------------------------* * *--------------------------------------------------------------------------------* * va_g729a.h * * ~~~~~~~~~~~~~~~~~~ * *--------------------------------------------------------------------------------* va_g729a API functions prototypes and constants */