Changeset 2440

Show
Ignore:
Timestamp:
05/03/99 14:11:36 (15 years ago)
Author:
ucacoxh
Message:

- Scaling problem in audio_get_ogain fixed. This must have been broken since

the first ever rat win32. Only time it would manifest itself was when disabling
receive on ui.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • rat/trunk/auddev_win32.c

    r2432 r2440  
    2525#include "mmsystem.h" 
    2626 
    27 #define rat_to_device(x)        ((x) * 255 / MAX_AMP) 
    28 #define device_to_rat(x)        ((x) * MAX_AMP / 255) 
     27#define MAX_DEVICE_GAIN 0xffff 
     28#define rat_to_device(x)        (((x) * MAX_DEVICE_GAIN / MAX_AMP) << 16 | ((x) * MAX_DEVICE_GAIN / MAX_AMP)) 
     29#define device_to_rat(x)        ((x & 0xffff) * MAX_AMP / MAX_DEVICE_GAIN) 
    2930 
    3031#define W32SDK_MAX_DEVICES 5 
     
    12931294                return; 
    12941295         
    1295         level = rat_to_device(level); 
    1296         if (level >= 255) 
    1297                 level = (short)-1; 
    1298         else 
    1299                 level <<= 8; 
    1300         vol = level | (level << 16); 
    1301          
     1296        vol = rat_to_device(level); 
    13021297        error = waveOutSetVolume(shWaveOut, vol); 
    13031298        if (error) { 
     
    13221317                debug_msg("Win32Audio: waveOutGetVolume Error: %s\n", errorText); 
    13231318                return (0); 
    1324         } else 
    1325                 return (device_to_rat(vol & 0xff)); 
     1319        } else { 
     1320                return (device_to_rat(vol)); 
     1321        } 
    13261322} 
    13271323