Code Monkey home page Code Monkey logo

Comments (4)

djowel avatar djowel commented on August 24, 2024

Show me the code that does not work.

from q.

djowel avatar djowel commented on August 24, 2024

q::decibel(q::detail::db2a(m_threshold))));

BTW, this does not look good. detail is private and should not be used by clients. Also, why are m_lowestPitch and m_highestPitch not q::frequency types? While this works, it is subverting the strict type system, like using void*.

I know, I know... off-topic... I just can't resist advocating good modern c++ usage :-)

from q.

xavriley avatar xavriley commented on August 24, 2024

😅 I'll try to tidy up the code a bit - some things are a hangover from when I was figuring things out.

Code that doesn't work:

// in header
std::shared_ptr<cycfi::q::signal_conditioner> m_pp;
// in initializer
...
auto m_pp = std::shared_ptr<cycfi::q::pitch_detector>(new cycfi::q::pitch_detector(
			    q::frequency(m_lowestPitch),
			    q::frequency(m_highestPitch),
			    m_inputSampleRate,
			    q::decibel(q::detail::db2a(m_threshold))));

...
// inside process function
float s = m_pp->operator(inputBuffers[0][i]);

It compiles but with a note:

QlibPitch.cpp:277:21: note: in instantiation of function template specialization 'cycfi::q::signal_conditioner::signal_conditioner<cycfi::q::signal_conditioner::config>' requested here
    auto sig_cond = cycfi::q::signal_conditioner(

and then segfaults when I try to run it. I 100% expect this to be an issue with my code - I'm mainly just trying to understand how to share an instance of the signal conditioner across several different function calls.

from q.

djowel avatar djowel commented on August 24, 2024

// in initializer
...
auto m_pp = std::shared_ptrcycfi::q::pitch_detector(new cycfi::q::pitch_detector(
q::frequency(m_lowestPitch),
q::frequency(m_highestPitch),
m_inputSampleRate,
q::decibel(q::detail::db2a(m_threshold))));

This does not make sense. m_pp is a std::shared_ptr<cycfi::q::signal_conditioner> and you are assigning a std::shared_ptr<cycfi::q::pitch_detector> to it?

from q.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.