You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SoLoud is currently always a singleton. There's a single SoLoud underlying engine, and the Dart API exposes it via SoLoud(). We could go that way but I wonder if it's possible (even easy?) to make SoLoud instanced.
This would mean that every time you call SoLoud(), you'd get a new instance of the engine. You could have multiple running at the same time.
PROs:
Idiomatic way of configuring the engine. For example, we could have final engine = SoLoud(sampleRate: 44100);.
Idiomatic way of passing the engine around. You create an instance, and then you provide it. This is in contrast with the current state, in which you can access the singleton instance via SoLoud() from anywhere. There is no way a controller/facade can "hide" SoLoud() from you via encapsulation.
More robust testing. (One test cannot influence another.)
Is SoLoud (the underlying C library) capable of being instanced?
I was thinking about this. Is not possible to have for example 2 SoLoud instances because there can be only one player instance on C side.
But, yes, you can implement final engine = SoLoud(sampleRate: 44100); easily, but this engine will have that sampleRate for its entire life cycle.
So I think we can close this.
Ok, this is really helpful. If it's not possible to have two instances on the C side, it shouldn't be possible to have two instances on the Dart side. This simplifies things. Thanks for the quick reply!
Description
SoLoud
is currently always a singleton. There's a single SoLoud underlying engine, and the Dart API exposes it viaSoLoud()
. We could go that way but I wonder if it's possible (even easy?) to make SoLoud instanced.This would mean that every time you call
SoLoud()
, you'd get a new instance of the engine. You could have multiple running at the same time.PROs:
final engine = SoLoud(sampleRate: 44100);
.SoLoud()
from anywhere. There is no way a controller/facade can "hide" SoLoud() from you via encapsulation.CONs:
SoLoud()
to access the same instance).Requirements
The text was updated successfully, but these errors were encountered: