Ignore:
Timestamp:
Apr 5, 2008, 10:09:19 AM (17 years ago)
Author:
Paul Smedley
Message:

Cleanups + more elegant fix for HW Param setting problem for HDA that was in changeset 332

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.0/lib32/sound.c

    r332 r339  
    809809    pHandle->doublesamplesize  = samplesize * 2;
    810810    pHandle->doublesamplesize *= pHwParams->ulNumChannels;
    811     periodbytes = pHwParams->ulPeriodSize;
    812     periodsize  = bytes_to_samples(periodbytes);
     811//    periodbytes = pHwParams->ulPeriodSize;
     812//    periodsize  = bytes_to_samples(periodbytes);
     813    periodsize = pHwParams->ulPeriodSize;
     814    periodbytes = samples_to_bytes(periodsize);
    813815    // checking number of channels
    814816
    815     printk("channels: %i, period size: %i\n",pHwParams->ulNumChannels, periodbytes);
     817    printk("channels: %i, period bytes: %i\n",pHwParams->ulNumChannels, periodbytes);
    816818    _snd_pcm_hw_params_any(&params);
    817819    ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(&params));
     
    926928        periodbytes = maxperiodbytes;
    927929    }
    928 
    929930    minperiodsize = hw_param_interval((&params), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min;
    930931    maxperiodsize = hw_param_interval((&params), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->max;
     
    936937        periodsize = maxperiodsize;
    937938    }
    938 
    939939    if(samples_to_bytes(periodsize) < periodbytes) {
    940940        periodbytes = samples_to_bytes(periodsize);
     
    944944        periodsize = bytes_to_samples(periodbytes);
    945945    }
    946 
    947946    //make sure period size is a whole fraction of the buffer size
    948947    bufsize = hw_param_interval((&params), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->max;
     
    992991    _snd_pcm_hw_param_set(&params, SNDRV_PCM_HW_PARAM_RATE,
    993992                          pHwParams->ulSampleRate, 0);
    994 #if 0
    995993    _snd_pcm_hw_param_set(&params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
    996994                          periodsize, 0);
     
    10031001    _snd_pcm_hw_param_set(&params, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
    10041002                          periodbytes*nrperiods, 0);
    1005 #endif
     1003
    10061004//#ifdef DEBUG_PK
    10071005    printk("Hardware parameters: sample rate %i, data type %i, channels %i, period size %i, periods %i\n",
     
    10091007//#endif
    10101008    ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)__Stack32ToFlat(&params));
    1011     if (ret == -77 && fTryAgain == FALSE)
     1009    printk("OSS32_WaveSetHwParams return %d after SNDRV_PCM_IOCTL_HW_PARAMS ioctl", ret);
     1010    if (ret == -77 && fTryAgain == FALSE)
    10121011    {
    10131012        ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);
Note: See TracChangeset for help on using the changeset viewer.