| 319 | |
| 320 | |
| 321 | void vestigeInstrument::loadFile( const QString & _file ) |
| 322 | { |
| 323 | m_pluginMutex.lock(); |
| 324 | const bool set_ch_name = ( m_plugin != NULL && |
| 325 | instrumentTrack()->name() == m_plugin->name() ) || |
| 326 | instrumentTrack()->name() == InstrumentTrack::tr( "Default preset" ) || |
| 327 | instrumentTrack()->name() == displayName(); |
| 328 | |
| 329 | m_pluginMutex.unlock(); |
| 330 | |
| 331 | if ( m_plugin != NULL ) |
| 332 | { |
| 333 | closePlugin(); |
| 334 | } |
| 335 | m_pluginDLL = SampleBuffer::tryToMakeRelative( _file ); |
| 336 | TextFloat * tf = NULL; |
| 337 | if( gui ) |
| 338 | { |
| 339 | tf = TextFloat::displayMessage( |
| 340 | tr( "Loading plugin" ), |
| 341 | tr( "Please wait while loading VST-plugin..." ), |
| 342 | PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 ); |
| 343 | } |
| 344 | |
| 345 | m_pluginMutex.lock(); |
| 346 | m_plugin = new VstInstrumentPlugin( m_pluginDLL ); |
| 347 | if( m_plugin->failed() ) |
| 348 | { |
| 349 | m_pluginMutex.unlock(); |
| 350 | closePlugin(); |
| 351 | delete tf; |
| 352 | collectErrorForUI( VstPlugin::tr( "The VST plugin %1 could not be loaded." ).arg( m_pluginDLL ) ); |
| 353 | m_pluginDLL = ""; |
| 354 | return; |
| 355 | } |
| 356 | |
| 357 | m_plugin->createUI(nullptr); |
| 358 | m_plugin->showUI(); |
| 359 | |
| 360 | if( set_ch_name ) |
| 361 | { |
| 362 | instrumentTrack()->setName( m_plugin->name() ); |
| 363 | } |
| 364 | |
| 365 | m_pluginMutex.unlock(); |
| 366 | |
| 367 | emit dataChanged(); |
| 368 | |
| 369 | delete tf; |
| 370 | } |
| 371 | |
| 372 | |
| 373 |
no test coverage detected