Ah, I had forgotten anonymous classes are a thing.
Although, you don’t actually need the constructor to be
public to do that.
Not with standard Java at least.
I.e. the code is still valid if the constructor is
Also I wasn’t aware Java finally added a
It’s slowly catching up with C#. Slowly.
That’s probably the better option.
Either that or make people manage their own instances.
Procedural doesn’t technically need to even know about
I somewhat disagree with this.
It doesn’t seem to me that the sound’s channel is actually part of the sound,
the channel only makes sense in the context of playing the sound via
If it weren’t for the fact that
Procedural is stateful I’d say it ought to be possible to do:
Procedural sound = new SomeSound();
And it is actually possible to do:
Mixer.setChannel(0, new SomeSound());
Mixer.setChannel(1, new SomeSound());
At which point
channel is just wasting memory.
channel only really exists to make
play function is purely shorthand for
which means it’s effectively just a convinience function.
I can’t imagine any other implementation that would make sense.
play pretty much forces
Procedural to depend on
which means they end up being strongly coupled.
I’m not even sure the
Procedural part is right.
When I hear ‘procedural’ I think of procedural generation (e.g. bytebeat music rather than pre-generated sound data).
I think maybe
SequentialSound would have been more on the nose.
The semantics are different.
femto.sound is sound as a concept, grouping together everything relating to sound generation,
femto.sound.Sound is a particular instance of a sound.
A better alternative would probably be
femto.audio.Sound, but that means changing more things.