Plugin: Selector

Discussion about the Bidule SDK, post your questions, feature request and plugins here.

Moderators: davidv, seb@plogue

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Plugin: Selector

Postby boonier » Wed Dec 01, 2010 10:50 am

Selector - outputs a trigger (1) when the number at the inlet is equal to the user specified number.

I hope update this when I get the chance to figure out how to do multiple plugins in the same bundle. Again, I've only compiled to OSX
cheers

DISCLAIMER!
If anyone wants to check the source before using then please do. I haven't personally had weird issues with them however!
Attachments
Selector.bundle.zip
(24.22 KiB) Downloaded 234 times

dts350z
Posts: 1521
Joined: Thu Jan 15, 2009 1:18 pm

Re: Plugin: Selector

Postby dts350z » Thu Dec 02, 2010 4:45 pm

If you want I can compile windoze versions for you.

Also can help you with multiple functions per plugin.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Plugin: Selector

Postby boonier » Fri Dec 03, 2010 7:37 am

dts350z wrote:If you want I can compile windoze versions for you.


Yes that would be useful thanks...See attached

Also can help you with multiple functions per plugin.


Yes please!
Attachments
Selector.zip
(461.05 KiB) Downloaded 232 times

dts350z
Posts: 1521
Joined: Thu Jan 15, 2009 1:18 pm

Re: Plugin: Selector

Postby dts350z » Sun Dec 12, 2010 2:16 pm

Attached is a windows 32bit version of your plugin.

I had to change the variable deceleration on line 89 to a regular "int" to get it to compile. No other changes were made.

I see you already changed the identifier stuff in the main cpp file. To make multiple plugins in one bundle/dll you just need to define multiples like this:

Code: Select all

DLLExport unsigned long getNumBidules() {
   return 2;
}

DLLExport ErrorCode fillBiduleInfo(unsigned long biduleIdx, BidulePluginInfo* biduleInfo) {
   //return NO_PLUGIN if no plugin for that idx
   //return NO_ERROR for OK
   //shouldn't happen but there's nothing
   //wrong with some error handling mechanisms
   switch(biduleIdx) {

      case 0:
         strcpy(biduleInfo->type, "com.surroundbyus.Zmeter1_1");
         strcpy(biduleInfo->name, "Zmeter1.1");
         strcpy(biduleInfo->fullName, "Z\tZmeter 1.1");
         return BSDK_NO_ERROR;
      break;

      case 1:
         strcpy(biduleInfo->type, "com.surroundbyus.ZAG2_2");
         strcpy(biduleInfo->name, "ZAutomaticGain2.2");
         strcpy(biduleInfo->fullName, "Z\tZAG 2.2");
         return BSDK_NO_ERROR;
      break;


      default:
         return BSDK_NO_PLUGIN;
      break;
   }
}

DLLExport BidulePluginStruct* newInstance(const char* type, BiduleHost* host) {
   int x = 0;

   if( strcmp(type, "com.surroundbyus.Zmeter1_1") == 0) {
      BidulePlugin* bp = new Zmeter1_1(host);
      x = 1;
      return bp->getBidulePluginStruct();
   }

   if( strcmp(type, "com.surroundbyus.ZAG2_2") == 0) {
      BidulePlugin* bp = new ZAG2_2(host);
      x = 1;
      return bp->getBidulePluginStruct();
   }

   if ( x == 1)
        return NULL;
}


I make a copy of SDKExampleMain.cpp for each plugin, but I have all the include stuff in one .h file, in separate sections. So the above project I have

Zag 2.2.cpp (the "main")
Zag.cpp (a plugin)
Zmeter.cpp (a plugin)
and Zag 2.2.h

cheers
Attachments
Selector.zip
(10.5 KiB) Downloaded 245 times

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Plugin: Selector

Postby boonier » Wed Dec 15, 2010 6:29 am

thanks :) I'll look into this when I get a spare moment.

Incidentally where are your include statements for the additional plugin files (Zag, Zag meter)?

dts350z
Posts: 1521
Joined: Thu Jan 15, 2009 1:18 pm

Re: Plugin: Selector

Postby dts350z » Wed Dec 15, 2010 9:08 am

but I have all the include stuff in one .h file


Like this:

Code: Select all

class Zmeter1_1: public BidulePlugin {

       public:
          Zmeter1_1(BiduleHost* host);
         virtual ~Zmeter1_1();
            virtual bool init();
            virtual void start();
         virtual void idle();
         virtual void getAudioInNames(std::vector<std::string>& vec);
         virtual void getAudioOutNames(std::vector<std::string>& vec);
         virtual void getMIDIInNames(std::vector<std::string>& vec);
         virtual void getMIDIOutNames(std::vector<std::string>& vec);
         virtual void getFreqInNames(std::vector<std::string>& vec);
         virtual void getFreqOutNames(std::vector<std::string>& vec);
         virtual void getMagInNames(std::vector<std::string>& vec);
         virtual void getMagOutNames(std::vector<std::string>& vec);

