Changeset 178 for sbliveos2/trunk/drv16/dwavestrm.cpp
- Timestamp:
- Apr 30, 2001, 11:08:00 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sbliveos2/trunk/drv16/dwavestrm.cpp
r174 r178 26 26 27 27 #include <devhelp.h> 28 #include <include.h> 28 29 29 30 #include "dwavestrm.hpp" … … 32 33 #include "ioctl.h" 33 34 #include "malloc.h" 35 #include <ossidc.h> 34 36 35 37 void cdecl HookHandler(ULONG ulSysFileNum) 36 38 { 37 39 PDWAVESTREAM pStream; 38 PSTREAMBUFFER EXtemp;40 PSTREAMBUFFER temp; 39 41 int rc; 40 42 … … 46 48 } 47 49 48 temp = (PSTREAMBUFFER EX)pStream->qhReturn.PopHead();50 temp = (PSTREAMBUFFER)pStream->qhReturn.PopHead(); 49 51 while(temp) { 50 52 if(pStream->hSem) { … … 58 60 delete temp; 59 61 60 temp = (PSTREAMBUFFER EX)pStream->qhReturn.PopHead();62 temp = (PSTREAMBUFFER)pStream->qhReturn.PopHead(); 61 63 } 62 64 return; … … 64 66 65 67 66 ULONG DWAVESTREAM::Write(PSTREAMBUF pbuf, ULONG uLength )67 { 68 PSTREAMBUFFER EXpStreamBuf;68 ULONG DWAVESTREAM::Write(PSTREAMBUF pbuf, ULONG uLength, BOOL fLooping) 69 { 70 PSTREAMBUFFER pStreamBuf; 69 71 LIN linAddr; 70 72 PULONG pLock; … … 73 75 int rc; 74 76 75 pStreamBuf = new STREAMBUFFER EX(uLength, (PSTREAMBUF)0);77 pStreamBuf = new STREAMBUFFER(uLength, (PSTREAMBUF)0, fLooping); 76 78 if(pStreamBuf == NULL) { 77 79 DebugInt3(); … … 110 112 void DWAVESTREAM::ReturnBuffer(void) 111 113 { 112 PSTREAMBUFFER EX temp = (PSTREAMBUFFEREX)qhDone.PopHead();114 PSTREAMBUFFER temp = (PSTREAMBUFFER)qhDone.PopHead(); 113 115 114 116 if(temp) … … 148 150 } 149 151 152 // 153 // 154 ULONG DWAVESTREAM::StartStream(void) 155 { 156 return WAVESTREAM::StartStream(); 157 } 158 159 160 void DWAVESTREAM::AddBuffers(BOOL fFirst) 161 { 162 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Tail(); 163 ULONG space, Buff_left, byteswritten; 164 165 if(!pTemp) pTemp = (PSTREAMBUFFER)qhInProcess.Tail(); 166 167 if(ulStreamType & STREAM_WRITE && pTemp && pTemp->looping) 168 { 169 Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos; 170 171 space = OSS16_StreamGetSpace(this); 172 if(fFirst) { 173 space = min(space, 4*fragsize); 174 } 175 else space = min(space, fragsize); 176 177 if(space) { 178 if(space >= Buff_left) { 179 byteswritten = AddBuffer(Buff_left); 180 if(byteswritten == Buff_left) { 181 pTemp->ulBuffpos = 0; //reset fill position 182 AddBuffer(space - Buff_left); 183 } 184 } 185 else AddBuffer(space); 186 } 187 pTemp->ulDonepos = 0; //make sure it ::Process never thinks it's done 188 } 189 else WAVESTREAM::AddBuffers(fFirst); 190 } 191 192 BOOL DWAVESTREAM::SetProperty(int type, ULONG value, ULONG reserved) 193 { 194 switch(type) { 195 case PROPERTY_LOOPING: 196 { 197 cli(); 198 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 199 200 if(!pTemp) pTemp = (PSTREAMBUFFER)qhDone.Head(); 201 202 if(pTemp) { 203 pTemp->looping = (BOOL)value; 204 if(pTemp->looping == FALSE) { 205 //calculate current play position 206 pTemp->ulDonepos = (_ulBytesProcessed % pTemp->ulBuffsz); 207 } 208 } 209 sti(); 210 } 211 case PROPERTY_FREQUENCY: 212 break; 213 214 default: 215 return WAVESTREAM::SetProperty(type, value, reserved); 216 217 } 218 return TRUE; 219 } 220 221 ULONG DWAVESTREAM::GetProperty(int type) 222 { 223 switch(type) { 224 case PROPERTY_LOOPING: 225 { 226 cli(); 227 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 228 ULONG ret = FALSE; 229 230 if(!pTemp) pTemp = (PSTREAMBUFFER)qhDone.Head(); 231 232 if(pTemp) { 233 ret = pTemp->looping; 234 } 235 sti(); 236 return ret; 237 } 238 239 default: 240 return WAVESTREAM::GetProperty(type); 241 } 242 } 150 243 151 244 DWAVESTREAM::DWAVESTREAM(ULONG streamtype, LPMCI_AUDIO_INIT pinit, USHORT filesysnum): … … 161 254 { 162 255 if (ulStreamState == STREAM_STREAMING) { 163 CONTROL_PARM cParm;164 StopStream(&cParm);256 CONTROL_PARM cParm; 257 StopStream(&cParm); 165 258 } 166 259 else ReturnBuffers();
Note:
See TracChangeset
for help on using the changeset viewer.