Changeset 479 for GPL/trunk/lib32/soundmixer.c
- Timestamp:
- May 1, 2010, 9:49:10 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/lib32/soundmixer.c
r457 r479 80 80 }; 81 81 82 static unsigned char LinToLog[OSS32_MAX_VOLUME+1] = { 82 static unsigned char LinToLog[OSS32_MAX_VOLUME+1] = { 83 83 0, 0, 0, 0, 1, 2, 2, 5, 5, 10, 84 10, 10, 16, 19, 20, 22, 24, 25, 27, 27, 85 28, 28, 29, 30, 30, 35, 35, 35, 39, 39, 86 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 87 55, 56, 57, 59, 60, 62, 63, 64, 65, 66, 84 10, 10, 16, 19, 20, 22, 24, 25, 27, 27, 85 28, 28, 29, 30, 30, 35, 35, 35, 39, 39, 86 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 87 55, 56, 57, 59, 60, 62, 63, 64, 65, 66, 88 88 67, 68, 69, 70, 71, 72, 73, 74, 74, 75, 89 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 90 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 91 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 89 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 90 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 91 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 92 92 98, 99, 99, 99, 99, 100, 100, 100, 100, 100, 93 93 100 … … 148 148 } 149 149 //retrieve mixer information 150 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 151 SNDRV_CTL_IOCTL_CARD_INFO, 150 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 151 SNDRV_CTL_IOCTL_CARD_INFO, 152 152 (ULONG)&pHandle->info); 153 153 if(ret) { … … 157 157 pHandle->list.offset = 0; 158 158 pHandle->list.space = 0; 159 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 160 SNDRV_CTL_IOCTL_ELEM_LIST, 159 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 160 SNDRV_CTL_IOCTL_ELEM_LIST, 161 161 (ULONG)&pHandle->list); 162 162 if(ret) { … … 172 172 pHandle->list.space = pHandle->list.count; 173 173 pHandle->list.pids = pHandle->pids; 174 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 175 SNDRV_CTL_IOCTL_ELEM_LIST, 174 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 175 SNDRV_CTL_IOCTL_ELEM_LIST, 176 176 (ULONG)&pHandle->list); 177 177 if(ret) { … … 188 188 189 189 //Extract standard mixer controls from array with control names 190 for(j=0;j<OSS_MIXER_NRDEVICES;j++) 190 for(j=0;j<OSS_MIXER_NRDEVICES;j++) 191 191 { 192 192 int namelen = strlen(ossid[j].name); … … 197 197 pHandle->controls[j].idxCaptureSwitch = -1; 198 198 199 for(i=0;i<pHandle->list.count;i++) 199 for(i=0;i<pHandle->list.count;i++) 200 200 { 201 201 if (pHandle->pids[i].index == ossid[j].index && … … 209 209 break; 210 210 } 211 else 212 {//first part of the control name is correct; now find out what 211 else 212 {//first part of the control name is correct; now find out what 213 213 //is it exactly 214 214 char *nextword = &pHandle->pids[i].name[namelen]; … … 216 216 217 217 if(strncmp(nextword, MIXER_PLAYBACKVOLUME, sizeof(MIXER_PLAYBACKVOLUME)-1) == 0 || 218 strncmp(nextword, MIXER_VOLUME, sizeof(MIXER_VOLUME)-1) == 0) 218 strncmp(nextword, MIXER_VOLUME, sizeof(MIXER_VOLUME)-1) == 0) 219 219 {//volume control 220 220 pHandle->controls[j].idxVolume = i; … … 222 222 else 223 223 if(strncmp(nextword, MIXER_PLAYBACKSWITCH, sizeof(MIXER_PLAYBACKSWITCH)-1) == 0 || 224 strncmp(nextword, MIXER_SWITCH, sizeof(MIXER_SWITCH)-1) == 0) 224 strncmp(nextword, MIXER_SWITCH, sizeof(MIXER_SWITCH)-1) == 0) 225 225 {//mute control 226 226 pHandle->controls[j].idxMute = i; … … 229 229 } 230 230 else 231 if(strncmp(nextword, MIXER_SOURCE, sizeof(MIXER_SOURCE)-1) == 0) 231 if(strncmp(nextword, MIXER_SOURCE, sizeof(MIXER_SOURCE)-1) == 0) 232 232 {//source control (e.g. recording source) 233 233 pHandle->controls[j].idxCustom = i; … … 235 235 else 236 236 if(strncmp(nextword, MIXER_CAPTUREROUTE, sizeof(MIXER_CAPTUREROUTE)-1) == 0 || 237 strncmp(nextword, MIXER_CAPTURESWITCH, sizeof(MIXER_CAPTURESWITCH)-1) == 0) 237 strncmp(nextword, MIXER_CAPTURESWITCH, sizeof(MIXER_CAPTURESWITCH)-1) == 0) 238 238 {//source control for recording (per input) 239 239 pHandle->controls[j].idxCaptureSwitch = i; … … 241 241 else 242 242 if(i == OSS_MIXER_MIC) { 243 if(strncmp(nextword, MIXER_BOOST, sizeof(MIXER_BOOST)-1) == 0) 243 if(strncmp(nextword, MIXER_BOOST, sizeof(MIXER_BOOST)-1) == 0) 244 244 {//mic boost switch 245 245 pHandle->controls[j].idxCustom = i; … … 257 257 258 258 //request information about available capture sources 259 if(pHandle->controls[OSS_MIXER_IGAIN].idxCustom != -1) 259 if(pHandle->controls[OSS_MIXER_IGAIN].idxCustom != -1) 260 260 { 261 struct snd_ctl_elem_info *pElemInfo = NULL; 261 struct snd_ctl_elem_info *pElemInfo = NULL; 262 262 int idx, j; 263 263 … … 266 266 //set operation to non-blocking 267 267 pHandle->file.f_flags = O_NONBLOCK; 268 268 269 269 pHandle->rectype = RECTYPE_SELECTOR; 270 270 … … 277 277 278 278 pElemInfo->value.enumerated.items = 1; 279 for(i=0;i<pElemInfo->value.enumerated.items;i++) 279 for(i=0;i<pElemInfo->value.enumerated.items;i++) 280 280 { 281 281 pElemInfo->value.enumerated.item = i; … … 307 307 pHandle->idxRecCaps[j] = -1; 308 308 } 309 for(j=0;j<OSS_MIXER_NRDEVICES;j++) 309 for(j=0;j<OSS_MIXER_NRDEVICES;j++) 310 310 { 311 311 if(pHandle->controls[j].idxCaptureSwitch != -1) { … … 364 364 //set operation to non-blocking 365 365 pHandle->file.f_flags = O_NONBLOCK; 366 366 367 367 return OSSERR_NOT_SUPPORTED; 368 368 } … … 373 373 mixerhandle *pHandle = (mixerhandle *)streamid; 374 374 struct snd_ctl_elem_value *pElem = NULL; 375 struct snd_ctl_elem_info *pElemInfo; 375 struct snd_ctl_elem_info *pElemInfo; 376 376 int ret, idx, lVol, rVol = 0, idxMute, cnt; 377 377 378 dprintf(("OSS32_MixSetVolume line=%d\n", line)); 378 379 if(pHandle == NULL || pHandle->magic != MAGIC_MIXER_ALSA32) { 379 380 printk("Invalid handle in OSS32_MixSetVolume\n"); … … 450 451 idxMute = pHandle->controls[OSS_MIXER_PHONEOUT].idxMute; 451 452 break; 452 case OSS32_MIX_VOLUME_HEADPHONE: 453 case OSS32_MIX_VOLUME_HEADPHONE: 453 454 idx = pHandle->controls[OSS_MIXER_HEADPHONE].idxVolume; 454 455 idxMute = pHandle->controls[OSS_MIXER_HEADPHONE].idxMute; … … 557 558 mixerhandle *pHandle = (mixerhandle *)streamid; 558 559 struct snd_ctl_elem_value *pElem = NULL; 559 struct snd_ctl_elem_info *pElemInfo; 560 struct snd_ctl_elem_info *pElemInfo; 560 561 int ret, idx = -1, lVol, rVol = 0, j, i; 561 562 … … 566 567 //set operation to non-blocking 567 568 pHandle->file.f_flags = O_NONBLOCK; 568 569 569 570 //too big to put on the stack 570 571 pElem = (struct snd_ctl_elem_value *)kmalloc(sizeof(struct snd_ctl_elem_value) + sizeof(struct snd_ctl_elem_info), GFP_KERNEL); … … 591 592 else {//capture switch for each input source 592 593 //first turn off all capture switches... 593 for(j=0;j<OSS32_MIX_RECSRC_MAX;j++) 594 for(j=0;j<OSS32_MIX_RECSRC_MAX;j++) 594 595 { 595 596 if(pHandle->idxRecCaps[j] != -1) { … … 641 642 642 643 break; 643 644 644 645 case OSS32_MIX_SWITCH_MICBOOST: 645 646 idx = pHandle->controls[OSS_MIXER_MIC].idxCustom; … … 729 730 //set operation to non-blocking 730 731 pHandle->file.f_flags = O_NONBLOCK; 731 732 732 733 return OSSERR_NOT_SUPPORTED; 733 734 } … … 767 768 case OSS_MIXER_BASS: 768 769 return OSS32_MIX_LEVEL_BASS; 769 case OSS_MIXER_HEADPHONE: 770 case OSS_MIXER_HEADPHONE: 770 771 return OSS32_MIX_VOLUME_HEADPHONE; 771 772 case OSS_MIXER_SPEAKER: … … 792 793 pCaps->fuRecCaps = 0; 793 794 794 for(i=0;i<OSS_MIXER_NRDEVICES;i++) 795 for(i=0;i<OSS_MIXER_NRDEVICES;i++) 795 796 { 796 797 if(pHandle->controls[i].idxVolume != -1) { 797 798 ULONG volidx = OSSToALSAVolume(i); 798 if(volidx != -1) 799 if(volidx != -1) 799 800 pCaps->fuCtrlCaps |= OSS32_MIX_FLAG(volidx); 800 801 } … … 804 805 //then we support intput source selection 805 806 if(pHandle->controls[OSS_MIXER_IGAIN].idxCustom != -1 || 806 pHandle->rectype == RECTYPE_SWITCH) 807 { 807 pHandle->rectype == RECTYPE_SWITCH) 808 { 808 809 pCaps->fuCtrlCaps |= OSS32_MIX_FLAG(OSS32_MIX_INPUTSRC); 809 810 pCaps->fuRecCaps = pHandle->reccaps; … … 843 844 } 844 845 //retrieve mixer information 845 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 846 SNDRV_CTL_IOCTL_CARD_INFO, 846 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 847 SNDRV_CTL_IOCTL_CARD_INFO, 847 848 (ULONG)&pHandle->info); 848 849 if(ret) { … … 904 905 } 905 906 //retrieve mixer information 906 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 907 SNDRV_CTL_IOCTL_CARD_INFO, 907 ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, 908 SNDRV_CTL_IOCTL_CARD_INFO, 908 909 (ULONG)&pHandle->info); 909 910 if(ret) {
Note:
See TracChangeset
for help on using the changeset viewer.