17#pragma function(memcpy)
19#define IX_THREAD_FILE "D:\\Rnd\\Prj\\ix\\Src\\Streamer\\thread.cpp"
99 unsigned int bytesUntilStop;
104 Sleep((bytesUntilStop * 1000U) /
127 unsigned int packagePosition;
128 unsigned int chunkIndex;
130 unsigned int chunksToScan;
131 unsigned int chunkBytes;
132 unsigned int innerOffset;
134 unsigned int copyBytes;
135 unsigned char *readPointer;
137 unsigned int firstPacket;
138 unsigned int endPacket;
139 unsigned int *packet;
141 packageRecord = streamFile->
entry;
151 if (streamFile->
next == 0)
156 streamFile->
next = 0;
170 while (chunksToScan--) {
179 while (endPacket > firstPacket) {
180 pivot = (endPacket + firstPacket) >> 1;
182 if (*packet < packagePosition)
183 firstPacket = pivot + 1;
184 else if (*packet > packagePosition)
212 chunkBytes = chunkBytes - innerOffset;
213 readPointer += innerOffset;
214 if (copyBytes > chunkBytes)
215 copyBytes = chunkBytes;
216 memcpy(streamFile->
destination, readPointer, copyBytes);
224 if (streamFile->
next == 0)
229 streamFile->
next = 0;
247 int bytesUntilRefill;
255 while (streamFile != 0) {
258 bestFile = streamFile;
260 bestFile = streamFile;
262 bestFile = streamFile;
280 if (bytesUntilRefill > 0) {
281 bytesUntilRefill += 0x16f8;
282 return (bytesUntilRefill * 1000U) /
293 unsigned int triggerIndex;
294 unsigned int triggerCount;
300 while (triggerCount--) {
328 unsigned int branchesToCheck;
329 unsigned int candidateBranch;
330 unsigned int bestBranch;
331 unsigned int bestDistance;
332 unsigned int candidateDistance;
345 bestBranch = candidateBranch;
347 while (branchesToCheck--) {
355 if (candidateDistance < bestDistance) {
356 bestDistance = candidateDistance;
357 bestBranch = candidateBranch;
374 unsigned int lockedBytes;
375 unsigned int unreadBytes;
376 unsigned int packageOffset;
377 unsigned char *buffer;
380 if (unreadBytes > 0) {
383 while (unreadBytes > 0) {
393 unreadBytes = unreadBytes - lockedBytes;
394 packageOffset += lockedBytes;
404 unsigned int fileOffset;
void(__cdecl *pIxFree)(void *)
void ix_dsps_prepare(int stream)
void ix_dsps_unlock(int stream)
int ix_dsps_get_buffer_free(int streamIndex)
void ix_dsps_stop(int stream)
void ix_dsps_play(int stream)
void ix_dsps_lock(int stream, unsigned int requestedBytes, unsigned char **buffer, unsigned int *lockedBytes)
unsigned int dwIxStreamerStatus
The library's classes and shared declarations.
unsigned int dwStreamBytesPerSecond
CRITICAL_SECTION csStreamer
void ix_thread_handle_file_chunk(IxStreamFile *streamFile)
unsigned int * pStreamerPacketOffsetTable
unsigned int ix_thread_get_audio_chunk_size(void)
IxStreamFile * pStreamIdleFiles
IxStreamerAudioChunk * pStreamedMusicAudioChunks
void ix_thread_advance_audio_chunk(void)
unsigned int ix_file_read(FILE *file, void *destination, unsigned int bytes)
unsigned int nIxStreamerCurrentFileChunk
void ix_thread_lock_stream_buffer(void)
unsigned int ix_streamer_service_audio(void)
void ix_log_printf(const char *fmt,...)
void ix_file_seek(FILE *file, long position)
long ix_file_tell(FILE *file)
unsigned int dwStreamThreadTick
IxStreamerTrigger * pStreamTriggerList
unsigned char * pIxStreamerInputBuffer
IxStreamerFileChunk * pStreamFileBlocks
unsigned int adwStreamCallStack[32]
DWORD WINAPI ix_streamer_thread_proc(void *parameter)
unsigned char bStreamerIntensityLevel
unsigned int nStreamCallStackIndex
CRITICAL_SECTION csStreamerFileList
unsigned int nStreamerAudioBlock
IxStreamFile * pStreamReadRequests
void ix_lzo1x_decompress(unsigned char *source, unsigned char *destination, unsigned int destinationBytes)
CRITICAL_SECTION csIxStreamerThread
unsigned char * pStreamerLzoBuffer
IxStreamerHeader * pStreamerPackageInfo
IxStreamerBranch * pMusicStreamBranchList
unsigned int ix_thread_service_streams(void)
@ IX_STREAMER_DSP_PLAYING
@ IX_STREAMER_AUDIO_PAUSED
@ IX_STREAMER_AUDIO_PLAYING
@ IX_STREAMER_THREAD_RUNNING
@ IX_STREAMER_REPREPARE_AUDIO
@ IX_STREAMER_END_TRIGGERED
HANDLE hStreamerWakeupEvent
unsigned char * destination
IxStreamerFileEntry * entry
unsigned int triggerCount
unsigned int firstTrigger