To handle file vs streaming, I'm using a switch statement inside my
SoundEngine
SoundEngine
class:
switch (fileType) { case eFileType.File: _player = new SoundPlayer(new StreamDataProvider(File.OpenRead((string)path))); break; case eFileType.Stream: _player = new SoundPlayer(new StreamDataProvider((Stream)path)); break;
switch (fileType) { case eFileType.File: _player = new SoundPlayer(new StreamDataProvider(File.OpenRead((string)path))); break; case eFileType.Stream: _player = new SoundPlayer(new StreamDataProvider((Stream)path)); break;
I shouldn't be newing up classes inside my SoundEngine, and want to use DI instead. However, since a user can play different files while the (which must be passed into the _player variable), I can't use constructor injection. Is there another way to handle this?