mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-02 12:33:52 +00:00
Tell spatializers about sources only when they're active;
apply will still only be called with sources after they have been created.
This commit is contained in:
parent
952fee3bd1
commit
08916df2f1
|
@ -88,6 +88,7 @@ static void onPlayback(ma_device* device, void* out, const void* in, uint32_t co
|
||||||
state.sources[source->index] = NULL;
|
state.sources[source->index] = NULL;
|
||||||
state.sourceMask &= ~(1ull << source->index);
|
state.sourceMask &= ~(1ull << source->index);
|
||||||
source->index = ~0u;
|
source->index = ~0u;
|
||||||
|
state.spatializer->sourceDestroy(source);
|
||||||
lovrRelease(source, lovrSourceDestroy);
|
lovrRelease(source, lovrSourceDestroy);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -365,8 +366,6 @@ Source* lovrSourceCreate(Sound* sound, bool spatial) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state.spatializer->sourceCreate(source);
|
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,13 +378,11 @@ Source* lovrSourceClone(Source* source) {
|
||||||
clone->volume = source->volume;
|
clone->volume = source->volume;
|
||||||
clone->spatial = source->spatial;
|
clone->spatial = source->spatial;
|
||||||
clone->converter = source->converter;
|
clone->converter = source->converter;
|
||||||
state.spatializer->sourceCreate(clone);
|
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrSourceDestroy(void* ref) {
|
void lovrSourceDestroy(void* ref) {
|
||||||
Source* source = ref;
|
Source* source = ref;
|
||||||
state.spatializer->sourceDestroy(source);
|
|
||||||
lovrRelease(source->sound, lovrSoundDestroy);
|
lovrRelease(source->sound, lovrSoundDestroy);
|
||||||
free(source);
|
free(source);
|
||||||
}
|
}
|
||||||
|
@ -406,6 +403,7 @@ bool lovrSourcePlay(Source* source) {
|
||||||
state.sources[index] = source;
|
state.sources[index] = source;
|
||||||
source->index = index;
|
source->index = index;
|
||||||
lovrRetain(source);
|
lovrRetain(source);
|
||||||
|
state.spatializer->sourceCreate(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
ma_mutex_unlock(&state.lock);
|
ma_mutex_unlock(&state.lock);
|
||||||
|
|
Loading…
Reference in a new issue