Changeset 564

Show
Ignore:
Timestamp:
10/15/08 05:51:53 (2 months ago)
Author:
smoors
Message:

added midi-action to control master fader

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/midiAutosense/libs/hydrogen/src/action.cpp

    r563 r564  
    8585        << "BPM_DECR" 
    8686        << "BPM_CC_RELATIVE" 
     87        << "MASTER_VOLUME_RELATIVE" 
     88        << "MASTER_VOLUME_ABSOLUTE" 
    8789        << "STRIP_VOLUME_RELATIVE" 
    8890        << "STRIP_VOLUME_ABSOLUTE" 
     
    212214 
    213215 
     216 
     217 
     218        if( sActionString == "MASTER_VOLUME_RELATIVE" ){ 
     219                //increments/decrements the volume of the whole song     
     220                 
     221                bool ok; 
     222                int vol_param = pAction->getParameter2().toInt(&ok,10); 
     223                         
     224                Hydrogen *engine = Hydrogen::get_instance(); 
     225                Song *song = engine->getSong(); 
     226 
     227 
     228 
     229                if( vol_param != 0 ){ 
     230                                if ( vol_param == 1 && song->get_volume() < 1.5 ){ 
     231                                        song->set_volume( song->get_volume() + 0.05 );   
     232                                }  else  { 
     233                                        if( song->get_volume() >= 0.0 ){ 
     234                                                song->set_volume( song->get_volume() - 0.05 ); 
     235                                        } 
     236                                } 
     237                } else { 
     238                        song->set_volume( 0 ); 
     239                } 
     240 
     241        } 
     242 
     243        if( sActionString == "MASTER_VOLUME_ABSOLUTE" ){ 
     244                //sets the volume of a mixer strip to a given level (percentage) 
     245 
     246                bool ok; 
     247                int nLine = pAction->getParameter1().toInt(&ok,10); 
     248                int vol_param = pAction->getParameter2().toInt(&ok,10); 
     249                         
     250 
     251                Hydrogen *engine = Hydrogen::get_instance(); 
     252                Song *song = engine->getSong(); 
     253 
     254 
     255                if( vol_param != 0 ){ 
     256                                song->set_volume( 1.5* ( (float) (vol_param / 127.0 ) )); 
     257                } else { 
     258                                song->set_volume( 0 ); 
     259                } 
     260 
     261        } 
     262 
    214263        if( sActionString == "STRIP_VOLUME_RELATIVE" ){ 
    215264                //increments/decrements the volume of one mixer strip