Changeset 473


Ignore:
Timestamp:
Nov 9, 2009, 2:36:35 AM (16 years ago)
Author:
pasha
Message:

Fix buffers overflow problem, check Flash10, fix some strange code

Location:
OCO/trunk/drv16
Files:
10 edited

Legend:

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

    r33 r473  
    128128      OPERATION_RECORD
    129129   },
    130    {  // Last device is marked as AUDIOHW_INVALID_DEVICE
    131       AUDIOHW_INVALID_DEVICE,
    132       -1,
    133       -1,
    134       -1
    135    },
    136    {  // Last device is marked as AUDIOHW_INVALID_DEVICE
    137       AUDIOHW_INVALID_DEVICE,
    138       -1,
    139       -1,
    140       -1
     130   {  // ALSA PCM support ADPCM
     131      AUDIOHW_WAVE_PLAY,
     132      0,
     133      DATATYPE_ADPCM_AVC,
     134      OPERATION_PLAY
     135   },
     136   {  //
     137      AUDIOHW_INVALID_DEVICE,
     138      0,
     139      DATATYPE_ADPCM_AVC,
     140      OPERATION_RECORD
    141141   },
    142142   {  // Last device is marked as AUDIOHW_INVALID_DEVICE
     
    281281{
    282282   int i;
    283 
    284283   for (i = 0;
    285284       ((i < NUM_HARDWARE_DEVICE_TYPES) &&
     
    291290   } /* endfor */
    292291   return (HardwareArray[i].DeviceType);
    293 
    294292}
  • OCO/trunk/drv16/commdbg.c

    r468 r473  
    390390        mov     al,c
    391391        out     dx, al
    392 
    393         DELAY
    394         DELAY
    395         DELAY
    396392        }
    397393}
  • OCO/trunk/drv16/dwavestrm.cpp

    r468 r473  
    166166ULONG DWAVESTREAM::StartStream(void)
    167167{
     168    dprintf(("DWAVESTREAM::StartStream"));
    168169   return WAVESTREAM::StartStream();
    169170}
     
    175176   ULONG space, Buff_left, byteswritten;
    176177
    177    if(!pTemp) pTemp = (PSTREAMBUFFER)qhInProcess.Tail();
    178 
    179    if(ulStreamType & STREAM_WRITE && pTemp && pTemp->looping)
     178    dprintf(("DW::AddBuffers"));
     179    if (!pTemp) pTemp = (PSTREAMBUFFER)qhInProcess.Tail();
     180
     181    if (ulStreamType & STREAM_WRITE && pTemp && pTemp->looping)
     182    {
     183        Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
     184        if (pahw->GetPosition(StreamId, &_configinfo, &space) != OSSERR_SUCCESS)
     185        {
     186            dprintf(("DWAVESTREAM::AddBuffers GetPositions"));
     187            DebugInt3();
     188            return;
     189        }
     190        if(fFirst)
     191        {
     192             space = min(space, 4*_configinfo.ulFragsize);
     193        }
     194        else
     195        {
     196            space = min(space, _configinfo.ulFragsize);
     197        }
     198        if (space)
     199        {
     200           if (space >= Buff_left)
     201           {
     202              byteswritten = AddBuffer(Buff_left);
     203              if (byteswritten == Buff_left)
     204              {
     205                  pTemp->ulBuffpos = 0; //reset fill position
     206                  AddBuffer(space - Buff_left);
     207              }
     208           }
     209           else
     210           {
     211              AddBuffer(space);
     212           }
     213        }       
     214        pTemp->ulDonepos = 0; //make sure it ::Process never thinks it's done
     215   }
     216   else
    180217   {
    181         Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
    182 
    183             if (pahw->GetPosition(StreamId, &_configinfo, &space) != OSSERR_SUCCESS)
    184            {
    185                dprintf(("DWAVESTREAM::AddBuffers GetPositions"));
    186                DebugInt3();
    187                return;
    188            }
    189         if(fFirst) {
    190              space = min(space, 4*_configinfo.ulFragsize);
    191         }
    192         else space = min(space, _configinfo.ulFragsize);
    193 
    194             if(space) {
    195             if(space >= Buff_left) {
    196                  byteswritten = AddBuffer(Buff_left);
    197                  if(byteswritten == Buff_left) {
    198                      pTemp->ulBuffpos = 0; //reset fill position
    199                      AddBuffer(space - Buff_left);
    200                  }
    201             }
    202             else AddBuffer(space);
    203             }   
    204         pTemp->ulDonepos = 0; //make sure it ::Process never thinks it's done
    205    }
    206    else WAVESTREAM::AddBuffers(fFirst);
     218     WAVESTREAM::AddBuffers(fFirst);
     219   }
     220    dprintf(("DW::AddBuffers End"));
    207221}
    208222//*****************************************************************************
  • OCO/trunk/drv16/ioctl.cpp

    r468 r473  
    203203
    204204#ifdef DEBUG
    205 //   dprintf(("IACapability: src type: %d, op %d",(USHORT)p->ulDataType, (USHORT)p->ulOperation));
     205   dprintf(("IACapability: src type: 0x%lx, op %d",p->ulDataType, (USHORT)p->ulOperation));
    206206#endif
    207207
     
    210210
    211211#ifdef DEBUG
    212 //   dprintf(("IACapability: dev type: %d, ldev %d",ulDevicetype, LDev));
     212   dprintf(("IACapability: dev type: %ld, ldev %d",ulDevicetype, LDev));
    213213#endif
    214214
     
    223223   {
    224224      pHWobj->DevCaps(p);
    225       if (p->ulSupport != SUPPORT_SUCCESS) {
     225      if (p->ulSupport != SUPPORT_SUCCESS)
     226      {
     227         //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call
     228         // (for HDA only!!!!!)
     229         p->ulDataType     = WAVE_FORMAT_4S16;
     230         p->ulChannels     = 2;
     231         p->ulSamplingRate = HZ_44100;
     232         //
    226233         dprintf(("IACapability: Error support"));
    227234         prp->usStatus |= RPERR;
     
    232239       dprintf(("IACapability: Error get HW obj"));
    233240#endif
     241      //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call
     242      // (for HDA only!!!!!)
     243      p->ulDataType     = WAVE_FORMAT_4S16;
     244      p->ulChannels     = 2;
     245      p->ulSamplingRate = HZ_44100;
     246      //
    234247      p->ulSupport = UNSUPPORTED_DATATYPE;
    235248      prp->usStatus |= RPERR;
     
    367380void IoctlDirectAudio(PREQPACKET prp)
    368381{
    369     dprintf(("IoctlDirectAudio"));
     382    dprintf(("IoctlDirectAudio Code:0x%x",prp->s.ioctl.bCode));
    370383    if(prp->s.ioctl.bCode == DAUDIO_OPEN)
    371384    {
     
    396409        {
    397410            pHWobj->DevCaps(&audioCaps);
    398             if (audioCaps.ulSupport != SUPPORT_SUCCESS) {
     411            if (audioCaps.ulSupport != SUPPORT_SUCCESS)
     412            {
    399413                dprintf(("IDirectAudio: DevCaps failed"));
    400414                pInit->sReturnCode = INVALID_REQUEST;
     
    403417            }
    404418        }
    405         else {
     419        else
     420        {
     421            dprintf(("IDirectAudio: HW DevCaps failed"));
    406422            pInit->sReturnCode = INVALID_REQUEST;
    407423            prp->usStatus |= RPERR;
     
    418434        }
    419435
    420         if(!pStream->IsEverythingOk()) {
     436        if(!pStream->IsEverythingOk())
     437        {
    421438            delete pStream;
    422439            dprintf(("IlDirectAudio: IsEverythingOk"));
     
    465482        {
    466483            pHWobj->DevCaps(&audioCaps);
    467             if (audioCaps.ulSupport != SUPPORT_SUCCESS) {
     484            if (audioCaps.ulSupport != SUPPORT_SUCCESS)
     485            {
    468486                dprintf(("IlDirectAudio: DevCaps failed"));
    469487                prp->usStatus |= RPERR;
     
    471489                return;
    472490            }
     491            dprintf(("IoctlDirectAudio ret"));
    473492            pInit->sReturnCode = 0;
    474493            return;
    475494        }
    476495        else {
     496            dprintf(("IoctlDirectAudio err req"));
    477497            pInit->sReturnCode = INVALID_REQUEST;
    478498            prp->usStatus |= RPERR;
     
    499519        {
    500520            pHWobj->DevCaps(lpCaps);
    501             return;
    502         }
    503         else {
     521            dprintf(("IoctlDirectAudio ret1"));
     522            return;
     523        }
     524        else
     525        {
    504526            prp->usStatus |= RPERR;
     527            dprintf(("IoctlDirectAudio ret err1"));
    505528            return;
    506529        }
     
    509532
    510533    pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);
    511     if(pStream == NULL) {
     534    if(pStream == NULL)
     535    {
    512536        dprintf(("IDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));
    513537        DebugInt3();
     
    547571    case DAUDIO_START:
    548572    {
    549         if(numFreeStreams > 0) {
     573        if(numFreeStreams > 0)
     574        {
    550575              rc = pStream->StartStream();
    551576              if(!rc) numFreeStreams--;
     
    621646    }
    622647
    623     if(rc) {
     648    if(rc)
     649    {
     650        dprintf(("IoctlDirectAudio ret err rc=%ld",rc));
    624651        prp->usStatus |= RPERR | RPBADCMD;
    625652        return;
    626653    }
     654    dprintf(("IoctlDirectAudio ret Ok"));
    627655    return;
    628656}
     
    644672{
    645673#ifdef DEBUG
    646     dprintf(("StrategyIoctl:cat:0x%x, code:0x%x dev %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device));
     674    dprintf(("StrategyIoctl:cat:0x%x, code:0x%x cd %d gd %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device, LDev));
    647675#endif
    648676    if (prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT)
  • OCO/trunk/drv16/ossidc16.cpp

    r468 r473  
    715715    {
    716716        PWAVESTREAM pStream;
    717 //            dprintf(("IDC16_PROCESS. param1: %x, param2: %x",param1, param2));
    718         //Signal all active wave playback streams to update their status
     717//           dprintf(("IDC16_PROCESS"));
     718           //Signal all active wave playback streams to update their status
    719719            pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_PLAY);
    720720            while(pStream)
     
    722722                pStream->Process();
    723723               pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream);
    724             }
    725         //Signal all active wave capture streams to update their status
    726         pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_CAPTURE);
    727         while(pStream) {
    728                     pStream->Process();
    729                     pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_CAPTURE, pStream);
    730             }
    731             break;
     724           }
     725           //Signal all active wave capture streams to update their status
     726           pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_CAPTURE);
     727           while(pStream)
     728           {
     729                 pStream->Process();
     730                 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_CAPTURE, pStream);
     731           }
     732//           dprintf(("IDC16_PROCESS end"));
     733           break;
    732734    }
    733735
  • OCO/trunk/drv16/ssm_idc.cpp

    r468 r473  
    9898           }
    9999#endif
     100//           ddprintf(("DDCMD_WRITE beg"));
    100101           ulReturnCode = pstream->Write((PSTREAMBUF) p->pBuffer,(unsigned) p->ulBufferSize);
    101102//           ddprintf(("DDCMD_WRITE %lx rc=%ld",p->ulBufferSize, ulReturnCode));
     
    132133         case DDCMD_STOP:
    133134             ddprintf(("DDCMD_STOP"));
    134              DevHelp_ProcBlock ((ULONG)p, 2, 0);
     135//             DevHelp_ProcBlock ((ULONG)p, 2, 0);
    135136             p->ulParmSize=sizeof(ULONG);
    136137             return pstream->StopStream((PCONTROL_PARM)p->pParm);
     
    146147             return pstream->EnableEvent(p);
    147148         case DDCMD_DISABLE_EVENT:
    148 //             ddprintf(("DDCMD_DISABLE_EVENT"));
     149             ddprintf(("DDCMD_DISABLE_EVENT"));
    149150             return pstream->DisableEvent(p);
    150151         case DDCMD_PAUSE_TIME:
    151 //             ddprintf(("DDCMD_PAUSE_TIME"));
     152             ddprintf(("DDCMD_PAUSE_TIME"));
    152153             return pstream->PauseStreamTime();
    153154         case DDCMD_RESUME_TIME:
  • OCO/trunk/drv16/strategy.cpp

    r468 r473  
    5252
    5353SOUNDCARD soundCard = NO_AUDIO;
     54
     55#ifdef ENABLE_HW_CERTIFICATION
    5456
    5557extern "C" char szINTEL_ICH[];
     
    8284extern "C" char szAZX[];
    8385
    84 #ifdef ENABLE_HW_CERTIFICATION
    8586static char *pszIntelICH        = (char *)szINTEL_ICH;
    86 #if 0 // fixme to be gone
    8787static char *pszSigmatel9721_23 = (char *)szSIGMATEL_9721_23;
    88 #endif
    8988static char *pszSBLive          = (char *)szSBLIVE;
    9089static char *pszCMedia          = (char *)szCMEDIA;
  • OCO/trunk/drv16/timer.cpp

    r468 r473  
    127127   pStream = (MIDISTREAM*) FindActiveStream( ulStreamType );
    128128
     129   dprintf(("TIMER::Ctx"));
    129130   if (pStream)   // Should always be a valid fn adr when timer is running.
    130131      pStream->Process();
     
    324325   USHORT rc;
    325326
     327   dprintf(("TIMER::iStart"));
    326328   // Disable any any pre-existing timer and reset state variables.
    327329   if ( _eState != TIMER_Stopped )
     
    369371int TIMER::_iStop()
    370372{
     373   dprintf(("TIMER::iStop"));
    371374   _eState = TIMER_Stopped;            // Stop this Timer.
    372375   if (! TIMER::_isAnyRunning()) {     // If no other Timers are running...
  • OCO/trunk/drv16/waveplay.cpp

    r468 r473  
    6161    ULONG ret;
    6262#ifdef DEBUG
    63     dprintf(("WAVEPLAY::Open %lx",StreamId));
     63//    dprintf(("WAVEPLAY::Open %lx",StreamId));
    6464#endif
    6565    if (fAPMSuspend)
    6666    {
    6767#ifdef DEBUG
    68         dprintf(("WAVEPLAY::Open. Suspend state"));
     68//        dprintf(("WAVEPLAY::Open. Suspend state"));
    6969#endif
    7070        apm_resume();
     
    107107{
    108108#ifdef DEBUG
    109     dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy));
     109//    dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy));
    110110#endif
    111111#if 0 // fixme to be gone?
     
    119119        force_closed = 0;
    120120#ifdef DEBUG
    121         dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy));
     121//        dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy));
    122122#endif
    123123        return TRUE;
     
    140140                open_strategy = 0UL;
    141141#ifdef DEBUG
    142                 dprintf(("OSS16_WAVECLOSE: Success"));
     142//                dprintf(("OSS16_WAVECLOSE: Success"));
    143143#endif /* DEBUG */
    144144                return TRUE;
     
    171171    {
    172172#ifdef DEBUG
    173         dprintf(("WAVEPLAY::ConfigDev. Suspend state"));
     173//        dprintf(("WAVEPLAY::ConfigDev. Suspend state"));
    174174#endif
    175175        apm_resume();
     
    189189    }
    190190#ifdef DEBUG
    191     dprintf(("WAVEPLAY::ConfigDev1 SampleRate %ld", pConfigInfo->ulHwSampleRate));
    192     dprintf(("WAVEPLAY::ConfigDev1 ulFirstBufSize %ld", ulFirstBufSize));
    193     dprintf(("WAVEPLAY::ConfigDev1 ulFragsize %ld", pConfigInfo->ulFragsize));
     191    dprintf(("WAVEPLAY::ConfigDev1\nSampleRate %ld", pConfigInfo->ulHwSampleRate));
     192    dprintf(("ulFirstBufSize %ld", ulFirstBufSize));
     193    dprintf(("ulFragsize %ld", pConfigInfo->ulFragsize));
    194194#endif
    195195
     
    211211        ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo);
    212212#ifdef DEBUG
    213         dprintf(("WAVEPLAY::ConfigDev2 ulFirstBufSize %ld", ulFirstBufSize));
     213        dprintf(("ulFirstBufSize %ld", ulFirstBufSize));
    214214#endif /* DEBUG */
    215215    }
     
    223223    ulPCMConsumeRate = ConvertLength(pConfigInfo->ulPCMConsumeRate, pConfigInfo);
    224224#ifdef DEBUG
    225     dprintf(("WAVEPLAY::ConfigDev: cons rate %ld buf size %ld init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate));
     225    dprintf(("cons rate %ld buf size %ld init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate));
    226226#endif /* DEBUG */
    227227
     
    252252
    253253#ifdef DEBUG
    254     dprintf(("WAVEPLAY::ConfigDev2 fragsize %ld", fragsize));
     254    dprintf(("fragsize %ld", fragsize));
    255255#endif
    256256    hwparam.ulSampleRate    = pConfigInfo->ulHwSampleRate;
     
    261261#ifdef DEBUG
    262262        dprintf(("WAVEPLAY:ConfigDev:OSS16_WaveSetFormat . rc = %d",rc));
    263         dprintf(("WAVEPLAY:ConfigDev:samp rate %ld",hwparam.ulSampleRate));
    264         dprintf(("WAVEPLAY:ConfigDev:bits per sample %ld",hwparam.ulBitsPerSample));
    265         dprintf(("WAVEPLAY:ConfigDev:channels %ld",hwparam.ulNumChannels));
    266         dprintf(("WAVEPLAY:ConfigDev:data type %ld",hwparam.ulDataType));
     263        dprintf(("samp rate %ld",hwparam.ulSampleRate));
     264        dprintf(("bits per sample %ld",hwparam.ulBitsPerSample));
     265        dprintf(("channels %ld",hwparam.ulNumChannels));
     266        dprintf(("data type %ld",hwparam.ulDataType));
    267267
    268268#endif
     
    294294    {
    295295#ifdef DEBUG
    296         dprintf(("WAVEPLAY::Transfer. Suspend state"));
     296//        dprintf(("WAVEPLAY::Transfer. Suspend state"));
    297297#endif
    298298        apm_resume();
     
    415415            dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space));
    416416#endif
    417             while (!Space)
    418                for (i=0; i < 0xffffff; i++)
    419                {
    420                     OSS16_WaveGetSpace(StreamId, &Space);
    421                     if (Space & ~(pConfigInfo->ulHwSampleSize - 1)) break;
    422                }
    423 #ifdef DEBUG
    424             dprintf(("OUT %lx need %ld space:%ld ",i, ulCvtBufferSize, Space));
    425 #endif
     417            if (Space < pConfigInfo->ulBytesPerIRQ)
     418            {
     419               return TRUE;
     420            }
     421
    426422            if (ulCvtBufferSize > Space)
    427423                ulCvtBufferSize = Space & ~(pConfigInfo->ulHwSampleSize - 1);
     
    433429            {
    434430                 GetSpace(StreamId, pConfigInfo, &Space);
    435                  dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space));
     431                 dprintf(("WPLAY::AddBuffer; %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space));
    436432            }
    437433#ifdef DEBUG
    438434            else
    439                 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc));
     435                dprintf(("WPLAY::AddBuffer; %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc));
    440436#endif
    441437            *pulBytesTransferred = 0;
     
    492488        *pulStreamPosition = 0;
    493489#ifdef DEBUG
    494         dprintf(("OSS16_WAVEPLAY::GetPosition: Failed"));
     490        dprintf(("WAVEPLAY::GetPosition: Failed"));
    495491#endif /* DEBUG */
    496492        return FALSE;
     
    515511        *pulStreamSpace = 0;
    516512#ifdef DEBUG
    517         dprintf(("OSS16_WAVEPLAY::GetSpace: Failed"));
     513        dprintf(("WAVEPLAY::GetSpace: Failed"));
    518514#endif /* DEBUG */
    519515        return FALSE;
     
    537533        *pulHwPtr = 0;
    538534        #ifdef DEBUG
    539         dprintf(("OSS16_WAVEPLAY::WaveGetHwPtr: Failed"));
     535        dprintf(("WAVEPLAY::WaveGetHwPtr: Failed"));
    540536        #endif /* DEBUG */
    541537        return FALSE;
  • OCO/trunk/drv16/wavestrm.cpp

    r468 r473  
    181181        }
    182182        space &= (~(_configinfo.ulSampleSize - 1));
    183         curspace = space;
     183        curspace = min(space, _configinfo.ulBytesPerIRQ/_configinfo.ulSampleSize * 2);
    184184        while (space && qhInProcess.IsElements())
    185185        {
     
    188188            if (fFirst == TRUE)  //PS+++
    189189            {
    190                  DevHelp_ProcBlock (space, 20, 0);
     190                cli();
     191//                 DevHelp_ProcBlock (space, 20, 0);
    191192            }
    192193//            dgprintf(("AddBuffers write %ld SSize:%ld %d",space, _configinfo.ulSampleSize, fFirst == TRUE?1:2));
     
    195196            {
    196197//                dgprintf(("WAVESTREAM::AddBuffers Error 2"));
    197                 return;
     198                break;
    198199            }
    199200            if(byteswritten == (ULONG)-1)
     
    233234    if(pahw->GetHwPtr(StreamId, &_configinfo, &start_pos) == FALSE)
    234235    {
    235         dgprintf(("WAVESTREAM::AddBuffer Error in WaveGetHwPtr"));
     236        dgprintf(("WAVESTREAM::AddBuffer Err in GetHwPtr"));
    236237        DebugInt3();
    237238        return (ULONG)-1;
     
    240241    if (!pTemp->ulBuffsz || !space)
    241242    {
    242         dgprintf(("WAVESTREAM::AddBuffer NULL, Bufsz:%ld Space:%ld",pTemp->ulBuffsz, space));
     243        dgprintf(("WAVESTREAM::AddBuffer 0, Bufsz:%ld Space:%ld",pTemp->ulBuffsz, space));
    243244        //PS+++ if is ZERO do nothing and ask for give new buffer, See REMARK in mmpm2.inf
    244245        qhDone.PushOnTail(qhInProcess.PopHead());
    245246//        DebugInt3();
    246         return 0;
     247        return -1;
    247248    }
    248249    // get the buffer pointer and amount of data remaining
     
    261262        dgprintf(("AddBuffer: No more room!!"));
    262263//        DebugInt3();
    263         return (ULONG)-1; //no more room
     264//PS+++        return (ULONG)-1; //no more room
     265        return 0;   //PS+++ may be in next time?
    264266    }
    265267    // update the buffer pos counter
     
    304306    }
    305307
    306     dprintf4(("_vReadAudioBuf %lx size %ld, bytes read %ld", pdataBuf, Buff_left, bytesread));
     308//    dprintf4(("_vReadAudioBuf %lx size %ld, bytes read %ld", pdataBuf, Buff_left, bytesread));
    307309
    308310    // update the buffer pos counter
     
    325327// can be returned and finally process any events pending.
    326328//******************************************************************************
    327 //USHORT ProcNumber = 0;
     329USHORT ProcNumber = 0;
    328330void DBGCALLCONV WAVESTREAM::Process(void)
    329331{
    330332 PSTREAMBUFFER ptemp;
    331333 ULONG         ulCurBytesProcessed = 0;
    332 // USHORT        CurProcNumber = ProcNumber++;
     334 USHORT        CurProcNumber = ProcNumber++;
    333335 ULONG         space;
    334336
     
    351353    _ulBytesProcessed = ulCurBytesProcessed;
    352354
    353 //    if ((pahw->GetSpace(StreamId, &_configinfo, &space) != FALSE) && (space > _configinfo.ulBytesPerIRQ))
    354     switch (ulStreamType & STREAM_WRITE) {
     355    if ((pahw->GetSpace(StreamId, &_configinfo, &space) != FALSE) && (space > _configinfo.ulBytesPerIRQ/_configinfo.ulSampleSize ))
     356    switch (ulStreamType & STREAM_WRITE)
     357    {
    355358
    356359        // if there are buffers that have been completly written to the audio buffer
     
    522525
    523526#ifdef DEBUG
    524     ddprintf(("WAVESTREAM::StartStream"));
     527//    ddprintf(("WAVESTREAM::StartStream"));
    525528#endif
    526529
     
    572575        }
    573576    }
    574     ddprintf(("WAVESTREAM::StartStream %lx End", StreamId));
     577//    ddprintf(("WAVESTREAM::StartStream %lx End", StreamId));
    575578    return NO_ERROR;
    576579
     
    598601
    599602    ulStreamState = STREAM_STOPPED;
    600     ddprintf(("WAVESTREAM::StopStream %lx", StreamId));
     603//    ddprintf(("WAVESTREAM::StopStream %lx", StreamId));
    601604    ReturnBuffers();
    602605    pControl->ulTime = GetCurrentTime();
Note: See TracChangeset for help on using the changeset viewer.