mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
Fixed bug on case 6443
This commit is contained in:
parent
03b46c5e62
commit
a1c9285c90
5 changed files with 23 additions and 8 deletions
|
@ -22,8 +22,7 @@ RowLayout {
|
||||||
property var sample: null;
|
property var sample: null;
|
||||||
property bool isPlaying: false;
|
property bool isPlaying: false;
|
||||||
function createSampleSound() {
|
function createSampleSound() {
|
||||||
var SOUND = Qt.resolvedUrl("../../../sounds/sample.wav");
|
sound = SampleSound;
|
||||||
sound = SoundCache.getSound(SOUND);
|
|
||||||
sample = null;
|
sample = null;
|
||||||
}
|
}
|
||||||
function playSound() {
|
function playSound() {
|
||||||
|
@ -31,7 +30,7 @@ RowLayout {
|
||||||
// FIXME: Audio.playSystemSound should not require position
|
// FIXME: Audio.playSystemSound should not require position
|
||||||
if (sample === null && !isPlaying) {
|
if (sample === null && !isPlaying) {
|
||||||
sample = Audio.playSystemSound(sound, MyAvatar.qmlPosition);
|
sample = Audio.playSystemSound(sound, MyAvatar.qmlPosition);
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
sample.finished.connect(reset);
|
sample.finished.connect(reset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,7 +759,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_notifiedPacketVersionMismatchThisDomain(false),
|
_notifiedPacketVersionMismatchThisDomain(false),
|
||||||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||||
_lastFaceTrackerUpdate(0),
|
_lastFaceTrackerUpdate(0),
|
||||||
_snapshotSound(nullptr)
|
_snapshotSound(nullptr),
|
||||||
|
_sampleSound(nullptr)
|
||||||
|
|
||||||
{
|
{
|
||||||
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
|
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
|
||||||
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
|
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
|
||||||
|
@ -804,7 +806,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_logger = new FileLogger(this);
|
_logger = new FileLogger(this);
|
||||||
qInstallMessageHandler(messageHandler);
|
qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
|
@ -981,6 +982,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
connect(myAvatar.get(), &MyAvatar::positionGoneTo,
|
connect(myAvatar.get(), &MyAvatar::positionGoneTo,
|
||||||
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
||||||
|
|
||||||
|
// Inititalize sample before registering
|
||||||
|
QFileInfo inf_sample = QFileInfo(PathUtils::resourcesPath() + "sounds/sample.wav");
|
||||||
|
_sampleSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(inf_sample.absoluteFilePath()));
|
||||||
|
|
||||||
|
|
||||||
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
||||||
scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){
|
scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){
|
||||||
registerScriptEngineWithApplicationServices(engine);
|
registerScriptEngineWithApplicationServices(engine);
|
||||||
|
@ -1787,9 +1793,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
return entityServerNode && !isPhysicsEnabled();
|
return entityServerNode && !isPhysicsEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
|
QFileInfo inf_snap = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
|
||||||
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(inf_snap.absoluteFilePath()));
|
||||||
|
|
||||||
QVariant testProperty = property(hifi::properties::TEST);
|
QVariant testProperty = property(hifi::properties::TEST);
|
||||||
qDebug() << testProperty;
|
qDebug() << testProperty;
|
||||||
if (testProperty.isValid()) {
|
if (testProperty.isValid()) {
|
||||||
|
@ -2304,6 +2310,7 @@ void Application::initializeUi() {
|
||||||
surfaceContext->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
surfaceContext->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
||||||
|
|
||||||
surfaceContext->setContextProperty("Camera", &_myCamera);
|
surfaceContext->setContextProperty("Camera", &_myCamera);
|
||||||
|
surfaceContext->setContextProperty("SampleSound", _sampleSound.data());
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
surfaceContext->setContextProperty("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
|
surfaceContext->setContextProperty("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
|
||||||
|
@ -4202,6 +4209,7 @@ void Application::initDisplay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::init() {
|
void Application::init() {
|
||||||
|
|
||||||
// Make sure Login state is up to date
|
// Make sure Login state is up to date
|
||||||
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
||||||
|
|
||||||
|
@ -5793,6 +5801,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
|
||||||
scriptEngine->registerGlobalObject("AvatarList", DependencyManager::get<AvatarManager>().data());
|
scriptEngine->registerGlobalObject("AvatarList", DependencyManager::get<AvatarManager>().data());
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("Camera", &_myCamera);
|
scriptEngine->registerGlobalObject("Camera", &_myCamera);
|
||||||
|
scriptEngine->registerGlobalObject("SampleSound", _sampleSound.data());
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
scriptEngine->registerGlobalObject("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
|
scriptEngine->registerGlobalObject("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
|
||||||
|
|
|
@ -702,6 +702,7 @@ private:
|
||||||
FileScriptingInterface* _fileDownload;
|
FileScriptingInterface* _fileDownload;
|
||||||
AudioInjectorPointer _snapshotSoundInjector;
|
AudioInjectorPointer _snapshotSoundInjector;
|
||||||
SharedSoundPointer _snapshotSound;
|
SharedSoundPointer _snapshotSound;
|
||||||
|
SharedSoundPointer _sampleSound;
|
||||||
|
|
||||||
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
|
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
|
||||||
QString _autoSwitchDisplayModeSupportedHMDPluginName;
|
QString _autoSwitchDisplayModeSupportedHMDPluginName;
|
||||||
|
|
|
@ -30,6 +30,11 @@ ScriptAudioInjector* AudioScriptingInterface::playSystemSound(SharedSoundPointer
|
||||||
return playSound(sound, options);
|
return playSound(sound, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScriptAudioInjector* AudioScriptingInterface::playSystemSound(Sound* sound, const QVector3D& position) {
|
||||||
|
SharedSoundPointer spSound = QSharedPointer<Sound>(sound);
|
||||||
|
return playSystemSound(spSound, position);
|
||||||
|
}
|
||||||
|
|
||||||
ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound, const AudioInjectorOptions& injectorOptions) {
|
ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound, const AudioInjectorOptions& injectorOptions) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
ScriptAudioInjector* injector = NULL;
|
ScriptAudioInjector* injector = NULL;
|
||||||
|
|
|
@ -34,6 +34,7 @@ protected:
|
||||||
Q_INVOKABLE ScriptAudioInjector* playSound(SharedSoundPointer sound, const AudioInjectorOptions& injectorOptions = AudioInjectorOptions());
|
Q_INVOKABLE ScriptAudioInjector* playSound(SharedSoundPointer sound, const AudioInjectorOptions& injectorOptions = AudioInjectorOptions());
|
||||||
// FIXME: there is no way to play a positionless sound
|
// FIXME: there is no way to play a positionless sound
|
||||||
Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position);
|
Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position);
|
||||||
|
Q_INVOKABLE ScriptAudioInjector* playSystemSound(Sound* sound, const QVector3D& position);
|
||||||
|
|
||||||
Q_INVOKABLE void setStereoInput(bool stereo);
|
Q_INVOKABLE void setStereoInput(bool stereo);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue