Allow NAM_SAMPLE_FLOAT to switch model input to float instead of double#48
Conversation
|
Good stuff. JUCE, for instance, uses float buffers, so keeping an extra double-precision buffer as an adapter for NAM is a bit annoying. |
sdatkinson
left a comment
There was a problem hiding this comment.
Approving since I've called it a nit, but I'd appreciate hearing back from you about having gain parameters be of NAM_SAMPLE type. It feels odd, but I know I haven't seen enough DSP code to feel confident about conventions in the space.
| } | ||
|
|
||
| convnet::ConvNet::ConvNet(const double loudness, const int channels, const std::vector<int>& dilations, | ||
| convnet::ConvNet::ConvNet(const NAM_SAMPLE loudness, const int channels, const std::vector<int>& dilations, |
There was a problem hiding this comment.
Nit: I don't like loudness being of "sample" type--it's a parameter of the model.
But I get that it mainly serves to do arithmetic with samples, so I can live with it.
| void DSP::process(double** inputs, double** outputs, const int num_channels, const int num_frames, | ||
| const double input_gain, const double output_gain, | ||
| void DSP::process(NAM_SAMPLE** inputs, NAM_SAMPLE** outputs, const int num_channels, const int num_frames, | ||
| const NAM_SAMPLE input_gain, const NAM_SAMPLE output_gain, |
There was a problem hiding this comment.
Yeah, it looks weird having all of these parameters being called "samples". Can you point me to somewhere else that follows this convention? It just doesn't sound right.
There was a problem hiding this comment.
I wasn't sure either, and I'm fine either way. "loudness" is an internal parameter anyway, and "input_gain" and "output_gain" should be probably be removed since the plugin just passes "1.0" and handles gain itself (as does my LV2 plugin).
|
By the way, what about |
No - the models operate with floats regardless of the input sample precision. |
|
Ok, I've reverted the parameters to double. |
* More error codes related for loading WAV files * Better error messages * Add enum of return codes and capture IR loading in IR state * Error messages for failed IR loads.
This PR adds a NAM_SAMPLE #define that is used instead of "double" for input samples for model processing.
If NAM_SAMPLE_FLOAT is defined, this will switch NAM_SAMPLE to "float". Otherwise it remains "double", so no there is no change in existing behavior.
This allows processing loops using "float" to avoid having to convert buffers to "double".