mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 07:17:32 +09:00
[webaudio] Keep track of whether the HRTF database has already been loaded.
This DiD measure ensures that our async HRTF database loading is completed before we actually try to use it. If not done, database() simply returns null.
This commit is contained in:
parent
e1b0d4eea1
commit
f15da2d08c
2 changed files with 11 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Google Inc. All rights reserved.
|
||||
* Copyright (C) 2020 M. Straver. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
@ -72,6 +73,7 @@ HRTFDatabaseLoader::HRTFDatabaseLoader(float sampleRate)
|
|||
, m_threadLock("HRTFDatabaseLoader")
|
||||
, m_databaseLoaderThread(nullptr)
|
||||
, m_databaseSampleRate(sampleRate)
|
||||
, m_databaseLoaded(false)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
|
|
@ -164,6 +166,7 @@ void HRTFDatabaseLoader::load()
|
|||
MOZ_ASSERT(!m_hrtfDatabase.get(), "Called twice");
|
||||
// Load the default HRTF database.
|
||||
m_hrtfDatabase = HRTFDatabase::create(m_databaseSampleRate);
|
||||
m_databaseLoaded = true;
|
||||
// Notifies the main thread of completion. See loadAsynchronously().
|
||||
Release();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue