MCPcopy Create free account
hub / github.com/LMMS/lmms / pluginInstantiation

Method pluginInstantiation

plugins/LadspaEffect/LadspaEffect.cpp:283–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281
282
283void LadspaEffect::pluginInstantiation()
284{
285 m_maxSampleRate = maxSamplerate( displayName() );
286
287 Ladspa2LMMS * manager = Engine::getLADSPAManager();
288
289 // Calculate how many processing units are needed.
290 const ch_cnt_t lmms_chnls = Engine::mixer()->audioDev()->channels();
291 int effect_channels = manager->getDescription( m_key )->inputChannels;
292 setProcessorCount( lmms_chnls / effect_channels );
293
294 // get inPlaceBroken property
295 m_inPlaceBroken = manager->isInplaceBroken( m_key );
296
297 // Categorize the ports, and create the buffers.
298 m_portCount = manager->getPortCount( m_key );
299
300 int inputch = 0;
301 int outputch = 0;
302 LADSPA_Data * inbuf [2];
303 inbuf[0] = NULL;
304 inbuf[1] = NULL;
305 for( ch_cnt_t proc = 0; proc < processorCount(); proc++ )
306 {
307 multi_proc_t ports;
308 for( int port = 0; port < m_portCount; port++ )
309 {
310 port_desc_t * p = new PortDescription;
311
312 p->name = manager->getPortName( m_key, port );
313 p->proc = proc;
314 p->port_id = port;
315 p->control = NULL;
316 p->buffer = NULL;
317
318 // Determine the port's category.
319 if( manager->isPortAudio( m_key, port ) )
320 {
321 if( p->name.toUpper().contains( "IN" ) &&
322 manager->isPortInput( m_key, port ) )
323 {
324 p->rate = CHANNEL_IN;
325 p->buffer = MM_ALLOC( LADSPA_Data, Engine::mixer()->framesPerPeriod() );
326 inbuf[ inputch ] = p->buffer;
327 inputch++;
328 }
329 else if( p->name.toUpper().contains( "OUT" ) &&
330 manager->isPortOutput( m_key, port ) )
331 {
332 p->rate = CHANNEL_OUT;
333 if( ! m_inPlaceBroken && inbuf[ outputch ] )
334 {
335 p->buffer = inbuf[ outputch ];
336 outputch++;
337 }
338 else
339 {
340 p->buffer = MM_ALLOC( LADSPA_Data, Engine::mixer()->framesPerPeriod() );

Callers

nothing calls this directly

Calls 15

getLADSPAManagerFunction · 0.85
mixerFunction · 0.85
setProcessorCountFunction · 0.85
processorCountFunction · 0.85
setOkayFunction · 0.85
setDontRunFunction · 0.85
channelsMethod · 0.80
getDescriptionMethod · 0.80
isInplaceBrokenMethod · 0.80
getPortCountMethod · 0.80
getPortNameMethod · 0.80
isPortAudioMethod · 0.80

Tested by

no test coverage detected