| | 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 | |
|---|