Lines Matching refs:strm

70 static BOOL ReadWaveFormat(StreamInfo * strm);
71 static void ReadStrmData(StreamInfo * strm);
75 static void PlayStream(StreamInfo * strm, const char *filename);
76 static void StopStream(StreamInfo * strm);
93 static StreamInfo strm; variable
114 FS_InitFile(&strm.file); in NitroMain()
115 strm.isPlay = FALSE; in NitroMain()
161 PlayStream(&strm, filename1); in NitroMain()
166 PlayStream(&strm, filename2); in NitroMain()
171 StopStream(&strm); in NitroMain()
189 static void PlayStream(StreamInfo * strm, const char *filename) in PlayStream() argument
195 if (strm->isPlay) in PlayStream()
198 StopStream(strm); in PlayStream()
205 if (FS_IsFile(&strm->file)) in PlayStream()
206 (void)FS_CloseFile(&strm->file); in PlayStream()
207 if (!FS_OpenFileEx(&strm->file, filename, FS_FILEMODE_R)) in PlayStream()
211 if (!ReadWaveFormat(strm)) in PlayStream()
216 strm->isPlay = TRUE; in PlayStream()
219 timerValue = SND_TIMER_CLOCK / strm->format.sampleRate; in PlayStream()
221 alarmPeriod /= (strm->format.bitPerSample == 16) ? sizeof(s16) : sizeof(s8); in PlayStream()
224 (void)FS_SeekFile(&strm->file, (s32)strm->beginPos, FS_SEEK_SET); in PlayStream()
225 strm->bufPage = 0; in PlayStream()
226 ReadStrmData(strm); in PlayStream()
227 ReadStrmData(strm); in PlayStream()
231 (strm->format.bitPerSample == in PlayStream()
236 (strm->format.bitPerSample == in PlayStream()
238 (strm->format.channels == 1) ? strm_lbuf : strm_rbuf, in PlayStream()
241 SND_SetupAlarm(ALARM_NUM, alarmPeriod, alarmPeriod, SoundAlarmHandler, strm); in PlayStream()
254 static void StopStream(StreamInfo * strm) in StopStream() argument
257 if (FS_IsFile(&strm->file)) in StopStream()
258 (void)FS_CloseFile(&strm->file); in StopStream()
259 strm->isPlay = FALSE; in StopStream()
308 static void ReadStrmData(StreamInfo * strm) in ReadStrmData() argument
315 if (strm->dataSize <= 0) in ReadStrmData()
317 StopStream(strm); in ReadStrmData()
322 if (strm->bufPage == 0) in ReadStrmData()
326 strm->bufPage = 1; in ReadStrmData()
332 strm->bufPage = 0; in ReadStrmData()
336 if (strm->format.channels == 1) in ReadStrmData()
339 readSize = FS_ReadFile(&strm->file, in ReadStrmData()
341 (strm->dataSize < in ReadStrmData()
342 STRM_BUF_PAGESIZE) ? strm->dataSize : STRM_BUF_PAGESIZE); in ReadStrmData()
346 if (strm->format.bitPerSample == 16) in ReadStrmData()
374 readSize = FS_ReadFile(&strm->file, in ReadStrmData()
376 (strm->dataSize < in ReadStrmData()
377 STRM_BUF_PAGESIZE * 2) ? strm->dataSize : STRM_BUF_PAGESIZE * 2); in ReadStrmData()
381 if (strm->format.bitPerSample == 16) in ReadStrmData()
411 strm->dataSize -= readSize; in ReadStrmData()
426 static BOOL ReadWaveFormat(StreamInfo * strm) in ReadWaveFormat() argument
432 (void)FS_SeekFileToBegin(&strm->file); in ReadWaveFormat()
434 (void)FS_ReadFile(&strm->file, &tag, 4); in ReadWaveFormat()
438 (void)FS_ReadFile(&strm->file, &size, 4); in ReadWaveFormat()
440 (void)FS_ReadFile(&strm->file, &tag, 4); in ReadWaveFormat()
447 if (FS_ReadFile(&strm->file, &tag, 4) == -1) in ReadWaveFormat()
451 if (FS_ReadFile(&strm->file, &chunkSize, 4) == -1) in ReadWaveFormat()
459 if (FS_ReadFile(&strm->file, (u8 *)&strm->format, chunkSize) == -1) in ReadWaveFormat()
466 strm->beginPos = FS_GetFilePosition(&strm->file); in ReadWaveFormat()
467 strm->dataSize = chunkSize; in ReadWaveFormat()
468 (void)FS_SeekFile(&strm->file, chunkSize, FS_SEEK_CUR); in ReadWaveFormat()
472 (void)FS_SeekFile(&strm->file, chunkSize, FS_SEEK_CUR); in ReadWaveFormat()