Changeset 86 for GPL/trunk/lib32/sound.c


Ignore:
Timestamp:
Jan 23, 2007, 10:34:32 PM (19 years ago)
Author:
vladest
Message:

Added missed files
Applied latest modifications of ALSA
Reworked sharing strategy between MMOS2 and UNIAUD API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/lib32/sound.c

    r85 r86  
    541541            if (opened_handles[i].handle != 0)
    542542            {
     543                ret = 0;
    543544                if (pStreamId)
    544545                    *pStreamId = (ULONG)opened_handles[i].handle;
    545                 opened_handles[i].reuse = 0; /* prevent from reusing */
     546                opened_handles[i].reuse = 1; /* try to reuse */
    546547                if (OSS32_WaveClose((OSSSTREAMID)opened_handles[i].handle) == 0)
    547548                {
    548                     OSS32_CloseUNI16(); /* say to UNIAUD16 that we closing now */
    549                     opened_handles[i].handle = 0;
    550                     ret = alsa_fops->open(&pHandle->inode, &pHandle->file);
    551                     printk("OSS32_WaveOpen. Reopen ret: %i\n", ret);
     549                    if (!opened_handles[i].reuse)
     550                    {
     551                        //opened_handles[i].handle = 0;
     552                        kfree(opened_handles[i].handle);   //free handle data
     553                        ret = alsa_fops->open(&pHandle->inode, &pHandle->file);
     554                        printk("OSS32_WaveOpen. Reopen ret: %i\n", ret);
     555                    }
     556                    else
     557                    {
     558                        kfree(pHandle);
     559                        pHandle = opened_handles[i].handle;
     560                    }
    552561                    break;
    553562                }
     563            }
     564        }
     565    }
     566    else if (ret == 0)
     567    {
     568        for (i=0; i < 8*256; i++)
     569        {
     570            if (opened_handles[i].handle == 0)
     571            {
     572                opened_handles[i].handle = pHandle;
     573                opened_handles[i].FileId = fileid;
     574                break;
    554575            }
    555576        }
     
    566587        *pStreamId = (ULONG)pHandle;
    567588    // filling opened handles table
    568     for (i=0; i < 8*256; i++)
    569     {
    570         if (opened_handles[i].handle == 0)
    571         {
    572             opened_handles[i].handle = pHandle;
    573             opened_handles[i].FileId = fileid;
    574             break;
    575         }
    576     }
    577589    printk("OSS32_WaveOpen. streamid %X\n",(ULONG)pHandle);
    578590    return OSSERR_SUCCESS;
     
    604616                opened_handles[i].handle = 0;
    605617                kfree(pHandle);   //free handle data
     618                OSS32_CloseUNI16(); /* say to UNIAUD16 that we closing now */
    606619            } else
    607620            {
    608621                /* prepare for reuse */
     622                pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_RESET, 0);
    609623                pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);
    610624            }
     
    762776#endif
    763777    if(pHandle == NULL || pHandle->magic != MAGIC_WAVE_ALSA32) {
    764         printk("OSS32_WaveSetHwParams error. Invalid handle\n");
     778        printk("OSS32_WaveSetHwParams error. Invalid handle: %x\n", pHandle);
    765779        DebugInt3();
    766780        return OSSERR_INVALID_STREAMID;
     
    10891103    size = min(size, samples_to_bytes(status.avail));
    10901104    if (size1 != size)
    1091         printk("requested size [%i] less then available [%s]\n", size1, size);
     1105        printk("requested size [%i] less then available [%i]\n", size1, size);
    10921106#if 0
    10931107    if (size < per_bytes)
Note: See TracChangeset for help on using the changeset viewer.