Changeset 9902


Ignore:
Timestamp:
Mar 5, 2003, 3:49:04 PM (22 years ago)
Author:
sandervl
Message:

waveoutGetPosition: return 0 if stream is not active (DART); waveinGetPosition: return 0 if stream is not active (DART); Don't print a warning for CALLBACK_NULL callbacks; Added ODIN_waveInSetFixedBuffers, renamed SetFixedWaveBufferSize to ODIN_waveOutSetFixedBuffers. Used to tell WINMM to use the waveOutWrite buffer size for the DART buffers

Location:
trunk/src/winmm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/winmm/os2timer.cpp

    r6933 r9902  
    1 /* $Id: os2timer.cpp,v 1.19 2001-10-03 13:47:58 sandervl Exp $ */
     1/* $Id: os2timer.cpp,v 1.20 2003-03-05 14:49:03 sandervl Exp $ */
    22
    33/*
     
    2424#include <win32api.h>
    2525#include <wprocess.h>
    26 #include <misc.h>
     26#include <dbglog.h>
     27#include <vmutex.h>
    2728
    2829#include "time.h"
     
    3637 * Structures                                                               *
    3738 ****************************************************************************/
    38  
     39static VMutex timeMutex;
    3940
    4041/****************************************************************************
     
    7071           dwPeriod));
    7172
     73  timeMutex.enter();
    7274  // add to linked list
    7375  OS2TimerResolution *timeRes = OS2TimerResolution::sTimerResolutions;
     
    8385  else
    8486    OS2TimerResolution::sTimerResolutions = this;
     87
     88  timeMutex.leave();
    8589
    8690  this->dwPeriod = dwPeriod;
     
    106110
    107111
     112  timeMutex.enter();
     113
    108114  // remove from linked list
    109115  OS2TimerResolution *timeRes = OS2TimerResolution::sTimerResolutions;
     
    121127  else
    122128    OS2TimerResolution::sTimerResolutions = timeRes->next;
     129
     130  timeMutex.leave();
    123131}
    124132
     
    166174           dwPeriod));
    167175
     176  timeMutex.enter();
    168177  OS2TimerResolution* timeRes = OS2TimerResolution::sTimerResolutions;
    169178
     
    178187    {
    179188      delete timeRes;              // so delete that object
     189      timeMutex.leave();
    180190      return TRUE;                 // OK, can remove the entry
    181191    }
    182192 }
     193 timeMutex.leave();
     194
    183195 return FALSE;                     // nope, mismatch !
    184196}
     
    199211int OS2TimerResolution::queryCurrentResolution()
    200212{
     213  timeMutex.enter();
    201214  OS2TimerResolution *timeRes = OS2TimerResolution::sTimerResolutions;
    202215  int                iMin = -1;
     
    210223        iMin = timeRes->dwPeriod;
    211224    }
     225  timeMutex.leave();
    212226
    213227  dprintf(("WINMM:OS2Timer: OS2TimerResolution::queryCurrentResolution == %08xh\n",
     
    230244           this));
    231245
     246  timeMutex.enter();
    232247  OS2Timer *timer = OS2Timer::timers;
    233248
     
    242257  else
    243258    timers = this;
     259  timeMutex.leave();
    244260 
    245261  // create timer semaphore
     
    274290           this));
    275291
     292  KillTimer();
     293
     294  timeMutex.enter();
    276295  OS2Timer *timer = OS2Timer::timers;
    277296
    278   KillTimer();
    279 
    280297  if(timer != this)
    281298  {
     
    288305  else
    289306    timers = timer->next;
     307
     308  timeMutex.leave();
    290309}
    291310/******************************************************************************/
  • TabularUnified trunk/src/winmm/waveindart.cpp

    r8572 r9902  
    1 /* $Id: waveindart.cpp,v 1.5 2002-06-05 11:05:56 sandervl Exp $ */
     1/* $Id: waveindart.cpp,v 1.6 2003-03-05 14:49:04 sandervl Exp $ */
    22
    33/*
     
    66 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl)
    77 *
     8 * TODO: mulaw, alaw & adpcm
    89 *
    910 * Project Odin Software License can be found in LICENSE.TXT
     
    4647LONG APIENTRY WaveInHandler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags);
    4748
    48 //TODO: mulaw, alaw & adpcm
     49static BOOL fwaveInFixedBuffers = FALSE;
     50
     51//******************************************************************************
     52// ODIN_waveInSetFixedBuffers
     53//
     54// Tell WINMM to use DART buffers of the same size as the first buffer delivered
     55// by waveInAddBuffer
     56//
     57//******************************************************************************
     58void WIN32API ODIN_waveInSetFixedBuffers()
     59{
     60    fwaveInFixedBuffers = TRUE;
     61}
    4962/******************************************************************************/
    5063/******************************************************************************/
     
    208221        LPWAVEHDR pwh = wavehdr;
    209222        if(pwh) {
    210             dprintf(("mix setup %d, %d\n", pwh->dwBufferLength, pwh->dwBufferLength));
    211 
    212             ulBufSize = pwh->dwBufferLength/2;
     223            if(fwaveInFixedBuffers) {
     224                ulBufSize = pwh->dwBufferLength;
     225            }
     226            else
     227            {
     228                dprintf(("mix setup %d, %d\n", pwh->dwBufferLength, pwh->dwBufferLength));
     229   
     230                ulBufSize = pwh->dwBufferLength/2;
     231            }
    213232            if(ulBufSize > minbufsize) {
    214233                dprintf(("set buffer size to %d bytes (org size = %d)", minbufsize, pwh->dwBufferLength));
     
    388407    ULONG rc, nrbytes;
    389408
     409    if(State == STATE_STOPPED) {
     410        dprintf(("Not recording; return 0 position"));
     411        return 0;
     412    }
     413
    390414    mciStatus.ulItem = MCI_STATUS_POSITION;
    391415    rc = mymciSendCommand(DeviceId, MCI_STATUS, MCI_STATUS_ITEM|MCI_WAIT, (PVOID)&mciStatus, 0);
  • TabularUnified trunk/src/winmm/waveinoutbase.cpp

    r9671 r9902  
    1 /* $Id: waveinoutbase.cpp,v 1.5 2003-01-14 19:38:38 sandervl Exp $ */
     1/* $Id: waveinoutbase.cpp,v 1.6 2003-03-05 14:49:04 sandervl Exp $ */
    22
    33/*
     
    140140        break;
    141141
     142    case CALLBACK_NULL:
     143        break; //no callback
     144
    142145    default:
    143146        dprintf(("WARNING: Unknown callback type %x %x", fdwOpen, dwCallback));
  • TabularUnified trunk/src/winmm/waveoutdart.cpp

    r9012 r9902  
    1 /* $Id: waveoutdart.cpp,v 1.15 2002-08-16 10:09:49 sandervl Exp $ */
     1/* $Id: waveoutdart.cpp,v 1.16 2003-03-05 14:49:04 sandervl Exp $ */
    22
    33/*
     
    5353static BOOL fFixedWaveBufferSize = FALSE;
    5454
    55 /******************************************************************************/
    56 //Call to tell winmm to expect simple fixed size buffers, so
    57 //it doesn't have to use very small DART buffers; this will
    58 //only work in very specific cases; it is not a good general
    59 //purpose solution)
    60 /******************************************************************************/
    61 void WIN32API SetFixedWaveBufferSize()
     55//******************************************************************************
     56// ODIN_waveOutSetFixedBuffers
     57//
     58// Tell WINMM to use DART buffers of the same size as the first buffer delivered
     59// by waveOutWrite
     60//
     61// NOTE: This will only work in very specific cases; it is not a good general
     62//       purpose solution.
     63//
     64//******************************************************************************
     65void WIN32API ODIN_waveOutSetFixedBuffers();
    6266{
    6367    fFixedWaveBufferSize = TRUE;
     
    224228        else    ulBufSize = 1024;
    225229#endif
    226 
    227230        MixSetupParms->ulBufferSize = ulBufSize;
    228231
     
    467470 ULONG rc, nrbytes;
    468471
     472    if(State == STATE_STOPPED) {
     473        dprintf(("Not playing; return 0 position"));
     474        return 0;
     475    }
     476
    469477    mciStatus.ulItem = MCI_STATUS_POSITION;
    470478    rc = mymciSendCommand(DeviceId, MCI_STATUS, MCI_STATUS_ITEM|MCI_WAIT, (PVOID)&mciStatus, 0);
Note: See TracChangeset for help on using the changeset viewer.