Advertisement
GreenSeaCow

Add RNBO to Wwise Plugin

Jan 26th, 2024
774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.04 KB | None | 0 0
  1. //Step 1:
  2.  
  3. //Copy the folder you exported from MaxMSP into your Wwise plugin project folder.
  4.  
  5. //Step 2:
  6.  
  7. //In you visual studio project, right click on your project module in the left panel (where all your code files are listed), and select //"add existing".  Your file browser will open up.  Go inside the RNBO export folder (the one you copied into the Wwise plugin folder) //and select the "rnbo_synthezzito_source.cpp" file.  Repeat this step and also add the "RNBO.cpp" file.    
  8.  
  9. //Step 3:
  10.  
  11. //In your SynthezzitoSource.h file, and the following 'include' statement after the indef/define code:
  12.  
  13. #ifndef  SynthezzitoSource_H
  14. #define  SynthezzitoSource_H
  15.  
  16. #include "RNBO.h"
  17.  
  18. //Step 4:
  19.  
  20. //In the same file as the last step, add this code at the bottom of the file (just the last line):
  21.  
  22. private:
  23.     SynthezzitoSourceParams* m_pParams;
  24.     AK::IAkPluginMemAlloc* m_pAllocator;
  25.     AK::IAkSourcePluginContext* m_pContext;
  26.     AkFXDurationHandler m_durationHandler;
  27.  
  28.     RNBO::CoreObject rnboObject;
  29. };
  30.  
  31. //Step 5:
  32.  
  33. //Replace you Execute function code with this:
  34.  
  35. void SynthezzitoSource::Execute(AkAudioBuffer* out_pBuffer)
  36. {
  37.  
  38.     m_durationHandler.SetDuration(m_pParams->RTPC.fDuration);
  39.     m_durationHandler.ProduceBuffer(out_pBuffer);
  40.  
  41.  
  42.     //Process
  43.  
  44.     rnboObject.prepareToProcess(48000, out_pBuffer->uValidFrames);
  45.  
  46.     RNBO::SampleValue** outputs = new RNBO::SampleValue * [1];
  47.     outputs[0] = new double[out_pBuffer->uValidFrames];
  48.  
  49.     rnboObject.process(nullptr, 0, outputs, 1, out_pBuffer->uValidFrames);
  50.  
  51.     const AkUInt32 uNumChannels = out_pBuffer->NumChannels();
  52.  
  53.     AkUInt16 uFramesProduced;
  54.     for (AkUInt32 i = 0; i < uNumChannels; ++i)
  55.     {
  56.         AkReal32* AK_RESTRICT pBuf = (AkReal32 * AK_RESTRICT)out_pBuffer->GetChannel(i);
  57.  
  58.         uFramesProduced = 0;
  59.         while (uFramesProduced < out_pBuffer->uValidFrames)
  60.         {
  61.             // Generate output here
  62.             *pBuf++ = static_cast<AkReal32>(((outputs[0][uFramesProduced]) * 0.5f));
  63.             ++uFramesProduced;
  64.         }
  65.     }
  66. }
  67.  
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement