Advertisement
Guest User

Untitled

a guest
Oct 28th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     NSIndexSet* getSupportedViewConfigurations (NSArray<AUAudioUnitViewConfiguration*>* configs) override
  2.     {
  3.         auto supportedViewIndecies = [[NSMutableIndexSet alloc] init];
  4.         auto n = [configs count];
  5.  
  6.         if (auto* editor = getAudioProcessor().createEditorIfNeeded())
  7.         {
  8.             for (auto i = 0u; i < n; ++i)
  9.             {
  10.                 if (auto* viewConfiguration = [configs objectAtIndex:i])
  11.                 {
  12.                     if (editor->supportsHostMIDIControllerPresence ([viewConfiguration hostHasController] == YES))
  13.                     {
  14.                         auto* constrainer = editor->getConstrainer();
  15.                         auto height = (int) [viewConfiguration height];
  16.                         auto width  = (int) [viewConfiguration width];
  17.  
  18.                         if (height <= constrainer->getMaximumHeight() && height >= constrainer->getMinimumHeight()
  19.                          && width  <= constrainer->getMaximumWidth()  && width  >= constrainer->getMinimumWidth())
  20.                             [supportedViewIndecies addIndex: i];
  21.                     }
  22.                 }
  23.             }
  24.         }
  25.  
  26.         return [supportedViewIndecies autorelease];
  27.     }
  28.  
  29.     void selectViewConfiguration (AUAudioUnitViewConfiguration* config) override
  30.     {
  31.         processorHolder->viewConfiguration.reset (new AudioProcessorHolder::ViewConfig { [config width], [config height], [config hostHasController] == YES });
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement