-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio examples #644
base: master
Are you sure you want to change the base?
Audio examples #644
Conversation
static_assert(detail::SymbolicArg<struct quarter_note>); | ||
static_assert(Unit<struct quarter_note>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a good idea. We always claim that users never use types and just values. Users should not have to call those concepts here. Or at least we should not recommend that in our examples.
sine_wave_osc(const musical_context& context, QuantityOf<isq::frequency> auto freq) : | ||
m_context{context}, m_frequency{freq} | ||
{ | ||
std::cout << std::format("Created LFO with starting frequency {} ({}) for sample rate {} at tempo {}\n", freq, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, what does LFO stands for? I am not asking to provide a full text here, but maybe the file should use a longer name as lfo.cpp looks cryptic to most users.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
// !!! Before you commit any changes to this file please make sure to check if it !!! | ||
// !!! renders correctly in the documentation "Examples" section. !!! | ||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is only needed if you also plan to provide a description of this example in our docs. See https://mpusz.github.io/mp-units/latest/users_guide/examples/tags_index/ for examples. Otherwise, I recommend removing the comment to not suggest that this file is a part of our docs already.
|
||
quantity<sample_value> sin(quantity_point<angular::radian, float>) | ||
{ | ||
return std::sin(m_phase.numerical_value_in(angular::radian)) * pcm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have sin overloads for quantities in si and angular subdirectories:
https://github.com/mpusz/mp-units/blob/master/src%2Fsystems%2Finclude%2Fmp-units%2Fsystems%2Fangular%2Fmath.h#L46-L48
|
||
musical_context m_context; | ||
quantity<si::hertz, float> m_frequency; | ||
quantity_point<angular::radian, float> m_phase{0.f}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SI also has radian but does not have revolutions. I am not sure which one is the better use case considering that you use SI already.
No description provided.