Changeset 709

Show
Ignore:
Timestamp:
01/02/09 01:53:39 (4 years ago)
Author:
wolke
Message:

merge 707:708 from trunk

Location:
branches/new_fx_rack_and_sample_fun
Files:
7 modified

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  
    3232        public: 
    3333                Action( QString ); 
     34                         
     35                void setParameter1( QString text ){ 
     36                        parameter1 = text; 
     37                } 
    3438                 
    35                 QString getType(); 
     39                void setParameter2( QString text ){ 
     40                        parameter2 = text; 
     41                } 
    3642                 
    37                 void setParameter1( QString ); 
    38                 void setParameter2( QString ); 
     43                QString getParameter1(){ 
     44                        return parameter1; 
     45                } 
     46                 
     47                QString getParameter2(){ 
     48                        return parameter2; 
     49                } 
    3950 
    40                 QString getParameter1(); 
    41                 QString getParameter2(); 
     51                QString getType(){ 
     52                        return type; 
     53                } 
     54                 
     55 
    4256 
    4357        private: 
     
    5973 
    6074        public: 
    61                 static ActionManager* getInstance(); 
    62  
    6375                bool handleAction( Action * ); 
    6476                 
    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                } 
    6786 
    6887                ActionManager(); 
  • branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/note.h

    r582 r709  
    153153        void set_pan_l( float pan ) { 
    154154                if ( pan > 0.5 ) { 
    155                         INFOLOG( "Pan R > 0.5" ); 
     155//                      INFOLOG( "Pan R > 0.5" ); 
    156156                        pan = 0.5; 
    157157                } 
     
    164164        void set_pan_r( float pan ) { 
    165165                if ( pan > 0.5 ) { 
    166                         INFOLOG( "Pan R > 0.5" ); 
     166//                      INFOLOG( "Pan R > 0.5" ); 
    167167                        pan = 0.5; 
    168168                } 
  • branches/new_fx_rack_and_sample_fun/libs/hydrogen/include/hydrogen/sampler/Sampler.h

    r706 r709  
    9393#endif 
    9494 
    95         bool fade_note_out; 
    9695 
    9796        unsigned __render_note( Note* pNote, unsigned nBufferSize, Song* pSong ); 
  • branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/action.cpp

    r581 r709  
    4040 
    4141/* 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  
    6542Action::Action( QString s ) : Object( "Action" ) { 
    6643        type = s; 
     
    7148 
    7249/* Class ActionManager */ 
    73  
    7450 
    7551ActionManager::ActionManager() : Object( "ActionManager" ) { 
     
    125101} 
    126102 
    127  
    128 /// Return an instance of ActionManager 
    129103ActionManager* ActionManager::getInstance() 
    130104{ 
     
    132106                instance = new ActionManager(); 
    133107        } 
    134          
     108                         
    135109        return instance; 
    136 } 
    137  
    138 QStringList ActionManager::getActionList(){ 
    139         return actionList; 
    140 } 
    141  
    142 QStringList ActionManager::getEventList(){ 
    143         return eventList; 
    144110} 
    145111 
  • branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/hydrogen.cpp

    r695 r709  
    14111411void audioEngine_noteOff( Note *note ) 
    14121412{ 
     1413/* 
    14131414        if ( note == NULL )     { 
    14141415                _ERRORLOG( "Error, note == NULL" ); 
     
    14291430        AudioEngine::get_instance()->unlock(); 
    14301431        delete note; 
     1432*/ 
    14311433} 
    14321434 
  • branches/new_fx_rack_and_sample_fun/libs/hydrogen/src/sampler/sampler.cpp

    r706 r709  
    7676        __preview_instrument->set_layer( new InstrumentLayer( Sample::load( sEmptySampleFilename ) ), 0 ); 
    7777 
    78         fade_note_out = false; 
    7978} 
    8079 
     
    405404                if(steps > nBufferSize) steps = nBufferSize - 1; 
    406405        float substract = fadeout / steps; 
     406        bool fade_note_out = false; 
    407407         
    408408        for ( int nBufferPos = nInitialBufferPos; nBufferPos < nTimes; ++nBufferPos ) { 
     
    413413                } 
    414414 
    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 filter 
    420                 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  
    430415                if ( __stop_notes_intrument_ids_queue.size() >0 ){ 
    431416                        //ERRORLOG(QString("noteoff-queue: %1, fade_note_out: %2").arg(__stop_notes_intrument_ids_queue.size()).arg(fade_note_out)); 
    432417                        for ( unsigned i = 0; i < __stop_notes_intrument_ids_queue.size(); ) { 
    433418                                QString id = __stop_notes_intrument_ids_queue[ i ]; 
    434                                 //assert( id ); 
    435419                                if ( pNote->get_instrument()->get_id() == id ) { 
    436420                                        fade_note_out = true; 
     
    456440                } 
    457441 
     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 
    458457#ifdef JACK_SUPPORT 
    459458                if ( __audio_output->has_track_outs() 
     
    461460                        assert( __track_out_L[ nInstrument ] ); 
    462461                        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; 
    465464                } 
    466465#endif 
    467466 
    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; 
    470469 
    471470                // update instr peak 
     
    594593        float fadeout = 1.0F; 
    595594        int steps = __audio_output->getSampleRate() / 100; // 1/100 sec 
    596                 if(steps > nBufferSize) steps = nBufferSize - 1; 
     595        if(steps > nBufferSize) steps = nBufferSize - 1; 
    597596        float substract = fadeout / steps; 
     597        bool fade_note_out = false; 
    598598 
    599599        for ( int nBufferPos = nInitialBufferPos; nBufferPos < nTimes; ++nBufferPos ) { 
     
    612612                        fVal_L = linear_interpolation( pSample_data_L[nSamplePos], pSample_data_L[nSamplePos + 1], fDiff ); 
    613613                        fVal_R = linear_interpolation( pSample_data_R[nSamplePos], pSample_data_R[nSamplePos + 1], fDiff ); 
    614                 } 
    615  
    616                 // ADSR envelope 
    617                 fADSRValue = pNote->m_adsr.get_value( fStep ); 
    618                 fVal_L = fVal_L * fADSRValue; 
    619                 fVal_R = fVal_R * fADSRValue; 
    620  
    621                 // Low pass resonant filter 
    622                 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; 
    630614                } 
    631615 
     
    659643                } 
    660644 
     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 
    661661#ifdef JACK_SUPPORT 
    662662                if ( __audio_output->has_track_outs() 
     
    664664                        assert( __track_out_L[ nInstrument ] ); 
    665665                        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); 
    668668                } 
    669669#endif 
    670670 
    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; 
    673673 
    674674                // update instr peak