Ich verwende Ubuntu 14.04. Ich habe Ubuntu SDK ohne Probleme mit den Anweisungen auf der Ubuntu-Website installiert. Ich habe ein neues QML-Projekt erstellt. Ich möchte eine App erstellen, die Qt Audio Engine verwendet. Hier ist mein Code, in dem ich für die Audio Engine teste:
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"
}
}
}
Wenn ich versuche, das Programm auszuführen, erhalte ich eine Fehlermeldung:Modul „QtAudioEngine“ ist nicht installiert.
Die Qt Audio Engine ist in der aktuellen Ubuntu QML API enthalten. Warum ist es nicht im SDK? Soll ich es irgendwie selbst installieren oder wird es vom Entwicklungsteam hinzugefügt?
Akzeptierte Antwort:
Ich habe diese modifizierte Version Ihres Codes (kleine Änderungen an Registerkarten) verwendet, um zu testen, was fehlte:
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"
}
}
}
Grundsätzlich müssen Sie für ein Desktop-Target folgendes Paket installieren:
sudo apt-get install qtdeclarative5-qtaudioengine-plugin
Für Ubuntu Touch:
sudo apt-get install qtdeclarative5-qtaudioengine-touch-plugin
Schließlich können Sie es mit qmlscene testen:
$ 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.