Changeset 1575:8043b974fd5a in roaraudio


Ignore:
Timestamp:
04/13/09 02:12:53 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support to set volume

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarsndio/volume.c

    r1571 r1575  
    3535 
    3636int    sio_setvol (struct sio_hdl * hdl, unsigned vol) { 
    37  return 0; 
     37 struct roar_mixer_settings mixer; 
     38 int i; 
     39 
     40 if ( hdl == NULL ) 
     41  return 0; 
     42 
     43 if ( vol > SIO_MAXVOL ) 
     44  return 0; 
     45 
     46 mixer.scale   = SIO_MAXVOL; 
     47 mixer.rpg_mul = 1; 
     48 mixer.rpg_div = 1; 
     49 
     50 for (i = 0; i < hdl->info.channels; i++) 
     51  mixer.mixer[i] = vol; 
     52 
     53 if ( roar_set_vol(&(hdl->con), roar_stream_get_id(&(hdl->stream)), &mixer, hdl->info.channels) == -1 ) 
     54  return 0; 
     55 
     56 if ( hdl->on_vol != NULL ) 
     57  hdl->on_vol(hdl->on_vol_arg, vol); 
     58 
     59 return 1; 
    3860} 
    3961 
Note: See TracChangeset for help on using the changeset viewer.