Estoy usando Ubuntu 14.04. Instalé Ubuntu SDK sin problemas usando las instrucciones en el sitio web de Ubuntu. Creé un nuevo proyecto QML. Quiero crear una aplicación que use Qt Audio Engine. Aquí está mi código donde estoy probando el motor de audio:
import QtQuick 2.0
import Ubuntu.Components 0.1
import QtAudioEngine 1.0
import "ui"
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
// Note! applicationName needs to match the "name" field of the click manifest
applicationName: "com.ubuntu.developer..AudioEngineTest"
/*
This property enables the application to change orientation
when the device is rotated. The default is false.
*/
//automaticOrientation: true
width: units.gu(100)
height: units.gu(75)
AudioEngine {
}
Tabs {
id: tabs
HelloTab {
objectName: "helloTab"
}
WorldTab {
objectName: "worldTab"
}
}
}
Cuando trato de ejecutar el programa, aparece un error:el módulo "QtAudioEngine" no está instalado.
El motor de audio Qt se encuentra en la API QML actual de Ubuntu. ¿Por qué no está en el SDK? ¿Debo instalarlo yo mismo o lo agregará el equipo de desarrollo?
Respuesta aceptada:
Usé esta versión modificada de su código (pequeños cambios en las pestañas) para probar lo que faltaba:
import QtQuick 2.0
import Ubuntu.Components 0.1
import QtAudioEngine 1.0
import "ui"
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
// Note! applicationName needs to match the "name" field of the click manifest
applicationName: "com.ubuntu.developer.AudioEngineTest"
/*
This property enables the application to change orientation
when the device is rotated. The default is false.
*/
//automaticOrientation: true
width: units.gu(100)
height: units.gu(75)
AudioEngine {
}
Tabs {
id: tabs
Tab {
title: "helloTab"
}
Tab {
title: "worldTab"
}
}
}
Básicamente, necesita instalar el siguiente paquete para un destino de escritorio:
sudo apt-get install qtdeclarative5-qtaudioengine-plugin
Para Ubuntu Touch:
sudo apt-get install qtdeclarative5-qtaudioengine-touch-plugin
Finalmente puedes probarlo con qmlscene:
$ qmlscene ./audio.qml
Module 'QtAudioEngine' does not contain a module identifier directive - it cannot be protected from external registrations.
unity::action::ActionManager::ActionManager(QObject*):
Could not determine application identifier. HUD will not work properly.
Provide your application identifier in $APP_ID environment variable.
default openal device = OpenAL Soft
device list:
OpenAL Soft
AudioEngine begin initialization
creating default category
init samples 0
init sounds 0
AudioEngine ready.