Changeset 4378:df6cda763dce in roaraudio for roard/hwmixer_oss.c


Ignore:
Timestamp:
09/14/10 22:07:07 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

implemented support to read mixer values from hwmixer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/hwmixer_oss.c

    r4373 r4378  
    182182} 
    183183 
     184int hwmixer_oss_get_vol(struct hwmixer_stream * stream, int channels, int mode, struct roar_mixer_settings * settings) { 
     185 struct roar_vio_calls * vio = stream->baseud; 
     186 struct roar_vio_sysio_ioctl ctl; 
     187 struct subdev         * subdev = stream->ud; 
     188 int i; 
     189 int l, r; 
     190 
     191 ctl.cmd = subdev->cmd_read; 
     192 ctl.argp = &i; 
     193 
     194 if ( roar_vio_ctl(vio, ROAR_VIO_CTL_SYSIO_IOCTL, &ctl) == -1 ) 
     195  return -1; 
     196 
     197 l =  i       & 0xFF; 
     198 r = (i >> 8) & 0xFF; 
     199 
     200 if ( subdev->channels == 1 ) 
     201  r = l; 
     202 
     203 settings->scale    = OSS_VOLUME_SCALE; 
     204 
     205 if ( channels == 1 ) { 
     206  settings->mixer[0] = (l + r) / 2; 
     207 } else if ( channels == 2 ) { 
     208  settings->mixer[0] = l; 
     209  settings->mixer[1] = r; 
     210 } else { 
     211  return -1; 
     212 } 
     213 
     214 return 0; 
     215} 
     216 
    184217//ll 
Note: See TracChangeset for help on using the changeset viewer.