Changeset 709
- Timestamp:
- 01/02/09 01:53:39 (4 years ago)
- Location:
- branches/new_fx_rack_and_sample_fun
- Files:
-
- 7 modified
-
. (modified) (1 prop)
-
libs/hydrogen/include/hydrogen/action.h (modified) (2 diffs)
-
libs/hydrogen/include/hydrogen/note.h (modified) (2 diffs)
-
libs/hydrogen/include/hydrogen/sampler/Sampler.h (modified) (1 diff)
-
libs/hydrogen/src/action.cpp (modified) (4 diffs)
-
libs/hydrogen/src/hydrogen.cpp (modified) (2 diffs)
-
libs/hydrogen/src/sampler/sampler.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/new_fx_rack_and_sample_fun
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/action.h
r581 r709 32 32 public: 33 33 Action( QString ); 34 35 void setParameter1( QString text ){ 36 parameter1 = text; 37 } 34 38 35 QString getType(); 39 void setParameter2( QString text ){ 40 parameter2 = text; 41 } 36 42 37 void setParameter1( QString ); 38 void setParameter2( QString ); 43 QString getParameter1(){ 44 return parameter1; 45 } 46 47 QString getParameter2(){ 48 return parameter2; 49 } 39 50 40 QString getParameter1(); 41 QString getParameter2(); 51 QString getType(){ 52 return type; 53 } 54 55 42 56 43 57 private: … … 59 73 60 74 public: 61 static ActionManager* getInstance();62 63 75 bool handleAction( Action * ); 64 76 65 QStringList getActionList(); 66 QStringList getEventList(); 77 static ActionManager* getInstance(); 78 79 QStringList getActionList(){ 80 return actionList; 81 } 82 83 QStringList getEventList(){ 84 return eventList; 85 } 67 86 68 87 ActionManager(); -
branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/note.h
r582 r709 153 153 void set_pan_l( float pan ) { 154 154 if ( pan > 0.5 ) { 155 INFOLOG( "Pan R > 0.5" );155 // INFOLOG( "Pan R > 0.5" ); 156 156 pan = 0.5; 157 157 } … … 164 164 void set_pan_r( float pan ) { 165 165 if ( pan > 0.5 ) { 166 INFOLOG( "Pan R > 0.5" );166 // INFOLOG( "Pan R > 0.5" ); 167 167 pan = 0.5; 168 168 } -
branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/sampler/Sampler.h
r706 r709 93 93 #endif 94 94 95 bool fade_note_out;96 95 97 96 unsigned __render_note( Note* pNote, unsigned nBufferSize, Song* pSong ); -
branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/action.cpp
r581 r709 40 40 41 41 /* Class Action */ 42 43 QString Action::getType(){44 return type;45 }46 47 48 49 void Action::setParameter1( QString text ){50 parameter1 = text;51 }52 53 void Action::setParameter2( QString text ){54 parameter2 = text;55 }56 57 QString Action::getParameter1(){58 return parameter1;59 }60 61 QString Action::getParameter2(){62 return parameter2;63 }64 65 42 Action::Action( QString s ) : Object( "Action" ) { 66 43 type = s; … … 71 48 72 49 /* Class ActionManager */ 73 74 50 75 51 ActionManager::ActionManager() : Object( "ActionManager" ) { … … 125 101 } 126 102 127 128 /// Return an instance of ActionManager129 103 ActionManager* ActionManager::getInstance() 130 104 { … … 132 106 instance = new ActionManager(); 133 107 } 134 108 135 109 return instance; 136 }137 138 QStringList ActionManager::getActionList(){139 return actionList;140 }141 142 QStringList ActionManager::getEventList(){143 return eventList;144 110 } 145 111 -
branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/hydrogen.cpp
r695 r709 1411 1411 void audioEngine_noteOff( Note *note ) 1412 1412 { 1413 /* 1413 1414 if ( note == NULL ) { 1414 1415 _ERRORLOG( "Error, note == NULL" ); … … 1429 1430 AudioEngine::get_instance()->unlock(); 1430 1431 delete note; 1432 */ 1431 1433 } 1432 1434 -
branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/sampler/sampler.cpp
r706 r709 76 76 __preview_instrument->set_layer( new InstrumentLayer( Sample::load( sEmptySampleFilename ) ), 0 ); 77 77 78 fade_note_out = false;79 78 } 80 79 … … 405 404 if(steps > nBufferSize) steps = nBufferSize - 1; 406 405 float substract = fadeout / steps; 406 bool fade_note_out = false; 407 407 408 408 for ( int nBufferPos = nInitialBufferPos; nBufferPos < nTimes; ++nBufferPos ) { … … 413 413 } 414 414 415 fADSRValue = pNote->m_adsr.get_value( 1 );416 fVal_L = pSample_data_L[ nSamplePos ] * fADSRValue;417 fVal_R = pSample_data_R[ nSamplePos ] * fADSRValue;418 419 // Low pass resonant filter420 if ( bUseLPF ) {421 pNote->m_fBandPassFilterBuffer_L = fResonance * pNote->m_fBandPassFilterBuffer_L + fCutoff * ( fVal_L - pNote->m_fLowPassFilterBuffer_L );422 pNote->m_fLowPassFilterBuffer_L += fCutoff * pNote->m_fBandPassFilterBuffer_L;423 fVal_L = pNote->m_fLowPassFilterBuffer_L;424 425 pNote->m_fBandPassFilterBuffer_R = fResonance * pNote->m_fBandPassFilterBuffer_R + fCutoff * ( fVal_R - pNote->m_fLowPassFilterBuffer_R );426 pNote->m_fLowPassFilterBuffer_R += fCutoff * pNote->m_fBandPassFilterBuffer_R;427 fVal_R = pNote->m_fLowPassFilterBuffer_R;428 }429 430 415 if ( __stop_notes_intrument_ids_queue.size() >0 ){ 431 416 //ERRORLOG(QString("noteoff-queue: %1, fade_note_out: %2").arg(__stop_notes_intrument_ids_queue.size()).arg(fade_note_out)); 432 417 for ( unsigned i = 0; i < __stop_notes_intrument_ids_queue.size(); ) { 433 418 QString id = __stop_notes_intrument_ids_queue[ i ]; 434 //assert( id );435 419 if ( pNote->get_instrument()->get_id() == id ) { 436 420 fade_note_out = true; … … 456 440 } 457 441 442 fADSRValue = pNote->m_adsr.get_value( 1 ); 443 fVal_L = pSample_data_L[ nSamplePos ] * fADSRValue * fadeout; 444 fVal_R = pSample_data_R[ nSamplePos ] * fADSRValue * fadeout; 445 446 // Low pass resonant filter 447 if ( bUseLPF ) { 448 pNote->m_fBandPassFilterBuffer_L = fResonance * pNote->m_fBandPassFilterBuffer_L + fCutoff * ( fVal_L - pNote->m_fLowPassFilterBuffer_L ); 449 pNote->m_fLowPassFilterBuffer_L += fCutoff * pNote->m_fBandPassFilterBuffer_L; 450 fVal_L = pNote->m_fLowPassFilterBuffer_L; 451 452 pNote->m_fBandPassFilterBuffer_R = fResonance * pNote->m_fBandPassFilterBuffer_R + fCutoff * ( fVal_R - pNote->m_fLowPassFilterBuffer_R ); 453 pNote->m_fLowPassFilterBuffer_R += fCutoff * pNote->m_fBandPassFilterBuffer_R; 454 fVal_R = pNote->m_fLowPassFilterBuffer_R; 455 } 456 458 457 #ifdef JACK_SUPPORT 459 458 if ( __audio_output->has_track_outs() … … 461 460 assert( __track_out_L[ nInstrument ] ); 462 461 assert( __track_out_R[ nInstrument ] ); 463 __track_out_L[ nInstrument ][nBufferPos] += fVal_L * cost_track_L * fadeout;464 __track_out_R[ nInstrument ][nBufferPos] += fVal_R * cost_track_R * fadeout;462 __track_out_L[ nInstrument ][nBufferPos] += fVal_L * cost_track_L; 463 __track_out_R[ nInstrument ][nBufferPos] += fVal_R * cost_track_R; 465 464 } 466 465 #endif 467 466 468 fVal_L = fVal_L * cost_L * fadeout;469 fVal_R = fVal_R * cost_R * fadeout;467 fVal_L = fVal_L * cost_L; 468 fVal_R = fVal_R * cost_R; 470 469 471 470 // update instr peak … … 594 593 float fadeout = 1.0F; 595 594 int steps = __audio_output->getSampleRate() / 100; // 1/100 sec 596 if(steps > nBufferSize) steps = nBufferSize - 1;595 if(steps > nBufferSize) steps = nBufferSize - 1; 597 596 float substract = fadeout / steps; 597 bool fade_note_out = false; 598 598 599 599 for ( int nBufferPos = nInitialBufferPos; nBufferPos < nTimes; ++nBufferPos ) { … … 612 612 fVal_L = linear_interpolation( pSample_data_L[nSamplePos], pSample_data_L[nSamplePos + 1], fDiff ); 613 613 fVal_R = linear_interpolation( pSample_data_R[nSamplePos], pSample_data_R[nSamplePos + 1], fDiff ); 614 }615 616 // ADSR envelope617 fADSRValue = pNote->m_adsr.get_value( fStep );618 fVal_L = fVal_L * fADSRValue;619 fVal_R = fVal_R * fADSRValue;620 621 // Low pass resonant filter622 if ( bUseLPF ) {623 pNote->m_fBandPassFilterBuffer_L = fResonance * pNote->m_fBandPassFilterBuffer_L + fCutoff * ( fVal_L - pNote->m_fLowPassFilterBuffer_L );624 pNote->m_fLowPassFilterBuffer_L += fCutoff * pNote->m_fBandPassFilterBuffer_L;625 fVal_L = pNote->m_fLowPassFilterBuffer_L;626 627 pNote->m_fBandPassFilterBuffer_R = fResonance * pNote->m_fBandPassFilterBuffer_R + fCutoff * ( fVal_R - pNote->m_fLowPassFilterBuffer_R );628 pNote->m_fLowPassFilterBuffer_R += fCutoff * pNote->m_fBandPassFilterBuffer_R;629 fVal_R = pNote->m_fLowPassFilterBuffer_R;630 614 } 631 615 … … 659 643 } 660 644 645 // ADSR envelope 646 fADSRValue = pNote->m_adsr.get_value( fStep ); 647 fVal_L = fVal_L * fADSRValue * fadeout; 648 fVal_R = fVal_R * fADSRValue * fadeout; 649 650 // Low pass resonant filter 651 if ( bUseLPF ) { 652 pNote->m_fBandPassFilterBuffer_L = fResonance * pNote->m_fBandPassFilterBuffer_L + fCutoff * ( fVal_L - pNote->m_fLowPassFilterBuffer_L ); 653 pNote->m_fLowPassFilterBuffer_L += fCutoff * pNote->m_fBandPassFilterBuffer_L; 654 fVal_L = pNote->m_fLowPassFilterBuffer_L; 655 656 pNote->m_fBandPassFilterBuffer_R = fResonance * pNote->m_fBandPassFilterBuffer_R + fCutoff * ( fVal_R - pNote->m_fLowPassFilterBuffer_R ); 657 pNote->m_fLowPassFilterBuffer_R += fCutoff * pNote->m_fBandPassFilterBuffer_R; 658 fVal_R = pNote->m_fLowPassFilterBuffer_R; 659 } 660 661 661 #ifdef JACK_SUPPORT 662 662 if ( __audio_output->has_track_outs() … … 664 664 assert( __track_out_L[ nInstrument ] ); 665 665 assert( __track_out_R[ nInstrument ] ); 666 __track_out_L[ nInstrument ][nBufferPos] += (fVal_L * cost_track_L * fadeout);667 __track_out_R[ nInstrument ][nBufferPos] += (fVal_R * cost_track_R * fadeout);666 __track_out_L[ nInstrument ][nBufferPos] += (fVal_L * cost_track_L); 667 __track_out_R[ nInstrument ][nBufferPos] += (fVal_R * cost_track_R); 668 668 } 669 669 #endif 670 670 671 fVal_L = fVal_L * cost_L * fadeout;672 fVal_R = fVal_R * cost_R * fadeout;671 fVal_L = fVal_L * cost_L; 672 fVal_R = fVal_R * cost_R; 673 673 674 674 // update instr peak