Changeset 4378:df6cda763dce in roaraudio


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

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/hwmixer.c

    r4373 r4378  
    4343 
    4444struct hwmixer g_hwmixers[] = { 
    45  {"oss",  "OSS Mixer", "/dev/mixer*", FLAG_FHSEC, hwmixer_oss_open, hwmixer_oss_close, hwmixer_oss_set_vol, NULL}, 
     45 {"oss",  "OSS Mixer", "/dev/mixer*", FLAG_FHSEC, hwmixer_oss_open, hwmixer_oss_close, hwmixer_oss_set_vol, hwmixer_oss_get_vol}, 
    4646 {"file", "Write to plain file", "/some/file", FLAG_FHSEC, NULL, NULL, NULL, NULL}, 
    4747 {"dstr", "Write to DSTR",       "/some/file", FLAG_NONE,  hwmixer_dstr_open, hwmixer_dstr_close, hwmixer_dstr_set_vol, NULL}, 
  • 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 
  • roard/include/hwmixer.h

    r4373 r4378  
    6060int hwmixer_oss_close(struct hwmixer_stream * stream); 
    6161int hwmixer_oss_set_vol(struct hwmixer_stream * stream, int channels, int mode, struct roar_mixer_settings * settings); 
     62int hwmixer_oss_get_vol(struct hwmixer_stream * stream, int channels, int mode, struct roar_mixer_settings * settings); 
    6263 
    6364#endif 
Note: See TracChangeset for help on using the changeset viewer.