            virtual void parameterUpdate(long id);
         virtual void getParametersInfos(ParameterInfo* pinfos);
         virtual void getParameterChoices(long id, std::vector<std::string>& vec);

         virtual void process(Sample** sampleIn, Sample** sampleOut, MIDIEvents* midiIn, MIDIEvents* midiOut, Frequency*** freqIn, Frequency*** freqOut, Magnitude*** magIn, Magnitude*** magOut, SyncInfo* syncIn, SyncInfo* syncOut);
      protected:
         double _dParamValue;
         AudioFile _af;
         bool _afConnected;
         unsigned long _dumbAFCounter;
         long SampleCount[8];
         std::string MeterHeader;
         std::string PeakMeter;
         std::string RmsMeter;
         int _iResetSelect;
         int _iReset;
         float _fMax[8];
         float _fMaxdB[8];
         double _fSumOfSquares[8];
         double _fRMS[8];
         double _fRMSdB[8];
         char version[30];


    };

   class ZAG2_1: public BidulePlugin {

       public:
          ZAG2_1(BiduleHost* host);
         virtual ~ZAG2_1();
            virtual bool init();
            virtual void start();
            virtual void idle();
         virtual void getAudioInNames(std::vector<std::string>& vec);
         virtual void getAudioOutNames(std::vector<std::string>& vec);
         virtual void getMIDIInNames(std::vector<std::string>& vec);
         virtual void getMIDIOutNames(std::vector<std::string>& vec);
         virtual void getFreqInNames(std::vector<std::string>& vec);
         virtual void getFreqOutNames(std::vector<std::string>& vec);
         virtual void getMagInNames(std::vector<std::string>& vec);
         virtual void getMagOutNames(std::vector<std::string>& vec);

            virtual void parameterUpdate(long id);
         virtual void getParametersInfos(ParameterInfo* pinfos);
         virtual void getParameterChoices(long id, std::vector<std::string>& vec);

         virtual void process(Sample** sampleIn, Sample** sampleOut, MIDIEvents* midiIn, MIDIEvents* midiOut, Frequency*** freqIn, Frequency*** freqOut, Magnitude*** magIn, Magnitude*** magOut, SyncInfo* syncIn, SyncInfo* syncOut);
         void Reset();
         void UpdateMeter();
         void Debug();
         void CalcGains();
         void GetMeasurements();
         void wait(int milliseconds);
      protected:
         double _dParamValue;
         AudioFile _af;
         bool _afConnected;
         int _iPlay;
         int _iMeters;
         int _iMode;
         unsigned long _dumbAFCounter;
         unsigned long SampleCount[8];
         unsigned long GlobalSampleCount;
         int DisplayTimer;
         unsigned long TrackLength[50];
         unsigned int CurrentTrack;
         std::string _ssTextArea;
         std::string _sMeasurements;
         std::string _sMeasurementsIn;
         std::string _sGains;
         std::string MeterHeader;
         std::string PeakMeter;
         std::string RmsMeter;
         std::string _sResults;
         int _iResetSelect;
         int _iReset;
         double _fSM;
         double _fC2F;
         double _fLFE2F;
         double _fR2F;
         float _fMax[8];
         float _fMaxdB[8];
         double _fSumOfSquares[8];
         float _fRMS[8];
         float _fRMSdB[8];
         float LastSampleL;
         float LastSampleR;
         float PlayBackCh;
         int LFPeakTrack;
         int RFPeakTrack;
         int CPeakTrack;
         int LFEPeakTrack;
         int LSPeakTrack;
         int RSPeakTrack;
         int Loop;
         int PeakTrack[6];
//         std::vector< std::vector<float>  > _fMaxdBTrack( 50, std::vector<float>(8) );
//         std::vector< std::vector<float>  > _fRMSdBTrack( 50, std::vector<float>(8) );
         std::vector< std::vector<float>  > _fMaxdBTrack;
         std::vector< std::vector<float>  > _fRMSdBTrack;
         std::vector< std::vector<float>  > _fGaindBTrack;
         std::vector< std::vector<float>  > _fLGaindBTrack;
         std::vector< std::vector<float>  > _fNGaindBTrack;
         std::vector< std::vector<float>  > _fGainTrack;
         unsigned int _iNumTracks;
         char version[30];

    };

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Plugin: Selector

Postby boonier » Fri Dec 17, 2010 5:15 am

Ok, so for example, by declaring the Zmeter1_1 class, at compile time the compiler knows to look for Zmeter1_1.cpp in the same directory?

dts350z
Posts: 1521
Joined: Thu Jan 15, 2009 1:18 pm

Re: Plugin: Selector

Postby dts350z » Fri Dec 17, 2010 6:02 am

You have to add it, as an existing file, to the project.


Return to “Bidule SDK”

Who is online

Users browsing this forum: No registered users and 2 guests