| | 208 | if( sActionString == "STRIP_VOLUME_RELATIVE" ){ |
|---|
| | 209 | |
|---|
| | 210 | bool ok; |
|---|
| | 211 | int nLine = pAction->getParameter1().toInt(&ok,10); |
|---|
| | 212 | int vol_param = pAction->getParameter2().toInt(&ok,10); |
|---|
| | 213 | |
|---|
| | 214 | Hydrogen::get_instance()->setSelectedInstrumentNumber( nLine ); |
|---|
| | 215 | |
|---|
| | 216 | Hydrogen *engine = Hydrogen::get_instance(); |
|---|
| | 217 | Song *song = engine->getSong(); |
|---|
| | 218 | InstrumentList *instrList = song->get_instrument_list(); |
|---|
| | 219 | |
|---|
| | 220 | Instrument *instr = instrList->get( nLine ); |
|---|
| | 221 | |
|---|
| | 222 | if ( instr == NULL) return 0; |
|---|
| | 223 | |
|---|
| | 224 | if( vol_param != 0 ){ |
|---|
| | 225 | if ( vol_param == 1){ |
|---|
| | 226 | instr->set_volume( instr->get_volume() + 0.1 ); |
|---|
| | 227 | } else { |
|---|
| | 228 | instr->set_volume( instr->get_volume() - 0.1 ); |
|---|
| | 229 | } |
|---|
| | 230 | } else { |
|---|
| | 231 | instr->set_volume( 0 ); |
|---|
| | 232 | } |
|---|
| | 233 | |
|---|
| | 234 | Hydrogen::get_instance()->setSelectedInstrumentNumber(nLine); |
|---|
| | 235 | } |
|---|
| | 236 | |
|---|
| | 237 | if( sActionString == "STRIP_VOLUME_ABSOLUTE" ){ |
|---|
| | 238 | |
|---|
| | 239 | bool ok; |
|---|
| | 240 | int nLine = pAction->getParameter1().toInt(&ok,10); |
|---|
| | 241 | int vol_param = pAction->getParameter2().toInt(&ok,10); |
|---|
| | 242 | |
|---|
| | 243 | Hydrogen::get_instance()->setSelectedInstrumentNumber( nLine ); |
|---|
| | 244 | |
|---|
| | 245 | Hydrogen *engine = Hydrogen::get_instance(); |
|---|
| | 246 | Song *song = engine->getSong(); |
|---|
| | 247 | InstrumentList *instrList = song->get_instrument_list(); |
|---|
| | 248 | |
|---|
| | 249 | Instrument *instr = instrList->get( nLine ); |
|---|
| | 250 | |
|---|
| | 251 | if ( instr == NULL) return 0; |
|---|
| | 252 | |
|---|
| | 253 | if( vol_param != 0 ){ |
|---|
| | 254 | instr->set_volume( 1.5* ( (float) (vol_param / 127.0 ) )); |
|---|
| | 255 | } else { |
|---|
| | 256 | instr->set_volume( 0 ); |
|---|
| | 257 | } |
|---|
| | 258 | |
|---|
| | 259 | Hydrogen::get_instance()->setSelectedInstrumentNumber(nLine); |
|---|
| | 260 | } |
|---|
| | 261 | |
|---|