Changeset 4182:b669a0fb30b8 in roaraudio
- Timestamp:
- 08/14/10 15:47:57 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vs.c
r4181 r4182 343 343 size_t i; 344 344 register float s; 345 int oldchannels; 346 int handled; 345 347 346 348 if ( !(vss->flags & FLAG_STREAM) ) { … … 351 353 if ( channels > ROAR_MAX_CHANNELS ) { 352 354 _seterr(ROAR_ERROR_INVAL); 355 return -1; 356 } 357 358 if ( roar_get_vol(vss->con, roar_stream_get_id(&(vss->stream)), &mixer, &oldchannels) == -1 ) { 359 _seterr(ROAR_ERROR_UNKNOWN); 353 360 return -1; 354 361 } … … 368 375 369 376 mixer.scale = 65535; 370 mixer.rpg_mul = 1; 371 mixer.rpg_div = 1; 377 378 if ( channels != oldchannels ) { 379 handled = 0; 380 switch (oldchannels) { 381 case 1: 382 if ( channels == 2 ) { 383 mixer.mixer[0] = (mixer.mixer[0] + mixer.mixer[1]) / 2; 384 handled = 1; 385 } 386 break; 387 case 2: 388 if ( channels == 1 ) { 389 mixer.mixer[1] = mixer.mixer[0]; 390 handled = 1; 391 } 392 break; 393 case 4: 394 if ( channels == 1 ) { 395 mixer.mixer[1] = mixer.mixer[0]; 396 mixer.mixer[2] = mixer.mixer[0]; 397 mixer.mixer[3] = mixer.mixer[0]; 398 handled = 1; 399 } else if ( channels == 2 ) { 400 mixer.mixer[2] = mixer.mixer[0]; 401 mixer.mixer[3] = mixer.mixer[1]; 402 handled = 1; 403 } 404 break; 405 } 406 if ( handled ) { 407 channels = oldchannels; 408 } else { 409 _seterr(ROAR_ERROR_INVAL); 410 return -1; 411 } 412 } 372 413 373 414 if ( roar_set_vol(vss->con, roar_stream_get_id(&(vss->stream)), &mixer, channels) == -1 ) {
Note: See TracChangeset
for help on using the changeset viewer.