Ignore:
Timestamp:
Jul 17, 2007, 6:04:31 PM (18 years ago)
Author:
Brendan Oakley
Message:

Applied latest updates from Vlad

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OCO/trunk/drv16/waveplay.cpp

    r134 r221  
    4040
    4141int waveOpened = 0;
    42 
     42int force_closed = 0;
     43extern int fAPMSuspend;
     44void far apm_resume(void);
    4345extern "C"
    4446{
     
    4749}
    4850
     51/*
     52 * save already opened by mmos2
     53 * to reuse in case of reopen stream needed
     54 * TODO!! if there is more right way?
     55 */
     56ULONG ulDeviceSave, ulStreamTypeSave, ulSysFileNumSave;
    4957//******************************************************************************
    5058//******************************************************************************
     
    5563    dprintf(("WAVEPLAY::Open %lx",StreamId));
    5664#endif
     65    if (fAPMSuspend)
     66    {
     67#ifdef DEBUG
     68        dprintf(("WAVEPLAY::Open. Suspend state"));
     69#endif
     70        apm_resume();
     71        //return FALSE;
     72    }
     73
    5774    if(StreamId == 0UL)
    5875    {
     
    7390        //if the device supports multiple active streams, then we always open
    7491        //a new ALSA stream
    75         if(devCaps[ulDevice].waveOutCaps.nrStreams == 1) {
     92        //if(devCaps[ulDevice].waveOutCaps.nrStreams == 1) {
    7693            StreamId = *pStreamId;
    77         }
     94        //}
     95        ulDeviceSave = ulDevice;
     96        ulStreamTypeSave = ulStreamType;
     97        ulSysFileNumSave = ulSysFileNum;
    7898    }
    7999    else {
     
    85105//******************************************************************************
    86106//******************************************************************************
    87 BOOL WAVEPLAY::Close(OSSSTREAMID StreamId)
     107BOOL WAVEPLAY::Close(OSSSTREAMID StreamIdl)
    88108{
    89109#ifdef DEBUG
     
    93113    //if ((open_strategy & 1))
    94114    //if (waveOpened == 1)
    95     if (0)
    96     {
    97         if (OSS16_WaveClose(StreamId) == OSSERR_SUCCESS)
    98         {
    99             waveOpened--;
    100             StreamId = 0UL;
    101             open_strategy = 0UL;
    102 #ifdef DEBUG
    103             dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx\n", StreamId, waveOpened,open_strategy));
    104 #endif
    105             return TRUE;
    106         }
    107         return FALSE;
     115    if (force_closed)
     116    {
     117        waveOpened--;
     118        StreamId = 0UL;
     119        open_strategy = 0UL;
     120        force_closed = 0;
     121#ifdef DEBUG
     122        dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx\n", StreamId, waveOpened,open_strategy));
     123#endif
     124        return TRUE;
    108125    }
    109126    else
    110127#endif // fixme to be gone?
    111128    {
    112         if(devCaps[ulDeviceNr].waveOutCaps.nrStreams > 1)
     129        //if(devCaps[ulDeviceNr].waveOutCaps.nrStreams > 1)
     130        if (0)
    113131        {
    114             if (OSS16_WaveClose(StreamId) == OSSERR_SUCCESS)
     132            if (OSS16_WaveClose(StreamIdl) == OSSERR_SUCCESS)
    115133            {
    116134                waveOpened--;
     
    139157#endif
    140158
    141 //    if (!waveOpened) return TRUE;
     159    if (fAPMSuspend)
     160    {
     161#ifdef DEBUG
     162        dprintf(("WAVEPLAY::ConfigDev. Suspend state"));
     163#endif
     164        apm_resume();
     165        //return FALSE;
     166    }
     167
     168    if (StreamId == NULL)
     169    {
     170        WAVEPLAY::Open(ulDeviceSave, ulStreamTypeSave, ulSysFileNumSave, &StreamId);
     171        if (StreamId == NULL)
     172        {
     173#ifdef DEBUG
     174            dprintf(("WAVEPLAY::ConfigDev. Error reopening stream"));
     175#endif
     176            return FALSE;
     177        }
     178    }
    142179#ifdef DEBUG
    143180    dprintf(("WAVEPLAY::ConfigDev1 SampleRate %d", pConfigInfo->ulHwSampleRate));
     
    230267//    dprintf(("WAVEPLAY::Transfer"));
    231268#endif
     269
     270    if (fAPMSuspend)
     271    {
     272#ifdef DEBUG
     273        dprintf(("WAVEPLAY::Transfer. Suspend state"));
     274#endif
     275        apm_resume();
     276        //return FALSE;
     277    }
    232278
    233279//    if (!waveOpened) return TRUE;
     
    283329//    if (!waveOpened) return TRUE;
    284330
     331    if (fAPMSuspend)
     332    {
     333#ifdef DEBUG
     334        dprintf(("WAVEPLAY::AddBuffer. Suspend state"));
     335#endif
     336        apm_resume();
     337        //return FALSE;
     338    }
     339
    285340    if(pConfigInfo->fSampleRateConversion)
    286341    {
Note: See TracChangeset for help on using the changeset viewer.