Development Topics > Plugin Development

coding...

(1/4) > >>

haze:
hi,

can you please look at my codes in the process call, am i doing the right coding.

VocalRangeAnalyzerPlugin::FeatureSet
VocalRangeAnalyzerPlugin::process(const float *const *inputBuffers,
                                 Vamp::RealTime timestamp)
{
    FeatureSet returnFeatures;

    if (m_stepSize == 0) {
        std::cerr << "VocalRangeAnalyzerPlugin::process:  Plugin not initialised" << std::endl;
        return returnFeatures;
    }

    for (size_t i = 0; i < m_stepSize; ++i) {
        for (size_t j = 0; j < m_channelCount; ++j) {
            fvec_write_sample(m_ibuf, inputBuffers[j], j, i);
        }
    }

      calculate();

      if (minFreq >= 80 && maxFreq <= 310){
         feature.label = "bass";}

      else if(minFreq >= 100 && maxFreq <= 440){
         feature.label ="baritone";}
         
      else if(minFreq >=130 && maxFreq <= 500){
         feature.label = "tenor";}

      else if(minFreq >= 160 && maxFreq <= 650){
         feature.label = "alto";}

      else if(minFreq >= 210 && maxFreq <= 900){
         feature.label = "mezzo-soprano";}

      else if(minFreq >= 270 && maxFreq <= 1100){
         feature.label = "soprano";}

   
   Feature feature;
    feature.hasTimestamp = true;
    feature.timestamp = m_currentOnset +
            RealTime::frame2RealTime(i * m_stepSize, m_inputSampleRate);
   feature.hasDuration = true;
    feature.duration = offTime - m_currentOnset;
    feature.values.push_back(freq);

    returnFeatures[0].push_back(feature);
    return returnFeatures;
}

void
VocalRangeAnalyzerPlugin::calculate()
{
   float freq = aubio_pitchdetection(m_pitchdet, m_ibuf);
   

   for(int i=0; i<m_stepSize; i++)
   {
      if(freq < minFreq){
         minFreq = freq;
      }
      else
         if(freq > maxFreq){
            maxFreq = freq;
         }

   isFirstTime(false);
   }
}
//consider all has been initialized

do i miss something, there's no error, i got a dll file but then it is not running in sonic v.

please help. thanks.

hazel

haze:
Also, how do I remove the example plugins of vamp. I want only my plugin to be built. I tried deleting the examples.cpp files but everytime I build it, there's an error of cannot find files.

Thanks

Hazel

cannam:
When you say it isn't running in SV, what do you mean? It doesn't appear in the menus, it appears in the menus but no data is generated and displayed, or it fails in some other way (e.g. crashes)?

You might find it simpler to test in vamp-simple-host, which prints out its results directly to the command prompt -- at least that way you would see immediately whether there are any results or not, whereas in SV you could theoretically have results that simply aren't visible because their timestamps are wrong, or some such.

I can't really comment on the usage of aubio, but I would wonder what m_currentOnset is as it doesn't appear to be set anywhere.

To remove the example plugins, it should only be necessary to remove the references to them from plugins.cpp (or whatever file your library main entry point is defined in -- it's plugins.cpp in the example set).  There are three references to each plugin (the #include for its header, the static adapter declaration, and the return value from vampGetPluginDescriptor), and you would need to remove them all.  Ensure that your vampGetPluginDescriptor function returns your own plugin's adapter when it is called with index value of 0, and returns 0 for any other index value.


Chris

haze:
Hi.

I'm back. Regarding what I said that the .dll file is not running in SV, whenever I tried to open SV, it crashes down. It does not continue to open.

Where is the problem here? In the codes?

Pls. help. Thanks.

Hazel

cannam:

Does SV crash as soon as you start it up (when your DLL is installed), or does it crash when you try to run the plugin?

Either way, I'm afraid the most likely thing is a bug in the plugin code.

If it crashes when you start SV, then the crash might be in the plugin's constructor function or in the plugin lookup code (vampGetPluginDescriptor -- are you remembering to return NULL when called with an index greater than the number of plugins in the library?)

If it crashes when you run the plugin, then the most likely thing would be a bug in initialize() or process().

Perhaps you might try running it in a debugger?

Again, I'd also suggest using vamp-simple-host as an alternative test host.  You could even use vamp-simple-host in a debugger...


Chris

Navigation

[0] Message Index

[#] Next page

Go to full version