update QQt audio manager
3
QQt.pro
@ -19,7 +19,8 @@ SUBDIRS = src/qqt.pro
|
||||
##QQt installed to sdk or
|
||||
##QQt is build
|
||||
##-----------------------------------------------------------------
|
||||
#SUBDIRS += examples/exquisite
|
||||
#
|
||||
SUBDIRS += examples/exquisite
|
||||
#SUBDIRS += examples/tabwidgetexamples
|
||||
#SUBDIRS += examples/qrcodeexample
|
||||
#SUBDIRS += examples/qqtnetworkexample
|
||||
|
@ -45,6 +45,8 @@
|
||||
* 算一算:
|
||||
* 高保真肯定是用最高的采样率48000, 量化精度16位(2字节), 立体声2声道. 一首歌通常200秒
|
||||
* 48000 * 2 * 2 * 200 = 38400000字节, 大概38M一首歌曲
|
||||
*
|
||||
* ****由于Qt 实现上的原因,暂时仅仅支持桌面。在安卓上在关闭时会崩溃****
|
||||
**/
|
||||
class QQTSHARED_EXPORT QQtAudioManager : public QObject
|
||||
{
|
||||
|
80
test/voicetest/android/AndroidManifest.xml
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0"?>
|
||||
<manifest package="org.qtproject.example.voicetest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
|
||||
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="voicetest" android:icon="@drawable/icon">
|
||||
<activity android:configChanges="orientation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="声音设备" android:screenOrientation="unspecified" android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- Application arguments -->
|
||||
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
|
||||
<!-- Application arguments -->
|
||||
|
||||
<meta-data android:name="android.app.lib_name" android:value="voicetest"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
|
||||
<!-- Splash screen -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
||||
<!-- Splash screen -->
|
||||
|
||||
<!-- Background running -->
|
||||
<!-- Warning: changing this value to true may cause unexpected crashes if the
|
||||
application still try to draw after
|
||||
"applicationStateChanged(Qt::ApplicationSuspended)"
|
||||
signal is sent! -->
|
||||
<meta-data android:name="android.app.background_running" android:value="false"/>
|
||||
<!-- Background running -->
|
||||
|
||||
<!-- auto screen scale factor -->
|
||||
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
|
||||
<!-- auto screen scale factor -->
|
||||
|
||||
<!-- extract android style -->
|
||||
<!-- available android:values :
|
||||
* full - useful QWidget & Quick Controls 1 apps
|
||||
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
||||
* none - useful for apps that don't use any of the above Qt modules
|
||||
-->
|
||||
<meta-data android:name="android.app.extract_android_style" android:value="full"/>
|
||||
<!-- extract android style -->
|
||||
</activity>
|
||||
|
||||
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
||||
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default permissions. -->
|
||||
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default features. -->
|
||||
|
||||
|
||||
<!-- %%INSERT_PERMISSIONS -->
|
||||
<!-- %%INSERT_FEATURES -->
|
||||
<uses-permission android:name="android.permission.CALL_PHONE"/>
|
||||
</manifest>
|
BIN
test/voicetest/android/res/drawable-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
test/voicetest/android/res/drawable-hdpi/icon.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
test/voicetest/android/res/drawable-ldpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 964 B |
BIN
test/voicetest/android/res/drawable-ldpi/icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
test/voicetest/android/res/drawable-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
test/voicetest/android/res/drawable-mdpi/icon.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
test/voicetest/android/res/drawable-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
test/voicetest/android/res/drawable-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
test/voicetest/android/res/drawable-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
@ -1,11 +1,15 @@
|
||||
#include "mainwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <qqtwidgets.h>
|
||||
#include <qqtapplication.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main ( int argc, char* argv[] )
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QQtApplication a ( argc, argv );
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
moveFull ( &w );
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -284,12 +284,12 @@ void MainWindow::on_pushButton_clicked()
|
||||
pline() << "in prefer" << dev.preferredFormat().channelCount() << dev.preferredFormat().sampleRate() <<
|
||||
dev.preferredFormat().sampleSize();
|
||||
|
||||
pline() << "in" << manager.inputAudioFormat().channelCount() << manager.inputAudioFormat().sampleRate() <<
|
||||
manager.inputAudioFormat().sampleSize();
|
||||
|
||||
pline() << "out prefer" << devOut.preferredFormat().channelCount() << devOut.preferredFormat().sampleRate() <<
|
||||
devOut.preferredFormat().sampleSize();
|
||||
|
||||
pline() << "in" << manager.inputAudioFormat().channelCount() << manager.inputAudioFormat().sampleRate() <<
|
||||
manager.inputAudioFormat().sampleSize();
|
||||
|
||||
pline() << "out" << manager.outputAudioFormat().channelCount() << manager.outputAudioFormat().sampleRate() <<
|
||||
manager.outputAudioFormat().sampleSize();
|
||||
|
||||
@ -313,8 +313,8 @@ void MainWindow::readyRead()
|
||||
|
||||
void MainWindow::on_pushButton_3_clicked()
|
||||
{
|
||||
manager.stopOutput();
|
||||
manager.stopInput();
|
||||
manager.stopOutput();
|
||||
}
|
||||
|
||||
/*bug:Qt 设置音量会报错退出*/
|
||||
@ -351,6 +351,20 @@ void MainWindow::on_pushButton_4_clicked()
|
||||
manager.inputAudioFormat() = QQtAudioManager::defaultOutputDevice().preferredFormat();
|
||||
manager.outputAudioFormat() = QQtAudioManager::defaultOutputDevice().preferredFormat();
|
||||
|
||||
pline() << "in prefer" << QQtAudioManager::defaultInputDevice().preferredFormat().channelCount() <<
|
||||
QQtAudioManager::defaultInputDevice().preferredFormat().sampleRate() <<
|
||||
QQtAudioManager::defaultInputDevice().preferredFormat().sampleSize();
|
||||
|
||||
pline() << "out prefer" << QQtAudioManager::defaultOutputDevice().preferredFormat().channelCount() <<
|
||||
QQtAudioManager::defaultOutputDevice().preferredFormat().sampleRate() <<
|
||||
QQtAudioManager::defaultOutputDevice().preferredFormat().sampleSize();
|
||||
|
||||
pline() << "in" << manager.inputAudioFormat().channelCount() << manager.inputAudioFormat().sampleRate() <<
|
||||
manager.inputAudioFormat().sampleSize();
|
||||
|
||||
pline() << "out" << manager.outputAudioFormat().channelCount() << manager.outputAudioFormat().sampleRate() <<
|
||||
manager.outputAudioFormat().sampleSize();
|
||||
|
||||
manager.startDefaultInput();
|
||||
manager.startDefaultOutput();
|
||||
}
|
||||
|
@ -6,182 +6,140 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1198</width>
|
||||
<height>591</height>
|
||||
<width>932</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>20</y>
|
||||
<width>262</width>
|
||||
<height>551</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QListWidget" name="outChn"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QListWidget" name="outBit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QListWidget" name="outRate"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="outputListWidget"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>output format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>output device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>610</x>
|
||||
<y>40</y>
|
||||
<width>181</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>start take voice and play</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>610</x>
|
||||
<y>200</y>
|
||||
<width>181</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>refresh device list</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>610</x>
|
||||
<y>90</y>
|
||||
<width>181</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>stop (optional)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>820</x>
|
||||
<y>40</y>
|
||||
<width>291</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>start take voice and play (default device)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>258</width>
|
||||
<height>551</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1">
|
||||
<widget class="QListWidget" name="inBit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QListWidget" name="inChn"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QListWidget" name="intRate"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="inputListWidget"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>input format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>input device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>280</y>
|
||||
<width>161</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>input volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="inHS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>output volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="outHS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>input volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="inHS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>output volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="outHS">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>start take voice and play</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>stop (optional)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>refresh device list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QWidget" name="widget" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="5">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QListWidget" name="outChn"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QListWidget" name="outBit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QListWidget" name="outRate"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="outputListWidget"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>output format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>output device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="5">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1">
|
||||
<widget class="QListWidget" name="inBit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QListWidget" name="inChn"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QListWidget" name="intRate"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="inputListWidget"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>input format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>input device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="text">
|
||||
<string>start take voice
|
||||
and play (default device)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
@ -36,4 +36,16 @@ FORMS += \
|
||||
CONFIG += mobility
|
||||
MOBILITY =
|
||||
|
||||
#这句话很重要 启动拷贝很多东西
|
||||
system (touch main.cpp)
|
||||
|
||||
include (../../src/app_base_manager.pri)
|
||||
|
||||
contains(QKIT_PRIVATE, ANDROID|ANDROIDX86) {
|
||||
CONFIG += mobility
|
||||
MOBILITY =
|
||||
DISTFILES += \
|
||||
$${PWD}/android/AndroidManifest.xml
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $${PWD}/android
|
||||
}
|
||||
|