oops - restore assets modification to load scripts
This commit is contained in:
parent
4a3ffadecb
commit
b89b8d585e
@ -147,8 +147,10 @@ Assets::Assets(Settings settings, StringList assetSources) {
|
||||
pushGlobalContext("assets", makeBaseAssetCallbacks());
|
||||
|
||||
auto decorateLuaContext = [&](LuaContext& context, MemoryAssetSourcePtr newFiles) {
|
||||
auto callbacks = makeBaseAssetCallbacks();
|
||||
if (newFiles) {
|
||||
// re-add the assets callbacks with more functions
|
||||
context.remove("assets");
|
||||
auto callbacks = makeBaseAssetCallbacks();
|
||||
callbacks.registerCallback("add", [&newFiles](LuaEngine& engine, String const& path, LuaValue const& data) {
|
||||
ByteArray bytes;
|
||||
if (auto str = engine.luaMaybeTo<String>(data))
|
||||
@ -184,9 +186,9 @@ Assets::Assets(Settings settings, StringList assetSources) {
|
||||
m_filesByExtension[AssetPath::extension(path).toLower()].erase(path);
|
||||
return erased;
|
||||
});
|
||||
}
|
||||
|
||||
context.setCallbacks("assets", callbacks);
|
||||
}
|
||||
};
|
||||
|
||||
auto addSource = [&](String const& sourcePath, AssetSourcePtr source) {
|
||||
|
@ -231,6 +231,7 @@ void Mixer::stopAll(float rampTime) {
|
||||
void Mixer::read(int16_t* outBuffer, size_t frameCount, ExtraMixFunction extraMixFunction) {
|
||||
// Make this method as least locky as possible by copying all the needed
|
||||
// member data before the expensive audio / effect stuff.
|
||||
float speed;
|
||||
unsigned sampleRate;
|
||||
unsigned channels;
|
||||
float volume;
|
||||
@ -240,6 +241,7 @@ void Mixer::read(int16_t* outBuffer, size_t frameCount, ExtraMixFunction extraMi
|
||||
|
||||
{
|
||||
MutexLocker locker(m_mutex);
|
||||
speed = m_speed;
|
||||
sampleRate = m_sampleRate;
|
||||
channels = m_channels;
|
||||
volume = m_volume.value;
|
||||
@ -266,8 +268,6 @@ void Mixer::read(int16_t* outBuffer, size_t frameCount, ExtraMixFunction extraMi
|
||||
for (size_t i = 0; i < bufferSize; ++i)
|
||||
outBuffer[i] = 0;
|
||||
|
||||
float speed = m_speed;
|
||||
|
||||
{
|
||||
MutexLocker locker(m_queueMutex);
|
||||
// Mix all active sounds
|
||||
|
Loading…
Reference in New Issue
Block a user