Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rothmichaels
Copy link

No description provided.

Comment on lines +83 to +84
static_assert(detail::SymbolicArg<struct quarter_note>);
static_assert(Unit<struct quarter_note>);
Copy link
Owner

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,
Copy link
Owner

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.

Comment on lines +23 to +26
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!! Before you commit any changes to this file please make sure to check if it !!!
// !!! renders correctly in the documentation "Examples" section. !!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Copy link
Owner

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


musical_context m_context;
quantity<si::hertz, float> m_frequency;
quantity_point<angular::radian, float> m_phase{0.f};
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants