Changeset 533
- Timestamp:
- Aug 2, 2010, 11:30:35 PM (15 years ago)
- Location:
- OCO/trunk
- Files:
-
- 8 edited
-
drv16/convert.h (modified) (1 diff)
-
drv16/ioctl.cpp (modified) (12 diffs)
-
drv16/waudio.cpp (modified) (2 diffs)
-
drv16/wavestrm.cpp (modified) (20 diffs)
-
drv16/wavestrm.hpp (modified) (1 diff)
-
install/CHANGELOG.TXT (modified) (1 diff)
-
install/control.scr (modified) (2 diffs)
-
uniaud.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/convert.h
r271 r533 1 1 #ifndef __CONVERT_H__ 2 2 #define __CONVERT_H__ 3 4 /* Comparison functions for handling wrapping */ 5 #define ARG1_IS_AFTER_ARG2(a,b) ((long)(b) - (long)(a) < 0) 6 #define ARG1_IS_BEFORE_ARG2(a,b) ARG1_IS_AFTER_ARG2(b,a) 7 8 #define ARG1_IS_AFTER_OR_EQUAL_TO_ARG2(a,b) ((long)(a) - (long)(b) >= 0) 9 #define ARG1_IS_BEFORE_OR_EQUAL_TO_ARG2(a,b) ARG1_IS_AFTER_OR_EQUAL_TO_ARG2(b,a) 3 10 4 11 //Use one page to temporarily hold converted wave data -
OCO/trunk/drv16/ioctl.cpp
r529 r533 3 3 /* SCCSID = %W% %E% */ 4 4 /**************************************************************************** 5 * *6 * Copyright (c) IBM Corporation 1994 - 1997. *7 * *8 * The following IBM OS/2 source code is provided to you solely for the *5 * * 6 * Copyright (c) IBM Corporation 1994 - 1997. * 7 * * 8 * The following IBM OS/2 source code is provided to you solely for the * 9 9 * the purpose of assisting you in your development of OS/2 device drivers. * 10 * You may use this code in accordance with the IBM License Agreement *11 * provided in the IBM Device Driver Source Kit for OS/2. *12 * *10 * You may use this code in accordance with the IBM License Agreement * 11 * provided in the IBM Device Driver Source Kit for OS/2. * 12 * * 13 13 ****************************************************************************/ 14 14 /**@internal %W% … … 18 18 * @version %I% 19 19 * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit, 20 * <stack context>.20 * <stack context>. 21 21 * @history 22 22 * … … 46 46 #include <daudio.h> 47 47 48 int numFreeStreams= ALSACAPS_MAXSTREAMS;48 int numFreeStreams = ALSACAPS_MAXSTREAMS; 49 49 50 50 /**@internal 51 * @param PREQPACKET pointer to the strategy request packet52 * @return None But the Status in the request packet is updated on error51 * @param PREQPACKET pointer to the strategy request packet 52 * @return None But the Status in the request packet is updated on error 53 53 * @notes 54 54 * The Audio Init Ioctl only 2 things happen in here : … … 68 68 PFN_SHD pfnSHD = NULL; 69 69 70 // if this is an IDLE or De-Init request71 // fetch the stream object based on the sysfilenum and turn on the72 // stream idle bit in the stream state then write the sysfilenum73 // into the request packet, set rc = 0 and return70 // if this is an IDLE or De-Init request 71 // fetch the stream object based on the sysfilenum and turn on the 72 // stream idle bit in the stream state then write the sysfilenum 73 // into the request packet, set rc = 0 and return 74 74 if (p->sMode == IDLE) 75 75 { 76 pstream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);77 if (pstream)78 pstream->ulStreamState |= STREAM_IDLE;79 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum;80 p->sReturnCode = 0;81 return;82 } 83 // call FindStream_fromFile to see if there is already a stream84 // for this sysfilenum. if there is then see if the idle bit is on,85 // if the idle bit is on, reset it, then write the sysfilenum86 // into the request packet, set rc = 0 and return87 // MMPM sends idle down to a stream that is "losing" the hardware but88 // should not go away. It usually is associated with an app losing89 // focus. If the idle bit is not the stream is either not registered or90 // is being "re-initted" in another mode or with different file91 // attributes. "Re-initting" a stream is a total hack on the part92 // of MMPM they should de-register the stream and then init a new93 // stream but they don't . If anyone ever writes a VSD that behaves94 // "correctly" then this code can be deleted.95 // Either way delete the stream and build a new one with96 // this request packet.76 pstream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 77 if (pstream) 78 pstream->ulStreamState |= STREAM_IDLE; 79 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum; 80 p->sReturnCode = 0; 81 return; 82 } 83 // call FindStream_fromFile to see if there is already a stream 84 // for this sysfilenum. if there is then see if the idle bit is on, 85 // if the idle bit is on, reset it, then write the sysfilenum 86 // into the request packet, set rc = 0 and return 87 // MMPM sends idle down to a stream that is "losing" the hardware but 88 // should not go away. It usually is associated with an app losing 89 // focus. If the idle bit is not the stream is either not registered or 90 // is being "re-initted" in another mode or with different file 91 // attributes. "Re-initting" a stream is a total hack on the part 92 // of MMPM they should de-register the stream and then init a new 93 // stream but they don't . If anyone ever writes a VSD that behaves 94 // "correctly" then this code can be deleted. 95 // Either way delete the stream and build a new one with 96 // this request packet. 97 97 pstream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 98 if (pstream) { 99 if (pstream->ulStreamState & STREAM_IDLE) { 100 pstream->ulStreamState &= STREAM_NOT_IDLE; 101 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum; 102 p->sReturnCode = 0; 103 return; 104 } 105 else { 98 if (pstream) { 99 if (pstream->ulStreamState & STREAM_IDLE) { 100 pstream->ulStreamState &= STREAM_NOT_IDLE; 101 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum; 102 p->sReturnCode = 0; 103 return; 104 } else { 106 105 #if 1 107 // Rudi: Workaround for MMPM device sharing bug108 if (pstream->ulStreamState & STREAM_STREAMING) {109 CONTROL_PARM dummy;110 pstream->PauseStream(&dummy);111 pstream->ResumeStream();112 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum;113 p->sReturnCode = 0;114 return;115 }106 // Rudi: Workaround for MMPM device sharing bug 107 if (pstream->ulStreamState & STREAM_STREAMING) { 108 CONTROL_PARM dummy; 109 pstream->PauseStream(&dummy); 110 pstream->ResumeStream(); 111 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum; 112 p->sReturnCode = 0; 113 return; 114 } 116 115 #endif 117 //HACK BEGIN118 //SvL: Save stream handle & SHD entrypoint in case MMPM2 reinitializes119 //a stream that was already registered120 //HACK END121 if(pstream->pfnSHD) {122 hstream = (USHORT)pstream->hstream;123 pfnSHD = pstream->pfnSHD;124 }125 delete pstream;126 }127 }116 //HACK BEGIN 117 //SvL: Save stream handle & SHD entrypoint in case MMPM2 reinitializes 118 // a stream that was already registered 119 //HACK END 120 if (pstream->pfnSHD) { 121 hstream = (USHORT)pstream->hstream; 122 pfnSHD = pstream->pfnSHD; 123 } 124 delete pstream; 125 } 126 } 128 127 129 128 // get the hardware type … … 131 130 HardwareType = GetHardwareType(p->sMode, (USHORT)p->ulOperation, LDev); 132 131 if (HardwareType == AUDIOHW_INVALID_DEVICE) { 133 p->sReturnCode = INVALID_REQUEST;134 prp->usStatus |= RPERR;135 return;136 } 137 // make sure we have a Hardware object that can handle this138 // data type and operation..132 p->sReturnCode = INVALID_REQUEST; 133 prp->usStatus |= RPERR; 134 return; 135 } 136 // make sure we have a Hardware object that can handle this 137 // data type and operation.. 139 138 pHWobj = GetHardwareDevice(HardwareType); 140 139 if (pHWobj == NULL) { 141 p->sReturnCode = INVALID_REQUEST;142 prp->usStatus |= RPERR;143 return;144 } 145 146 p->ulFlags = 0; /* Zero the Flags */140 p->sReturnCode = INVALID_REQUEST; 141 prp->usStatus |= RPERR; 142 return; 143 } 144 145 p->ulFlags = 0; /* Zero the Flags */ 147 146 switch (HardwareType) 148 147 { 149 case AUDIOHW_WAVE_PLAY:150 case AUDIOHW_WAVE_CAPTURE:151 pstream = new WAVESTREAM(HardwareType,p,prp->s.ioctl.usSysFileNum, MixerStreamId);152 p->sDeviceID = ALSA_ID; /* Reported in VSD dll*/153 break;154 155 case AUDIOHW_FMSYNTH_PLAY:156 if(devCaps[current_device].ulCaps & OSS32_CAPS_FMSYNTH_PLAYBACK)157 {158 pstream = new MIDISTREAM(HardwareType, prp->s.ioctl.usSysFileNum, MixerStreamId);159 p->sDeviceID = ALSA_MIDI_ID; /* Reported in VSD dll*/160 }161 else {162 p->sReturnCode = INVALID_REQUEST;163 prp->usStatus |= RPERR;164 return;165 }166 break;167 168 default:169 p->sReturnCode = INVALID_REQUEST;170 prp->usStatus |= RPERR;171 return;148 case AUDIOHW_WAVE_PLAY: 149 case AUDIOHW_WAVE_CAPTURE: 150 pstream = new WAVESTREAM(HardwareType,p,prp->s.ioctl.usSysFileNum, MixerStreamId); 151 p->sDeviceID = ALSA_ID; /* Reported in VSD dll */ 152 break; 153 154 case AUDIOHW_FMSYNTH_PLAY: 155 if(devCaps[current_device].ulCaps & OSS32_CAPS_FMSYNTH_PLAYBACK) 156 { 157 pstream = new MIDISTREAM(HardwareType, prp->s.ioctl.usSysFileNum, MixerStreamId); 158 p->sDeviceID = ALSA_MIDI_ID; /* Reported in VSD dll */ 159 } 160 else { 161 p->sReturnCode = INVALID_REQUEST; 162 prp->usStatus |= RPERR; 163 return; 164 } 165 break; 166 167 default: 168 p->sReturnCode = INVALID_REQUEST; 169 prp->usStatus |= RPERR; 170 return; 172 171 } /* endswitch */ 173 172 174 p->ulFlags |= VOLUME;/* volume control is supported */175 p->ulFlags |= INPUT; /* Input select is supported*/176 p->ulFlags |= OUTPUT;/* Output select is supported */177 p->ulFlags |= MONITOR;/* Record Monitor is supported */173 p->ulFlags |= VOLUME; /* volume control is supported */ 174 p->ulFlags |= INPUT; /* Input select is supported */ 175 p->ulFlags |= OUTPUT; /* Output select is supported */ 176 p->ulFlags |= MONITOR; /* Record Monitor is supported */ 178 177 pstream->ulSysFileNum = prp->s.ioctl.usSysFileNum; 179 178 p->pvReserved = (VOID FAR *) (ULONG) prp->s.ioctl.usSysFileNum; 180 179 p->sReturnCode = 0; 181 // dprintf(("IoctlAudioInit: file nr: %lx", pstream->ulSysFileNum));180 // dprintf(("IoctlAudioInit: file nr: %lx", pstream->ulSysFileNum)); 182 181 183 182 //HACK BEGIN 184 183 if(pfnSHD) { 185 // dprintf(("Stream was previously registered; reregister it"));186 pstream->pfnSHD= pfnSHD;187 pstream->hstream = hstream;184 // dprintf(("Stream was previously registered; reregister it")); 185 pstream->pfnSHD = pfnSHD; 186 pstream->hstream = hstream; 188 187 } 189 188 //HACK END … … 192 191 193 192 /**@internal 194 * @param PREQPACKET pointer to the strategy request packet195 * @return None But the Status in the request packet is updated on error193 * @param PREQPACKET pointer to the strategy request packet 194 * @return None But the Status in the request packet is updated on error 196 195 * @notes 197 196 */ … … 218 217 if (pHWobj) 219 218 { 220 pHWobj->DevCaps(p);221 if (p->ulSupport != SUPPORT_SUCCESS)222 {223 //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call224 // (for HDA only!!!!!)225 p->ulDataType= WAVE_FORMAT_4S16;226 p->ulChannels= 2;227 p->ulSamplingRate = HZ_44100;228 //229 //dprintf(("IACapability: Error support"));230 prp->usStatus |= RPERR;231 }219 pHWobj->DevCaps(p); 220 if (p->ulSupport != SUPPORT_SUCCESS) 221 { 222 //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call 223 // (for HDA only!!!!!) 224 p->ulDataType = WAVE_FORMAT_4S16; 225 p->ulChannels = 2; 226 p->ulSamplingRate = HZ_44100; 227 // 228 //dprintf(("IACapability: Error support")); 229 prp->usStatus |= RPERR; 230 } 232 231 } 233 232 else { 234 233 //dprintf(("IACapability: Error get HW obj")); 235 //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call236 // (for HDA only!!!!!)237 p->ulDataType= WAVE_FORMAT_4S16;238 p->ulChannels= 2;239 p->ulSamplingRate = HZ_44100;240 //241 p->ulSupport = UNSUPPORTED_DATATYPE;242 prp->usStatus |= RPERR;234 //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call 235 // (for HDA only!!!!!) 236 p->ulDataType = WAVE_FORMAT_4S16; 237 p->ulChannels = 2; 238 p->ulSamplingRate = HZ_44100; 239 // 240 p->ulSupport = UNSUPPORTED_DATATYPE; 241 prp->usStatus |= RPERR; 243 242 } 244 243 } 245 244 246 245 /**@internal IoctlAudioControl 247 * @param PREQPACKET pointer to the strategy request packet248 * @return None But the Status in the request packet is updated on error246 * @param PREQPACKET pointer to the strategy request packet 247 * @return None But the Status in the request packet is updated on error 249 248 * @notes 250 249 * if it's AUDIO_CHANGE, just report success, otherwise report failure … … 258 257 LPMCI_AUDIO_CHANGE pAudChange; 259 258 LPMCI_TRACK_INFO pMasterVol; 260 PSTREAM pStream;261 ULONG volume;262 ULONG addr;259 PSTREAM pStream; 260 ULONG volume; 261 ULONG addr; 263 262 264 263 if (p->usIOCtlRequest != AUDIO_CHANGE) 265 264 { 266 rprintf(("IAudioControl: Error support req:%x",p->usIOCtlRequest));267 p->sReturnCode = INVALID_REQUEST;268 prp->usStatus |= RPERR | RPBADCMD;269 return;265 rprintf(("IAudioControl: Error support req:%x",p->usIOCtlRequest)); 266 p->sReturnCode = INVALID_REQUEST; 267 prp->usStatus |= RPERR | RPBADCMD; 268 return; 270 269 } 271 270 p->sReturnCode=0; … … 278 277 if(addr >= 0x10000UL) 279 278 { 280 rprintf(("Invalid MCI_AUDIO_CHANGE pnt %lx!!", (ULONG)pAudChange));281 p->sReturnCode = INVALID_REQUEST;282 prp->usStatus |= RPERR | RPBADCMD;283 return;279 rprintf(("Invalid MCI_AUDIO_CHANGE pnt %lx!!", (ULONG)pAudChange)); 280 p->sReturnCode = INVALID_REQUEST; 281 prp->usStatus |= RPERR | RPBADCMD; 282 return; 284 283 } 285 284 pMasterVol = (LPMCI_TRACK_INFO)pAudChange->pvDevInfo; … … 290 289 if(addr >= 0x10000UL) 291 290 { 292 rprintf(("Invalid MCI_TRACK_INFO pnt %lx!!", (ULONG)pMasterVol));293 p->sReturnCode = INVALID_REQUEST;294 prp->usStatus |= RPERR | RPBADCMD;295 return;291 rprintf(("Invalid MCI_TRACK_INFO pnt %lx!!", (ULONG)pMasterVol)); 292 p->sReturnCode = INVALID_REQUEST; 293 prp->usStatus |= RPERR | RPBADCMD; 294 return; 296 295 } 297 296 298 297 pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 299 298 if(pStream == NULL) { 300 rprintf(("IAudioControl stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));301 DebugInt3();302 return;299 rprintf(("IAudioControl stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum)); 300 DebugInt3(); 301 return; 303 302 } 304 303 if(pAudChange->lBalance != AUDIO_IGNORE) 305 pStream->SetProperty(PROPERTY_BALANCE, pAudChange->lBalance);304 pStream->SetProperty(PROPERTY_BALANCE, pAudChange->lBalance); 306 305 307 306 if (pAudChange->lVolume != AUDIO_IGNORE) 308 307 { 309 // stream volume ranges from 0 to 0x7FFFFFFF (linear)310 volume = pAudChange->lVolume >> 16UL;311 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL;308 // stream volume ranges from 0 to 0x7FFFFFFF (linear) 309 volume = pAudChange->lVolume >> 16UL; 310 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL; 312 311 //dprintf(("Set stream volume of %x to %d", prp->s.ioctl.usSysFileNum, volume)); 313 pStream->SetProperty(PROPERTY_VOLUME, MAKE_VOLUME_LR(volume, volume));312 pStream->SetProperty(PROPERTY_VOLUME, MAKE_VOLUME_LR(volume, volume)); 314 313 } 315 314 316 315 if (pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE) 317 316 { 318 // master volume ranges from 0 to 0x7FFF (linear)319 volume = pMasterVol->usMasterVolume;320 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL;321 if (volume > OSS32_MAX_VOLUME)322 {323 volume = OSS32_MAX_VOLUME;324 }325 // dprintf(("IlAudioControl:Set MV to %d", volume));326 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_FRONT, MAKE_VOLUME_LR(volume, volume));327 if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_MASTER_REAR))328 {329 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_REAR, MAKE_VOLUME_LR(volume, volume));330 }317 // master volume ranges from 0 to 0x7FFF (linear) 318 volume = pMasterVol->usMasterVolume; 319 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL; 320 if (volume > OSS32_MAX_VOLUME) 321 { 322 volume = OSS32_MAX_VOLUME; 323 } 324 // dprintf(("IlAudioControl:Set MV to %d", volume)); 325 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_FRONT, MAKE_VOLUME_LR(volume, volume)); 326 if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_MASTER_REAR)) 327 { 328 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_REAR, MAKE_VOLUME_LR(volume, volume)); 329 } 331 330 } 332 331 if(!fRecSrcIOCTL90) { 333 for(int i=0;i<8;i++)334 {335 switch(pAudChange->rInputList[0].ulDevType) {336 case NULL_INPUT:337 break; //continue;338 case STEREO_LINE_INPUT:339 case LEFT_LINE_INPUT:340 case RIGHT_LINE_INPUT:341 pStream->SetProperty(PROPERTY_INPUTSRC, OSS32_MIX_RECSRC_LINE);342 break;343 344 case MIC_INPUT:345 case BOOSTED_MIC_INPUT:346 pStream->SetProperty(PROPERTY_INPUTSRC, OSS32_MIX_RECSRC_MIC);347 break;348 349 case PHONE_LINE_INPUT:350 case HANDSET_INPUT:351 case SYNTH_INPUT:352 case DIGITAL_PHONE_LINE_INPUT:353 case DIGITAL_HANDSET_INPUT:354 case MIDI_IN_PORT:355 // case LOOPBACK:356 pStream->SetProperty(PROPERTY_INPUTSRC, OSS32_MIX_RECSRC_MIXER);357 break;358 }359 }332 for(int i=0;i<8;i++) 333 { 334 switch(pAudChange->rInputList[0].ulDevType) { 335 case NULL_INPUT: 336 break; //continue; 337 case STEREO_LINE_INPUT: 338 case LEFT_LINE_INPUT: 339 case RIGHT_LINE_INPUT: 340 pStream->SetProperty(PROPERTY_INPUTSRC, OSS32_MIX_RECSRC_LINE); 341 break; 342 343 case MIC_INPUT: 344 case BOOSTED_MIC_INPUT: 345 pStream->SetProperty(PROPERTY_INPUTSRC, OSS32_MIX_RECSRC_MIC); 346 break; 347 348 case PHONE_LINE_INPUT: 349 case HANDSET_INPUT: 350 case SYNTH_INPUT: 351 case DIGITAL_PHONE_LINE_INPUT: 352 case DIGITAL_HANDSET_INPUT: 353 case MIDI_IN_PORT: 354 // case LOOPBACK: 355 pStream->SetProperty(PROPERTY_INPUTSRC, OSS32_MIX_RECSRC_MIXER); 356 break; 357 } 358 } 360 359 } 361 360 if(!fRecGainIOCTL90 && pAudChange->lGain != AUDIO_IGNORE) { 362 // input ranges from 0 to 0x7FFFFFFF (linear)363 volume = pAudChange->lGain >> 16UL;364 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL;365 if(volume > OSS32_MAX_VOLUME) {366 volume = OSS32_MAX_VOLUME;367 }368 // dprintf(("IAudioControl:Set IG of %x to %d", prp->s.ioctl.usSysFileNum, volume));369 pStream->SetProperty(PROPERTY_INPUTGAIN, MAKE_VOLUME_LR(volume, volume));361 // input ranges from 0 to 0x7FFFFFFF (linear) 362 volume = pAudChange->lGain >> 16UL; 363 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL; 364 if(volume > OSS32_MAX_VOLUME) { 365 volume = OSS32_MAX_VOLUME; 366 } 367 // dprintf(("IAudioControl:Set IG of %x to %d", prp->s.ioctl.usSysFileNum, volume)); 368 pStream->SetProperty(PROPERTY_INPUTGAIN, MAKE_VOLUME_LR(volume, volume)); 370 369 } 371 370 } … … 374 373 void IoctlDirectAudio(PREQPACKET prp) 375 374 { 376 // dprintf(("IoctlDirectAudio Code:0x%x",prp->s.ioctl.bCode));377 if(prp->s.ioctl.bCode == DAUDIO_OPEN)378 {379 LPMCI_AUDIO_INIT pInit = (LPMCI_AUDIO_INIT) prp->s.ioctl.pvData;380 PAUDIOHW pHWobj;381 MCI_AUDIO_CAPS audioCaps;382 PDWAVESTREAM pStream;383 384 if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE))385 {386 rprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit));387 prp->usStatus |= RPERR | RPBADCMD;388 return;389 }390 391 audioCaps.ulLength= sizeof(MCI_AUDIO_CAPS);392 audioCaps.ulSamplingRate = pInit->lSRate;393 audioCaps.ulChannels= pInit->sChannels;394 audioCaps.ulBitsPerSample = pInit->lBitsPerSRate;395 audioCaps.ulDataType= pInit->sMode;396 audioCaps.ulOperation= OPERATION_PLAY;397 398 // get the pointer to the hardware object399 // call DevCaps400 // bailout if no hardware object is returned..401 pHWobj = GetHardwareDevice(AUDIOHW_WAVE_PLAY);402 if (pHWobj)403 {404 pHWobj->DevCaps(&audioCaps);405 if (audioCaps.ulSupport != SUPPORT_SUCCESS)406 {407 rprintf(("IDirectAudio: DevCaps failed"));408 pInit->sReturnCode = INVALID_REQUEST;409 prp->usStatus |= RPERR;410 return;411 }412 }413 else414 {415 rprintf(("IDirectAudio: HW DevCaps failed"));416 pInit->sReturnCode = INVALID_REQUEST;417 prp->usStatus |= RPERR;418 return;419 }420 421 pStream = new DWAVESTREAM(AUDIOHW_WAVE_PLAY, pInit, prp->s.ioctl.usSysFileNum, MixerStreamId);422 if(pStream == NULL) {375 // dprintf(("IoctlDirectAudio Code:0x%x",prp->s.ioctl.bCode)); 376 if(prp->s.ioctl.bCode == DAUDIO_OPEN) 377 { 378 LPMCI_AUDIO_INIT pInit = (LPMCI_AUDIO_INIT) prp->s.ioctl.pvData; 379 PAUDIOHW pHWobj; 380 MCI_AUDIO_CAPS audioCaps; 381 PDWAVESTREAM pStream; 382 383 if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE)) 384 { 385 rprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit)); 386 prp->usStatus |= RPERR | RPBADCMD; 387 return; 388 } 389 390 audioCaps.ulLength = sizeof(MCI_AUDIO_CAPS); 391 audioCaps.ulSamplingRate = pInit->lSRate; 392 audioCaps.ulChannels = pInit->sChannels; 393 audioCaps.ulBitsPerSample = pInit->lBitsPerSRate; 394 audioCaps.ulDataType = pInit->sMode; 395 audioCaps.ulOperation = OPERATION_PLAY; 396 397 // get the pointer to the hardware object 398 // call DevCaps 399 // bailout if no hardware object is returned.. 400 pHWobj = GetHardwareDevice(AUDIOHW_WAVE_PLAY); 401 if (pHWobj) 402 { 403 pHWobj->DevCaps(&audioCaps); 404 if (audioCaps.ulSupport != SUPPORT_SUCCESS) 405 { 406 rprintf(("IDirectAudio: DevCaps failed")); 407 pInit->sReturnCode = INVALID_REQUEST; 408 prp->usStatus |= RPERR; 409 return; 410 } 411 } 412 else 413 { 414 rprintf(("IDirectAudio: HW DevCaps failed")); 415 pInit->sReturnCode = INVALID_REQUEST; 416 prp->usStatus |= RPERR; 417 return; 418 } 419 420 pStream = new DWAVESTREAM(AUDIOHW_WAVE_PLAY, pInit, prp->s.ioctl.usSysFileNum, MixerStreamId); 421 if(pStream == NULL) { 423 422 //dprintf(("IDirectAudio: pStream")); 424 DebugInt3();425 pInit->sReturnCode = INVALID_REQUEST;426 prp->usStatus |= RPERR;427 return;428 }429 430 if(!pStream->IsEverythingOk())431 {432 delete pStream;423 DebugInt3(); 424 pInit->sReturnCode = INVALID_REQUEST; 425 prp->usStatus |= RPERR; 426 return; 427 } 428 429 if(!pStream->IsEverythingOk()) 430 { 431 delete pStream; 433 432 //dprintf(("IlDirectAudio: IsEverythingOk")); 434 DebugInt3();435 pInit->sReturnCode = INVALID_REQUEST;436 prp->usStatus |= RPERR;437 return;438 }439 pInit->ulFlags |= VOLUME; /* volume control is supported*/440 pInit->ulFlags |= INPUT; /* Input select is supported*/441 pInit->ulFlags |= OUTPUT; /* Output select is supported*/442 pInit->ulFlags |= MONITOR; /* Record Monitor is supported*/443 pInit->sDeviceID = ALSA_ID; /* Reported in VSD dll*/444 pStream->ulSysFileNum = prp->s.ioctl.usSysFileNum;445 pInit->pvReserved = (VOID FAR *) (ULONG) prp->s.ioctl.usSysFileNum;446 pInit->sReturnCode = 0;447 448 return;449 }450 else451 if(prp->s.ioctl.bCode == DAUDIO_QUERYFORMAT)452 {453 LPMCI_AUDIO_INIT pInit = (LPMCI_AUDIO_INIT) prp->s.ioctl.pvData;454 PAUDIOHW pHWobj;455 MCI_AUDIO_CAPS audioCaps;456 457 if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE))458 {459 rprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit));460 prp->usStatus |= RPERR | RPBADCMD;461 return;462 }463 464 audioCaps.ulLength= sizeof(MCI_AUDIO_CAPS);465 audioCaps.ulSamplingRate = pInit->lSRate;466 audioCaps.ulChannels= pInit->sChannels;467 audioCaps.ulBitsPerSample = pInit->lBitsPerSRate;468 audioCaps.ulDataType= pInit->sMode;469 audioCaps.ulOperation= OPERATION_PLAY;470 471 // get the pointer to the hardware object472 // call DevCaps473 // bailout if no hardware object is returned..474 pHWobj = GetHardwareDevice(AUDIOHW_WAVE_PLAY);475 if (pHWobj)476 {477 pHWobj->DevCaps(&audioCaps);478 if (audioCaps.ulSupport != SUPPORT_SUCCESS)479 {480 rprintf(("IlDirectAudio: DevCaps failed"));481 prp->usStatus |= RPERR;482 pInit->sReturnCode = INVALID_REQUEST;483 return;484 }433 DebugInt3(); 434 pInit->sReturnCode = INVALID_REQUEST; 435 prp->usStatus |= RPERR; 436 return; 437 } 438 pInit->ulFlags |= VOLUME; /* volume control is supported */ 439 pInit->ulFlags |= INPUT; /* Input select is supported */ 440 pInit->ulFlags |= OUTPUT; /* Output select is supported */ 441 pInit->ulFlags |= MONITOR; /* Record Monitor is supported */ 442 pInit->sDeviceID = ALSA_ID; /* Reported in VSD dll */ 443 pStream->ulSysFileNum = prp->s.ioctl.usSysFileNum; 444 pInit->pvReserved = (VOID FAR *) (ULONG) prp->s.ioctl.usSysFileNum; 445 pInit->sReturnCode = 0; 446 447 return; 448 } 449 else 450 if(prp->s.ioctl.bCode == DAUDIO_QUERYFORMAT) 451 { 452 LPMCI_AUDIO_INIT pInit = (LPMCI_AUDIO_INIT) prp->s.ioctl.pvData; 453 PAUDIOHW pHWobj; 454 MCI_AUDIO_CAPS audioCaps; 455 456 if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE)) 457 { 458 rprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit)); 459 prp->usStatus |= RPERR | RPBADCMD; 460 return; 461 } 462 463 audioCaps.ulLength = sizeof(MCI_AUDIO_CAPS); 464 audioCaps.ulSamplingRate = pInit->lSRate; 465 audioCaps.ulChannels = pInit->sChannels; 466 audioCaps.ulBitsPerSample = pInit->lBitsPerSRate; 467 audioCaps.ulDataType = pInit->sMode; 468 audioCaps.ulOperation = OPERATION_PLAY; 469 470 // get the pointer to the hardware object 471 // call DevCaps 472 // bailout if no hardware object is returned.. 473 pHWobj = GetHardwareDevice(AUDIOHW_WAVE_PLAY); 474 if (pHWobj) 475 { 476 pHWobj->DevCaps(&audioCaps); 477 if (audioCaps.ulSupport != SUPPORT_SUCCESS) 478 { 479 rprintf(("IlDirectAudio: DevCaps failed")); 480 prp->usStatus |= RPERR; 481 pInit->sReturnCode = INVALID_REQUEST; 482 return; 483 } 485 484 //dprintf(("IoctlDirectAudio ret0")); 486 pInit->sReturnCode = 0;487 return;488 }489 else {490 rprintf(("IoctlDirectAudio err req"));491 pInit->sReturnCode = INVALID_REQUEST;492 prp->usStatus |= RPERR;493 return;494 }495 }496 else497 if(prp->s.ioctl.bCode == DAUDIO_QUERYCAPS)498 {499 LPOSS32_DEVCAPS lpCaps = (LPOSS32_DEVCAPS) prp->s.ioctl.pvData;500 PWAVEAUDIO pHWobj;501 502 if(DevHelp_VerifyAccess(SELECTOROF(lpCaps), sizeof(OSS32_DEVCAPS), OFFSETOF(lpCaps), VERIFY_READWRITE))503 {504 rprintf(("Invalid OSS32_DEVCAPS pnt %lx!!", (ULONG)lpCaps));505 prp->usStatus |= RPERR | RPBADCMD;506 return;507 }508 // get the pointer to the hardware object509 // call DevCaps510 // bailout if no hardware object is returned..511 pHWobj = (PWAVEAUDIO)GetHardwareDevice(AUDIOHW_WAVE_PLAY);512 if (pHWobj)513 {514 pHWobj->DevCaps(lpCaps);485 pInit->sReturnCode = 0; 486 return; 487 } 488 else { 489 rprintf(("IoctlDirectAudio err req")); 490 pInit->sReturnCode = INVALID_REQUEST; 491 prp->usStatus |= RPERR; 492 return; 493 } 494 } 495 else 496 if(prp->s.ioctl.bCode == DAUDIO_QUERYCAPS) 497 { 498 LPOSS32_DEVCAPS lpCaps = (LPOSS32_DEVCAPS) prp->s.ioctl.pvData; 499 PWAVEAUDIO pHWobj; 500 501 if(DevHelp_VerifyAccess(SELECTOROF(lpCaps), sizeof(OSS32_DEVCAPS), OFFSETOF(lpCaps), VERIFY_READWRITE)) 502 { 503 rprintf(("Invalid OSS32_DEVCAPS pnt %lx!!", (ULONG)lpCaps)); 504 prp->usStatus |= RPERR | RPBADCMD; 505 return; 506 } 507 // get the pointer to the hardware object 508 // call DevCaps 509 // bailout if no hardware object is returned.. 510 pHWobj = (PWAVEAUDIO)GetHardwareDevice(AUDIOHW_WAVE_PLAY); 511 if (pHWobj) 512 { 513 pHWobj->DevCaps(lpCaps); 515 514 //dprintf(("IoctlDirectAudio ret1")); 516 return;517 }518 else519 {520 prp->usStatus |= RPERR;515 return; 516 } 517 else 518 { 519 prp->usStatus |= RPERR; 521 520 //dprintf(("IoctlDirectAudio ret err1")); 522 return;523 }524 }525 PSTREAM pStream;526 527 pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);528 if(pStream == NULL)529 {530 rprintf(("IDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));531 DebugInt3();532 prp->usStatus |= RPERR | RPBADCMD;533 return;534 }535 536 LPDAUDIO_CMD pDAudioCmd = (LPDAUDIO_CMD) prp->s.ioctl.pvData;537 ULONGrc = 0;538 539 if(DevHelp_VerifyAccess(SELECTOROF(pDAudioCmd), sizeof(DAUDIO_CMD), OFFSETOF(pDAudioCmd), VERIFY_READWRITE))540 {541 rprintf(("Invalid DAUDIO_CMD pnt %lx!!", (ULONG)pDAudioCmd));542 prp->usStatus |= RPERR | RPBADCMD;543 return;544 }545 546 switch(prp->s.ioctl.bCode)547 {548 case DAUDIO_CLOSE:521 return; 522 } 523 } 524 PSTREAM pStream; 525 526 pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 527 if(pStream == NULL) 528 { 529 rprintf(("IDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum)); 530 DebugInt3(); 531 prp->usStatus |= RPERR | RPBADCMD; 532 return; 533 } 534 535 LPDAUDIO_CMD pDAudioCmd = (LPDAUDIO_CMD) prp->s.ioctl.pvData; 536 ULONG rc = 0; 537 538 if(DevHelp_VerifyAccess(SELECTOROF(pDAudioCmd), sizeof(DAUDIO_CMD), OFFSETOF(pDAudioCmd), VERIFY_READWRITE)) 539 { 540 rprintf(("Invalid DAUDIO_CMD pnt %lx!!", (ULONG)pDAudioCmd)); 541 prp->usStatus |= RPERR | RPBADCMD; 542 return; 543 } 544 545 switch(prp->s.ioctl.bCode) 546 { 547 case DAUDIO_CLOSE: 549 548 //dprintf(("ID close")); 550 delete pStream;551 break;552 553 case DAUDIO_SETVOLUME:554 {549 delete pStream; 550 break; 551 552 case DAUDIO_SETVOLUME: 553 { 555 554 //dprintf(("ID SetVolume")); 556 pStream->SetProperty(PROPERTY_VOLUME, MAKE_VOLUME_LR(pDAudioCmd->Vol.VolumeL, pDAudioCmd->Vol.VolumeR));557 break;558 }559 560 case DAUDIO_GETVOLUME:561 {555 pStream->SetProperty(PROPERTY_VOLUME, MAKE_VOLUME_LR(pDAudioCmd->Vol.VolumeL, pDAudioCmd->Vol.VolumeR)); 556 break; 557 } 558 559 case DAUDIO_GETVOLUME: 560 { 562 561 //dprintf(("ID GetVolume")); 563 pDAudioCmd->Vol.VolumeL = GET_VOLUME_L(pStream->GetProperty(PROPERTY_VOLUME));564 pDAudioCmd->Vol.VolumeR = GET_VOLUME_R(pStream->GetProperty(PROPERTY_VOLUME));565 break;566 }567 568 case DAUDIO_START:569 {570 dprintf(("ID Start NF:%d",(USHORT)numFreeStreams));571 if(numFreeStreams > 0)572 {573 rc = pStream->StartStream();574 if(!rc) numFreeStreams--;575 }576 else577 {578 rprintf(("ID Start rc1"));579 rc = 1; //fail580 }581 break;582 }583 584 case DAUDIO_STOP:585 {586 CONTROL_PARM cParm;587 intfActive = pStream->isActive();588 589 dprintf(("ID Stop NF:%d",(USHORT)numFreeStreams));590 rc = pStream->StopStream(&cParm);591 if(!rc && fActive) numFreeStreams++;592 break;593 }594 595 case DAUDIO_PAUSE:596 {597 CONTROL_PARM cParm;598 dprintf(("ID Pause"));599 rc = pStream->PauseStream(&cParm);600 break;601 }602 603 case DAUDIO_RESUME:604 {605 dprintf(("ID Resume"));606 rc = pStream->ResumeStream();607 break;608 }609 610 case DAUDIO_GETPOS:611 {562 pDAudioCmd->Vol.VolumeL = GET_VOLUME_L(pStream->GetProperty(PROPERTY_VOLUME)); 563 pDAudioCmd->Vol.VolumeR = GET_VOLUME_R(pStream->GetProperty(PROPERTY_VOLUME)); 564 break; 565 } 566 567 case DAUDIO_START: 568 { 569 dprintf(("ID Start NF:%d",(USHORT)numFreeStreams)); 570 if(numFreeStreams > 0) 571 { 572 rc = pStream->StartStream(); 573 if(!rc) numFreeStreams--; 574 } 575 else 576 { 577 rprintf(("ID Start rc1")); 578 rc = 1; //fail 579 } 580 break; 581 } 582 583 case DAUDIO_STOP: 584 { 585 CONTROL_PARM cParm; 586 int fActive = pStream->isActive(); 587 588 dprintf(("ID Stop NF:%d",(USHORT)numFreeStreams)); 589 rc = pStream->StopStream(&cParm); 590 if(!rc && fActive) numFreeStreams++; 591 break; 592 } 593 594 case DAUDIO_PAUSE: 595 { 596 CONTROL_PARM cParm; 597 dprintf(("ID Pause")); 598 rc = pStream->PauseStream(&cParm); 599 break; 600 } 601 602 case DAUDIO_RESUME: 603 { 604 dprintf(("ID Resume")); 605 rc = pStream->ResumeStream(); 606 break; 607 } 608 609 case DAUDIO_GETPOS: 610 { 612 611 //dprintf(("ID GetPos")); 613 pDAudioCmd->Pos.ulCurrentPos = pStream->GetCurrentPos();614 pDAudioCmd->Pos.ulWritePos= pStream->GetCurrentWritePos();615 break;616 }617 618 case DAUDIO_ADDBUFFER:619 {612 pDAudioCmd->Pos.ulCurrentPos = pStream->GetCurrentPos(); 613 pDAudioCmd->Pos.ulWritePos = pStream->GetCurrentWritePos(); 614 break; 615 } 616 617 case DAUDIO_ADDBUFFER: 618 { 620 619 //dprintf(("ID AddBuffer")); 621 rc = pStream->Write((PSTREAMBUF)pDAudioCmd->Buffer.lpBuffer, pDAudioCmd->Buffer.ulBufferLength);622 break;623 }624 625 case DAUDIO_SETPROPERTY:626 {620 rc = pStream->Write((PSTREAMBUF)pDAudioCmd->Buffer.lpBuffer, pDAudioCmd->Buffer.ulBufferLength); 621 break; 622 } 623 624 case DAUDIO_SETPROPERTY: 625 { 627 626 //dprintf(("ID SetProp")); 628 rc = pStream->SetProperty((USHORT)pDAudioCmd->SetProperty.type, pDAudioCmd->SetProperty.value);629 break;630 }631 632 case DAUDIO_REGISTER_THREAD:633 {634 DDCMDREGISTER reg;627 rc = pStream->SetProperty((USHORT)pDAudioCmd->SetProperty.type, pDAudioCmd->SetProperty.value); 628 break; 629 } 630 631 case DAUDIO_REGISTER_THREAD: 632 { 633 DDCMDREGISTER reg; 635 634 636 635 //dprintf(("ID Reg")); 637 reg.ulFunction= DDCMD_REG_STREAM;638 reg.hStream= pDAudioCmd->Thread.hSemaphore;639 reg.ulSysFileNum = prp->s.ioctl.usSysFileNum;640 reg.pSHDEntryPoint = NULL;641 rc = pStream->Register(®);642 break;643 }644 645 case DAUDIO_DEREGISTER_THREAD:646 {636 reg.ulFunction = DDCMD_REG_STREAM; 637 reg.hStream = pDAudioCmd->Thread.hSemaphore; 638 reg.ulSysFileNum = prp->s.ioctl.usSysFileNum; 639 reg.pSHDEntryPoint = NULL; 640 rc = pStream->Register(®); 641 break; 642 } 643 644 case DAUDIO_DEREGISTER_THREAD: 645 { 647 646 //dprintf(("ID DeReg")); 648 pStream->DeRegister();649 break;650 }651 652 case DAUDIO_QUERYVERSION:647 pStream->DeRegister(); 648 break; 649 } 650 651 case DAUDIO_QUERYVERSION: 653 652 //dprintf(("ID qVer")); 654 pDAudioCmd->Version.ulVersion = DAUDIO_VERSION;655 break;656 }657 658 if(rc)659 {653 pDAudioCmd->Version.ulVersion = DAUDIO_VERSION; 654 break; 655 } 656 657 if(rc) 658 { 660 659 //dprintf(("IoctlDirectAudio ret err rc=%ld",rc)); 661 prp->usStatus |= RPERR | RPBADCMD;662 return;663 }660 prp->usStatus |= RPERR | RPBADCMD; 661 return; 662 } 664 663 //dprintf(("IoctlDirectAudio ret Ok")); 665 return;664 return; 666 665 } 667 666 //****************************************************************************** 668 667 //****************************************************************************** 669 668 /**@internal 670 * @param PREQPACKET pointer to the strategy request packet671 * @return None But the Status in the request packet is updated on error669 * @param PREQPACKET pointer to the strategy request packet 670 * @return None But the Status in the request packet is updated on error 672 671 * @notes 673 672 * StrategyIoctl is called from the strategy entry point to process IOCTL … … 681 680 extern "C" void StrategyIoctl(PREQPACKET prp, USHORT LDev) 682 681 { 683 dprintf(("StrategyIoctl:cat:0x%x, code:0x%x cd %d gd %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device, LDev));682 dprintf(("StrategyIoctl:cat:0x%x, code:0x%x cd %d gd %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device, LDev)); 684 683 switch (prp->s.ioctl.bCategory) { 685 684 case DAUDIO_IOCTL_CAT: /* 0x91 */ 686 IoctlDirectAudio(prp);687 break;685 IoctlDirectAudio(prp); 686 break; 688 687 689 688 case MIXER_IOCTL_CAT: /* 0x90 */ 690 IoctlMixer(prp, LDev);691 break;689 IoctlMixer(prp, LDev); 690 break; 692 691 693 692 case AUDIO_IOCTL_CAT: /* 0x80 */ -
OCO/trunk/drv16/waudio.cpp
r526 r533 1360 1360 ulBytesPerIRQ = pConfigInfo->ulPCMConsumeRate >> 6; // 64 interrupts per second 1361 1361 // we can tweak this as needed but generally this should do rjj 1362 #if 0 // commented out by DAZ 1362 1363 // make sure it's an even multiple of 64 1363 1364 ulBytesPerIRQ += 0x00000040; … … 1367 1368 ulBytesPerIRQ = 0x800; 1368 1369 } 1370 #endif 1369 1371 pConfigInfo->ulBytesPerIRQ = ulBytesPerIRQ; 1370 1372 dprintf4(("WAVEAUDIO::ConfigDev BytesPerIRQ:%ld",ulBytesPerIRQ)); -
OCO/trunk/drv16/wavestrm.cpp
r529 r533 55 55 USHORT WAVESTREAM::_vRealignBuffer(ULONG ulEndPos, PSTREAMBUFFER pBuffer) 56 56 { 57 if ( ulEndPos >= pBuffer->ulDonepos) { /* all of the data has been consumed */57 if (ARG1_IS_AFTER_OR_EQUAL_TO_ARG2(ulEndPos, pBuffer->ulDonepos)) { /* all of the data has been consumed */ 58 58 pBuffer->ulBuffpos = pBuffer->ulBuffsz; 59 59 pBuffer->ulDonepos = 0; … … 61 61 } 62 62 63 if ( ulEndPos >= (pBuffer->ulDonepos - pBuffer->ulBuffpos)) { /* some of the data has been consumed */63 if (ARG1_IS_AFTER_OR_EQUAL_TO_ARG2(ulEndPos, (pBuffer->ulDonepos - pBuffer->ulBuffpos))) { /* some of the data has been consumed */ 64 64 pBuffer->ulBuffpos = pBuffer->ulDonepos - ulEndPos; 65 65 pBuffer->ulBuffpos &= 0xFFFFFFFC; //keep it on a dword boundary … … 155 155 fUnderrun = TRUE; 156 156 _ulBytesProcessed = 0; 157 _ulLastPosition = 0; 157 158 _ulBytesWritten = 0; 158 159 } … … 175 176 176 177 _ulBytesProcessed = 0; 178 _ulLastPosition = 0; 177 179 _ulBytesWritten = 0; 178 180 ulStreamState = STREAM_STREAMING; … … 298 300 299 301 if (pahw->Transfer(StreamId, &_configinfo, pDataBuf, ulBuffLeft, &ulBytesWritten) == FALSE) { 300 // This could mean that the hardware has underrun TODO: implement underrun logic302 // This could mean that the hardware has underrun 301 303 rprintf(("WS::AB: pahw->Transfer failed")); 302 304 return (ULONG)-1; … … 304 306 //dprintf(("WS::AB: %lx of %lx bytes written", ulBytesWritten, ulBuffLeft)); 305 307 if (ulBytesWritten == 0) { 306 // This could mean that the hardware has underrun TODO: implement underrun logic308 // This could mean that the hardware has underrun 307 309 //rprintf(("WS::AddBuffer: 0 of %lx bytes written by transfer", ulBuffLeft)); 308 310 return (ULONG)-1; … … 322 324 return ulBytesWritten; 323 325 } 326 324 327 //****************************************************************************** 325 328 // Read data from the audio Buffer. … … 363 366 return TRUE; 364 367 } 368 365 369 //****************************************************************************** 366 370 // called by the irq function in the hardware object when we get an interrupt … … 377 381 { 378 382 PSTREAMBUFFER pTemp; 379 ULONG ulBytes ;383 ULONG ulBytes, ulDelta; 380 384 381 385 // get the stream position. if we get a bad rc or the position is 0 … … 391 395 return; 392 396 } 393 _ulBytesProcessed = ulBytes; 397 398 ulDelta = ulBytes - _ulLastPosition; 399 if (ulBytes < _ulLastPosition) { /* the byte counter in uniaud32 has wrapped */ 400 ulDelta = ulBytes; 401 if (_configinfo.ulBytesPerIRQ > ulDelta) ulDelta = _configinfo.ulBytesPerIRQ; 402 rprintf(("u32 wrap: BytesProcessed=%lx LastPosition=%lx Bytes=%lx Delta=%lx InProcess=%lx Done=%lx", 403 _ulBytesProcessed, _ulLastPosition, ulBytes, ulDelta, qhInProcess.IsElements(), qhDone.IsElements())); 404 } 405 406 _ulBytesProcessed += ulDelta; 407 _ulLastPosition = ulBytes; 394 408 395 409 if(!qhInProcess.IsElements() && !qhDone.IsElements()) { … … 407 421 // done playing the stream 408 422 if ((qhDone.Head() == qhDone.Tail()) && !qhInProcess.IsElements()) { /* only one buffer left */ 409 if ( _ulBytesProcessed < pTemp->ulDonepos) break;423 if (ARG1_IS_BEFORE_ARG2(_ulBytesProcessed, pTemp->ulDonepos)) break; 410 424 } else { /* not the last buffer */ 411 /* if the buffer is bigger than BytesPerIRQ and it's not finished yet, hang on to it */ 412 if (!usBufferMode && (_ulBytesProcessed < pTemp->ulDonepos)) break; 413 //if ((_ulBytesProcessed + _configinfo.ulBytesPerIRQ) < pTemp->ulDonepos) break; 425 /* if uniaud32 is not done playing the data hang on to the buffer */ 426 if (!usBufferMode && ARG1_IS_BEFORE_ARG2(_ulBytesProcessed, pTemp->ulDonepos)) break; 414 427 } 415 428 ReturnBuffer(); … … 485 498 ULONG Seconds, MilliSeconds, Overflow, Processed; 486 499 487 //PS++ optimize code488 500 Processed = _ulBytesProcessed; 489 if (ulStreamState == STREAM_STREAMING) // if the stream is active 490 { 491 if (ulStreamType & STREAM_WRITE) 492 { 493 if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 494 { 495 //DebugInt3(); 496 Processed = _ulBytesProcessed; //last known position 497 } 501 if (ulStreamState == STREAM_STREAMING) { // if the stream is active 502 if (ulStreamType & STREAM_WRITE) { 503 if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) { 504 Processed = _ulBytesProcessed; 505 } 498 506 } 499 507 } 500 508 501 509 // if we haven't processed anything then just return _ulTimeBase 502 if(Processed == 0) 503 return(_ulTimeBase); 510 if(Processed == 0) return(_ulTimeBase); 504 511 505 512 Seconds = Processed / _configinfo.ulPCMConsumeRate; … … 515 522 ULONG Processed; 516 523 517 //PS++ optimize code518 524 Processed = _ulBytesProcessed; 519 if (ulStreamState == STREAM_STREAMING) // if the stream is active 520 { 521 if (ulStreamType & STREAM_WRITE) 522 { 523 if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 524 { 525 if (ulStreamState == STREAM_STREAMING) { // if the stream is active 526 if (ulStreamType & STREAM_WRITE) { 527 if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) { 525 528 DebugInt3(); 526 529 Processed = _ulBytesProcessed; //last known position … … 590 593 591 594 _ulBytesProcessed = 0; 595 _ulLastPosition = 0; 592 596 _ulBytesWritten = 0; 593 597 fUnderrun = FALSE; … … 632 636 return NO_ERROR; 633 637 } 638 634 639 //silence wave stream before stopping it (removes clicks) 635 640 if(ulStreamType == STREAM_WAVE_PLAY) { … … 652 657 // DDCMD_ENABLE_EVENT the event time will get screwed up. rjj 653 658 _ulBytesProcessed = 0; 659 _ulLastPosition = 0; 654 660 _ulBytesWritten = 0; 655 661 return NO_ERROR; … … 659 665 ULONG WAVESTREAM::PauseStream(PCONTROL_PARM pControl) 660 666 { 661 ULONG ulEndPos;667 //DAZ ULONG ulEndPos; 662 668 663 669 if(ulStreamState == STREAM_PAUSED) { … … 668 674 } 669 675 670 pahw->GetPosition(StreamId, &_configinfo, &ulEndPos);676 //DAZ pahw->GetPosition(StreamId, &_configinfo, &ulEndPos); 671 677 //silence wave stream before stopping it (removes clicks) 672 678 pahw->SetVolume(StreamId, getMixerStreamId(), 0); … … 677 683 dprintf(("WS::PauseStream %lx", StreamId)); 678 684 679 _ulBytesProcessed = ulEndPos;680 681 _vRealignPausedBuffers( ulEndPos);685 //DAZ _ulBytesProcessed = ulEndPos; 686 687 _vRealignPausedBuffers(_ulBytesProcessed); 682 688 683 689 pControl->ulTime = GetCurrentTime(); 684 690 685 691 _ulBytesProcessed = 0; 692 _ulLastPosition = 0; 686 693 _ulBytesWritten = 0; 687 694 fUnderrun = FALSE; … … 755 762 _ulBytesWritten = 0; 756 763 _ulBytesProcessed = 0; 764 _ulLastPosition = 0; 757 765 _ulTimeBase = 0; 758 766 ulSavedInputGain = 0; -
OCO/trunk/drv16/wavestrm.hpp
r526 r533 63 63 ULONG _ulBytesWritten; // number of bytes transferred to uniaud32 64 64 ULONG _ulBytesProcessed; // number of bytes consumed or produced 65 ULONG _ulLastPosition; // Last position of consumed bytes 65 66 ULONG _ulTimeBase; // value in ms. MMPM sends for stream time 66 67 -
OCO/trunk/install/CHANGELOG.TXT
r510 r533 2 2 UNIAUD CHANGELOG 3 3 ================ 4 5 ===== Uniaud16 1.9.5 and Uniaud32 1.9.24/2.1.1 : July 31, 2010 ===== 6 7 * Added code to handle when uniaud32 processed byte counter wraps 8 (uniaud16) 9 10 * All above changes by David Azarewicz 11 12 ===== Uniaud16 1.9.4 and Uniaud32 1.9.24/2.1.1 : July 27, 2010 ===== 13 14 * Driver level underrun detection and attempted recovery removed 15 from Uniaud16. 16 17 * Xrun restart fixed in Uniaud32. 18 19 * PCI bus scan now scans all 256 busses rather than just 16. 20 Dynamic allocation of bus structure instead of static. 21 Other PCI bus scan bugs fixed. (uniaud32) 22 23 * Implemented wild card (PCI_ANY_ID) device matching in PCI bus 24 scan (uniaud32) 25 26 * Implemented wild card (PCI_ANY_ID) device matching in deregister 27 driver (uniaud32) 28 29 * Changed flush_workqueue to not hang on shutdown. (uniaud32) 30 31 * Added mixer quirk for Intel Gateway/eMachines with STAC 922x mixer 32 (uniaud32) 33 34 * All above changes by David Azarewicz 4 35 5 36 ===== 1.9.3 and 1.9.23 : July 10, 2010 ===== -
OCO/trunk/install/control.scr
r529 r533 25 25 ssgroup=0 26 26 ssname="mmbase" 27 ssversion="1.9. 4-SVNr529"27 ssversion="1.9.5-SVNr533" 28 28 sstermdll="ITERM.DLL" 29 29 sstermdllentry="ITermEntry" … … 43 43 ssgroup=17 44 44 ssname="OS/2 Universal Audio: Wave" 45 ssversion="1.9. 4-SVNr529"45 ssversion="1.9.5-SVNr533" 46 46 sssize=680 47 47 ssdll="genin.dll" -
OCO/trunk/uniaud.inc
r529 r533 7 7 # BUILDVERSION must be 3 parts, and only numbers like 5.44.108 8 8 # It is best that 2nd number is always 2 digits, eg at least 10 9 BUILDVERSION = 1.9. 49 BUILDVERSION = 1.9.5 10 10 11 11 # Fixpack version … … 13 13 # ex RC3 GA FIXPACK2 beta_47 14 14 # Comment out to avoid a fixpack line in bldlevel 15 FIXPACK = SVNr5 2915 FIXPACK = SVNr533 16 16 17 17 # ALSA BUILD VERSION
Note:
See TracChangeset
for help on using the changeset viewer.
