I have a C++ audio project for batch processing and offline computation. I have a class…
Private research annotation
Sign in to add a private research label or note.
- User
I have a C++ audio project for batch processing and offline computation. I have a class called Scorer that is responsible to read from an external text file the series of parameters, like "freq = 440;", parse it and create a map of strings, like {"freq", "440"}. To manage the communication between this class and the class AudioProcessor, that is responsible to process data, like a sinusoidal generator that has as parameter the frequency and it will create a sine tone at 440 Hz, I will introduce a mediator pattern through the usage of a IConfigHandler, such that before to call the process method of an AudioProcessor a method called Configure() will be called that will loop over the inner map of parameters of the AudioProcessor and it will search if a parameter with the same key will be find inside Scorer and in positive case the value will be converted in a double number, such that the AudioProcessor will have the map String / Double correctly filled. Please provide:
- a feedback on the general structure of my project.
- any improvement on Scorer, if necessary.
- A simple implementation of the mediator design pattern, with the interface and the implementation.
- a feedback about the idea to move the main method of Scorer directly as the constructor and the possibility to delete the copy constructor, move constructor and assignment.
- a feedback about the possibility that once a parameter has been retrieved from Scorer a flag is set to specify that such parameter has already been used, in particular to improve the error handling in case multiple parameters with the same name are called accidentally from an AudioProcessor and the Scorer can prevent to retrieve the same value for different keys with the same name. Alternatively propose the best practice for this scenario.
- a feedback about to inherit directly from AudioProcessor IConfigHandler, to implement directly the communication inside Configure() method.
- a feedback about to thrown an exception if the parameters is not found in Scorer.
- a feedback about to do not have Scorer as a private member of AudioProcessor, such that I will have an external class that will act as main controller between Scorer and AudioProcessor(s).
- some parameters will be expression that will be evaluated according to "t", that is the temporal parameter on which the controller will loop. For this reason, I am wondering if the Configure() will act outside the loop and AudioProcessor will have a map of String / String and inside the loop the parameters will be evaluated in Double number.
- Assistant