Rev 20 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 20 | Rev 21 | ||
|---|---|---|---|
| Line 340... | Line 340... | ||
| 340 | int S3SyncSampleVolumeAndPan(tS3_channel* chan) { |
340 | int S3SyncSampleVolumeAndPan(tS3_channel* chan) { |
| 341 | 341 | ||
| 342 | float pan_ratio; // [esp+38h] [ebp-8h] |
342 | float pan_ratio; // [esp+38h] [ebp-8h] |
| 343 | float total_vol; // [esp+3Ch] [ebp-4h] |
343 | float total_vol; // [esp+3Ch] [ebp-4h] |
| 344 | 344 | ||
| 345 | int volume_db; |
- | |
| 346 | int pan; |
345 | int pan; |
| 347 | //float linear_volume; // Pierre-Marie Baty -- unused variable |
- | |
| 348 | 346 | ||
| 349 | if (chan->type != eS3_ST_sample) { |
347 | if (chan->type != eS3_ST_sample) { |
| 350 | return 1; |
348 | return 1; |
| 351 | } |
349 | } |
| 352 | total_vol = (float) (chan->left_volume + chan->right_volume); // Pierre-Marie Baty -- added type cast |
350 | total_vol = (float) (chan->left_volume + chan->right_volume); // Pierre-Marie Baty -- added type cast |
| 353 | if (total_vol == 0.0f) { |
351 | if (total_vol == 0.0f) { |
| 354 | total_vol = 1.0f; |
352 | total_vol = 1.0f; |
| 355 | } |
353 | } |
| 356 | if (chan->descriptor && chan->descriptor->type == chan->type) { |
354 | if (chan->descriptor && chan->descriptor->type == chan->type) { |
| 357 | volume_db = (int) (510.0f / total_vol * -5.0f - 350.0f); // Pierre-Marie Baty -- added type cast |
- | |
| 358 | if (volume_db >= 0) { |
- | |
| 359 | volume_db = 0; |
- | |
| 360 | } |
- | |
| 361 | 355 | ||
| 362 | if (AudioBackend_SetVolume(chan, |
356 | if (AudioBackend_SetVolume(chan, total_vol) == eAB_success && chan->spatial_sound) { |
| 363 | 357 | ||
| 364 | if (chan->left_volume != 0 && chan->right_volume > chan->left_volume) { |
358 | if (chan->left_volume != 0 && chan->right_volume > chan->left_volume) { |
| 365 | pan_ratio = chan->right_volume / (float)chan->left_volume; |
359 | pan_ratio = chan->right_volume / (float)chan->left_volume; |
| 366 | } else if (chan->right_volume != 0) { |
360 | } else if (chan->right_volume != 0) { |
| 367 | pan_ratio = chan->left_volume / (float)chan->right_volume; |
361 | pan_ratio = chan->left_volume / (float)chan->right_volume; |