4

I'm writing a program that has one class called Driver, which reads audio, sends it through an effects chain and then sends it to an audio output. The effects are created from dynamic libraries (using either LADSPA or LV2 interfaces). So I wrote a class called DriverMediator that manages the shared libraries that contain the effects, and the Driver class that uses the effects.

So is this a correct use case of the Mediator Pattern?

0

The mediator shall encapsulate the interactions between colleagues. The intent is to have a loose coupling between the colleagues.

It is not fully clear from your description if you use it rightly. May be you do, but your description gives the impression that your DriverMediator just encapsulates all these objects and act as a kind of facade:

  • do the Driver and your LADSPA/LV2 plugins all know the mediator and are capable to interact with it ?
  • is the Driver independent of the libraries ? Fo example, could you replace the libraries with completely different audio systems and still do not change the Driver ? Or does the DriverMediator just forwards the calls, leaving the Driver indirectly dependent of the library ?

If it's still unclear, you could edit your question to give additional details about the interactions between all these objects.

  • it sounds like I was using more of the facade pattern, after reading about it and reading your answer. I'm just going to rename DriverMediator to DriverFacade – tay10r Mar 12 '17 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.