Changeset 507 for OCO/trunk/drv16/waveplay.cpp
- Timestamp:
- Jul 11, 2010, 5:31:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/waveplay.cpp
r495 r507 46 46 ULONG open_strategy = 0UL; 47 47 ULONG LastSpace=0; 48 //int force_close(void);48 //int force_close(void); 49 49 } 50 50 … … 60 60 { 61 61 ULONG ret; 62 #ifdef DEBUG 63 // dprintf(("WAVEPLAY::Open %lx",StreamId)); 64 #endif 62 //dprintf(("WAVEPLAY::Open %lx",StreamId)); 65 63 if (fAPMSuspend) 66 64 { 67 #ifdef DEBUG 68 // dprintf(("WAVEPLAY::Open. Suspend state")); 69 #endif 65 //dprintf(("WAVEPLAY::Open. Suspend state")); 70 66 apm_resume(); 71 //return FALSE;72 67 } 73 68 … … 76 71 if((ret = OSS16_WaveOpen(ulDevice, ulStreamType, ulSysFileNum, pStreamId)) != OSSERR_SUCCESS) 77 72 { 78 #ifdef DEBUG79 73 dprintf(("OSS16_WaveOpen failed!!")); 80 #endif81 74 DebugInt3(); 82 //StreamId = 0;83 //waveOpened = 0;75 //StreamId = 0; 76 //waveOpened = 0; 84 77 return FALSE; 85 78 } else … … 106 99 BOOL WAVEPLAY::Close(OSSSTREAMID StreamIdl) 107 100 { 108 #ifdef DEBUG 109 // dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 110 #endif 101 //dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 111 102 #if 0 // fixme to be gone? 112 103 //if ((open_strategy & 1)) … … 118 109 open_strategy = 0UL; 119 110 force_closed = 0; 120 #ifdef DEBUG 121 // dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 122 #endif 111 //dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 123 112 return TRUE; 124 113 } … … 126 115 #endif // fixme to be gone? 127 116 { 128 129 117 /* Setting DISABLE_STREAM_REUSE will close the open stream here. */ 130 118 /* If left unset, the idea is the open stream will be reused instead. */ … … 139 127 StreamId = 0UL; 140 128 open_strategy = 0UL; 141 #ifdef DEBUG 142 // dprintf(("OSS16_WAVECLOSE: Success")); 143 #endif /* DEBUG */ 129 dprintf(("OSS16_WAVECLOSE: Success")); 144 130 return TRUE; 145 } else 146 #ifdef DEBUG 131 } else { 147 132 dprintf(("OSS16_WAVECLOSE: Error")); 148 #endif /* DEBUG */149 133 return FALSE; 134 } 150 135 } 151 136 else 152 137 #else /* !DISABLE_STREAM_REUSE */ 153 if (StreamIdl == NULL) 154 return FALSE; 138 if (StreamIdl == NULL) return FALSE; 155 139 #endif /* DISABLE_STREAM_REUSE */ 156 140 return TRUE; … … 170 154 if (fAPMSuspend) 171 155 { 172 #ifdef DEBUG 173 // dprintf(("WAVEPLAY::ConfigDev. Suspend state")); 174 #endif 156 //dprintf(("WAVEPLAY::ConfigDev. Suspend state")); 175 157 apm_resume(); 176 //return FALSE;177 158 } 178 159 … … 182 163 if (StreamId == NULL) 183 164 { 184 #ifdef DEBUG185 165 dprintf(("WAVEPLAY::ConfigDev. Error reopening stream")); 186 #endif187 166 return FALSE; 188 167 } 189 168 } 190 #ifdef DEBUG191 169 dprintf4(("WAVEPLAY::ConfigDev SampleRate %ld", pConfigInfo->ulHwSampleRate)); 192 170 dprintf4(("WAVEPLAY::ConfigDev ulFirstBufSize=%lx ulFragsize=%lx", ulFirstBufSize, pConfigInfo->ulFragsize)); 193 #endif194 171 195 172 if(ulFirstBufSize == 0) … … 200 177 DebugInt3(); 201 178 ulFirstBufSize = 8192; //should never happen! 202 #ifdef DEBUG203 179 dprintf(("Arg - shouldn't happen")); 204 #endif /* DEBUG */205 180 } 206 181 } … … 209 184 //convert size of first buffer 210 185 ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo); 211 #ifdef DEBUG212 186 dprintf4(("ulFirstBufSize %lx", ulFirstBufSize)); 213 #endif /* DEBUG */214 187 } 215 188 //Must call this method (i.e. resets sample rate conversion position) … … 221 194 //convert consume rate 222 195 ulPCMConsumeRate = ConvertLength(pConfigInfo->ulPCMConsumeRate, pConfigInfo); 223 #ifdef DEBUG224 196 dprintf4(("cons rate %lx buf size %lx init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate)); 225 #endif /* DEBUG */226 197 227 198 fragsize = ulPCMConsumeRate/64; //start with 64 irqs/sec 2756 … … 250 221 pConfigInfo->ulFragsize = fragsize; 251 222 252 #ifdef DEBUG253 223 dprintf4(("fragsize %lx", fragsize)); 254 #endif255 224 hwparam.ulSampleRate = pConfigInfo->ulHwSampleRate; 256 225 hwparam.ulBitsPerSample = pConfigInfo->ulHwBitsPerSample; … … 258 227 hwparam.ulDataType = QueryOSSDataFormat(OPERATION_PLAY, pConfigInfo->ulDataType, pConfigInfo->ulHwBitsPerSample); 259 228 rc = (USHORT)OSS16_WaveSetFormat(StreamId, &hwparam); 260 #ifdef DEBUG261 229 dprintf4(("WAVEPLAY:ConfigDev:OSS16_WaveSetFormat . rc = %d",rc)); 262 230 dprintf4(("samp rate=%ld bps=%ld channels=%ld type=%ld", hwparam.ulSampleRate, hwparam.ulBitsPerSample, hwparam.ulNumChannels, hwparam.ulDataType)); 263 231 264 #endif265 232 if( rc != OSSERR_SUCCESS) { 266 233 dprintf(("WAVEPLAY:ConfigDev: rc %d",rc)); … … 276 243 //****************************************************************************** 277 244 //Convert (if required) and write wave data to audio device 245 // Return FALSE on error 278 246 //****************************************************************************** 279 247 BOOL WAVEPLAY::Transfer(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, … … 283 251 *pulBytesTransferred = 0; 284 252 285 #ifdef DEBUG286 253 //dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer)); 287 #endif 288 289 if (fAPMSuspend) 290 { 291 #ifdef DEBUG 292 // dprintf(("WAVEPLAY::Transfer. Suspend state")); 293 #endif 254 255 if (fAPMSuspend) { 256 //dprintf(("WAVEPLAY::Transfer. Suspend state")); 294 257 apm_resume(); 295 //return FALSE; 296 } 297 298 //PS very strange 299 if (!ulBytesToTransfer) 300 { 258 } 259 260 if (!ulBytesToTransfer) { 301 261 return TRUE; 302 262 } 303 263 304 //if (!waveOpened) return TRUE;264 //if (!waveOpened) return TRUE; 305 265 306 266 if(pConfigInfo->usConversion == CONVERT_NONE) … … 308 268 if (AddBuffer(StreamId, pConfigInfo, pUserBuffer, ulBytesToTransfer, pulBytesTransferred) == FALSE) 309 269 { 310 #ifdef DEBUG311 270 dprintf(("Transfer.False. NoConv ulB %ld tr:%ld",ulBytesToTransfer,*pulBytesTransferred)); 312 #endif /* DEBUG */313 271 *pulBytesTransferred = 0; 314 272 return FALSE; … … 331 289 { 332 290 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); 333 //DebugInt3();291 //DebugInt3(); 334 292 ulBytesToTransfer = ulBytesToTransfer & ~(pConfigInfo->ulSampleSize-1); 335 #ifdef DEBUG336 293 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); 337 #endif338 294 } 339 295 pConfigInfo->pfnConvert(pUserBuffer, ulBytesToTransfer, pConfigInfo->pConversionBuffer); … … 347 303 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) 348 304 { 349 #ifdef DEBUG350 305 dprintf(("Transfer New pulBr %ld" , pulBytesTransferred)); 351 #endif 352 // DebugInt3(); 306 //DebugInt3(); 353 307 } 354 308 } … … 356 310 { 357 311 dprintf(("Transfer Zero pConfigInfo->pfnConvert")); 358 //DebugInt3();312 //DebugInt3(); 359 313 return FALSE; 360 314 } … … 370 324 OSSRET rc; 371 325 ULONG Space; 372 // if (!waveOpened) return TRUE; 373 374 //PS Here is inrerrupt time.... 375 if (fAPMSuspend) 376 { 377 #ifdef DEBUG 378 // dprintf(("WAVEPLAY::AddBuffer. Suspend state")); 379 #endif 326 //if (!waveOpened) return TRUE; 327 328 //PS Here is inrerrupt time.... 329 if (fAPMSuspend) { 330 //dprintf(("WAVEPLAY::AddBuffer. Suspend state")); 380 331 apm_resume(); 381 332 //return FALSE; … … 407 358 if (ulCvtBufferSize > Space) 408 359 { 409 #ifdef DEBUG410 360 dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space)); 411 #endif412 361 if (Space < pConfigInfo->ulBytesPerIRQ) 413 362 { … … 482 431 if(OSS16_WaveGetPos(StreamId, &ulCurBytesProcessed) != OSSERR_SUCCESS) { 483 432 *pulStreamPosition = 0; 484 #ifdef DEBUG485 433 dprintf(("WAVEPLAY::GetPosition: Failed")); 486 #endif /* DEBUG */487 434 return FALSE; 488 435 } … … 505 452 { 506 453 *pulStreamSpace = 0; 507 #ifdef DEBUG508 454 dprintf(("WAVEPLAY::GetSpace: Failed")); 509 #endif /* DEBUG */510 455 return FALSE; 511 456 } … … 527 472 { 528 473 *pulHwPtr = 0; 529 #ifdef DEBUG530 474 dprintf(("WAVEPLAY::WaveGetHwPtr: Failed")); 531 #endif /* DEBUG */532 475 return FALSE; 533 476 }
Note:
See TracChangeset
for help on using the changeset viewer.