Lines Matching refs:pSMFData
59 static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSM…
60 static EAS_RESULT SMF_ParseSysEx (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr…
61 static EAS_RESULT SMF_ParseEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr…
63 static void SMF_UpdateTime (S_SMF_DATA *pSMFData, EAS_U32 ticks);
114 S_SMF_DATA* pSMFData; in SMF_CheckFileType() local
148 pSMFData = EAS_CMEnumData(EAS_CM_SMF_DATA); in SMF_CheckFileType()
151 pSMFData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_SMF_DATA)); in SMF_CheckFileType()
152 EAS_HWMemSet((void *)pSMFData,0, sizeof(S_SMF_DATA)); in SMF_CheckFileType()
154 if (!pSMFData) in SMF_CheckFileType()
158 pSMFData->fileHandle = fileHandle; in SMF_CheckFileType()
159 pSMFData->fileOffset = offset; in SMF_CheckFileType()
160 pSMFData->pSynth = NULL; in SMF_CheckFileType()
161 pSMFData->time = 0; in SMF_CheckFileType()
162 pSMFData->state = EAS_STATE_OPEN; in SMF_CheckFileType()
163 *ppHandle = pSMFData; in SMF_CheckFileType()
188 S_SMF_DATA* pSMFData; in SMF_Prepare() local
192 pSMFData = (S_SMF_DATA *) pInstData; in SMF_Prepare()
193 if (pSMFData->state != EAS_STATE_OPEN) in SMF_Prepare()
197 if ((result = VMInitMIDI(pEASData, &pSMFData->pSynth)) != EAS_SUCCESS) in SMF_Prepare()
204 if ((result = SMF_ParseHeader(pEASData->hwInstData, pSMFData)) != EAS_SUCCESS) in SMF_Prepare()
208 pSMFData->state = EAS_STATE_READY; in SMF_Prepare()
233 S_SMF_DATA *pSMFData; in SMF_Time() local
235 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Time()
239 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Time()
244 if (pSMFData->nextStream == NULL) in SMF_Time()
253 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_Time()
260 *pTime = pSMFData->time >> 8; in SMF_Time()
262 *pTime = pSMFData->time >> 8; in SMF_Time()
285 S_SMF_DATA* pSMFData; in SMF_Event() local
292 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Event()
293 if (pSMFData->state >= EAS_STATE_OPEN) in SMF_Event()
296 if (!pSMFData->nextStream) { in SMF_Event()
302 ticks = pSMFData->nextStream->ticks; in SMF_Event()
305 pSMFData->state = EAS_STATE_ERROR; in SMF_Event()
309 if (pSMFData->nextStream->midiStream.jetData & MIDI_FLAGS_JET_MUTE) in SMF_Event()
314 …if ((result = SMF_ParseEvent(pEASData, pSMFData, pSMFData->nextStream, parserMode)) != EAS_SUCCESS) in SMF_Event()
321 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
325 else if (pSMFData->nextStream->ticks != SMF_END_OF_TRACK) in SMF_Event()
327 if ((result = SMF_GetDeltaTime(pEASData->hwInstData, pSMFData->nextStream)) != EAS_SUCCESS) in SMF_Event()
334 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
338 else if (pSMFData->nextStream->ticks == ticks) in SMF_Event()
340 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
347 pSMFData->nextStream = NULL; in SMF_Event()
348 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Event()
350 if (pSMFData->streams[i].ticks < temp) in SMF_Event()
352 temp = pSMFData->streams[i].ticks; in SMF_Event()
353 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Event()
358 if (pSMFData->nextStream) in SMF_Event()
360 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
363 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks - ticks); in SMF_Event()
367 pSMFData->state = EAS_STATE_STOPPING; in SMF_Event()
368 VMReleaseAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Event()
395 S_SMF_DATA* pSMFData; in SMF_State() local
398 pSMFData = (S_SMF_DATA*) pInstData; in SMF_State()
401 if (pSMFData->state == EAS_STATE_STOPPING) in SMF_State()
403 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
404 pSMFData->state = EAS_STATE_STOPPED; in SMF_State()
407 if (pSMFData->state == EAS_STATE_PAUSING) in SMF_State()
409 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
410 pSMFData->state = EAS_STATE_PAUSED; in SMF_State()
414 *pState = pSMFData->state; in SMF_State()
437 S_SMF_DATA* pSMFData; in SMF_Close() local
441 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Close()
444 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Close()
446 if (pSMFData->streams[i].fileHandle != NULL) in SMF_Close()
448 …if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->streams[i].fileHandle)) != EAS_SUCCE… in SMF_Close()
452 if (pSMFData->fileHandle != NULL) in SMF_Close()
453 if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->fileHandle)) != EAS_SUCCESS) in SMF_Close()
457 if (pSMFData->pSynth != NULL) in SMF_Close()
458 VMMIDIShutdown(pEASData, pSMFData->pSynth); in SMF_Close()
463 if (pSMFData->streams) in SMF_Close()
464 EAS_HWFree(pEASData->hwInstData, pSMFData->streams); in SMF_Close()
467 EAS_HWFree(pEASData->hwInstData, pSMFData); in SMF_Close()
492 S_SMF_DATA* pSMFData; in SMF_Reset() local
497 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Reset()
500 pSMFData->time = 0; in SMF_Reset()
503 VMReset(pEASData->pVoiceMgr, pSMFData->pSynth, EAS_TRUE); in SMF_Reset()
507 pSMFData->nextStream = NULL; in SMF_Reset()
508 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Reset()
512 …if ((result = EAS_HWFileSeek(pEASData->hwInstData, pSMFData->streams[i].fileHandle, pSMFData->stre… in SMF_Reset()
516 pSMFData->streams[i].ticks = 0; in SMF_Reset()
519 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_Reset()
522 if ((result = SMF_GetDeltaTime(pEASData->hwInstData,&pSMFData->streams[i])) != EAS_SUCCESS) in SMF_Reset()
524 if (pSMFData->streams[i].ticks < ticks) in SMF_Reset()
526 ticks = pSMFData->streams[i].ticks; in SMF_Reset()
527 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Reset()
532 pSMFData->state = EAS_STATE_READY; in SMF_Reset()
556 S_SMF_DATA *pSMFData; in SMF_Pause() local
559 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Pause()
560 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Pause()
564 VMMuteAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Pause()
565 pSMFData->state = EAS_STATE_PAUSING; in SMF_Pause()
589 S_SMF_DATA *pSMFData; in SMF_Resume() local
592 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Resume()
593 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Resume()
597 pSMFData->state = EAS_STATE_PLAY; in SMF_Resume()
622 S_SMF_DATA *pSMFData; in SMF_SetData() local
624 pSMFData = (S_SMF_DATA*) pInstData; in SMF_SetData()
630 EAS_HWMemCpy(&pSMFData->metadata, (void*) value, sizeof(S_METADATA_CB)); in SMF_SetData()
640 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
641 pSMFData->streams[i].midiStream.jetData = in SMF_SetData()
642 (pSMFData->streams[i].midiStream.jetData & in SMF_SetData()
645 pSMFData->flags |= SMF_FLAGS_JET_STREAM; in SMF_SetData()
654 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
657 pSMFData->streams[i].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
659 pSMFData->streams[i].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
667 if (value < pSMFData->numStreams) in SMF_SetData()
668 pSMFData->streams[value].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
675 if (value < pSMFData->numStreams) in SMF_SetData()
676 pSMFData->streams[value].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
709 S_SMF_DATA *pSMFData; in SMF_GetData() local
711 pSMFData = (S_SMF_DATA*) pInstData; in SMF_GetData()
716 if (pSMFData->numStreams == 1) in SMF_GetData()
725 if (pSMFData->pSynth) in SMF_GetData()
726 VMGetPolyphony(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
732 if (pSMFData->pSynth) in SMF_GetData()
733 VMGetPriority(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
738 *pValue = pSMFData->transposition; in SMF_GetData()
743 *pValue = (EAS_I32) pSMFData->pSynth; in SMF_GetData()
835 static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSM… in SMF_ParseMetaEvent() argument
895 pSMFData->ppqn == 0 || in SMF_ParseMetaEvent()
896 (temp64 /= pSMFData->ppqn, false) || in SMF_ParseMetaEvent()
900 pSMFData->tickConv = 65535; in SMF_ParseMetaEvent()
902 pSMFData->tickConv = (EAS_U16) temp64; in SMF_ParseMetaEvent()
905 pSMFData->flags |= SMF_FLAGS_HAS_TEMPO; in SMF_ParseMetaEvent()
911 pSMFData->flags |= SMF_FLAGS_HAS_TIME_SIG; in SMF_ParseMetaEvent()
915 else if (pSMFData->metadata.callback) in SMF_ParseMetaEvent()
934 readLen = pSMFData->metadata.bufferSize - 1; in SMF_ParseMetaEvent()
937 …if ((result = EAS_HWReadFile(pEASData->hwInstData, pSMFStream->fileHandle, pSMFData->metadata.buff… in SMF_ParseMetaEvent()
939 pSMFData->metadata.buffer[readLen] = 0; in SMF_ParseMetaEvent()
940 … pSMFData->metadata.callback(metaType, pSMFData->metadata.buffer, pSMFData->metadata.pUserData); in SMF_ParseMetaEvent()
968 static EAS_RESULT SMF_ParseSysEx (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseSysEx() argument
981 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, f0, parserM… in SMF_ParseSysEx()
991 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseSysEx()
996 pSMFData->flags |= SMF_FLAGS_HAS_GM_ON; in SMF_ParseSysEx()
1018 static EAS_RESULT SMF_ParseEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseEvent() argument
1030 if ((result = SMF_ParseMetaEvent(pEASData, pSMFData, pSMFStream)) != EAS_SUCCESS) in SMF_ParseEvent()
1037 if ((result = SMF_ParseSysEx(pEASData, pSMFData, pSMFStream, c, parserMode)) != EAS_SUCCESS) in SMF_ParseEvent()
1044 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1052 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1059 if (pSMFData->time == 0) in SMF_ParseEvent()
1061 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_ParseEvent()
1064 pSMFData->flags &= ~SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1066 else if ((pSMFData->flags & SMF_FLAGS_SETUP_BAR) == SMF_FLAGS_SETUP_BAR) in SMF_ParseEvent()
1067 pSMFData->flags = (pSMFData->flags & ~SMF_FLAGS_SETUP_BAR) | SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1095 EAS_RESULT SMF_ParseHeader (EAS_HW_DATA_HANDLE hwInstData, S_SMF_DATA *pSMFData) in SMF_ParseHeader() argument
1108 pSMFData->numStreams = 0; in SMF_ParseHeader()
1111 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_HEAD… in SMF_ParseHeader()
1113 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1117 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_NUM_… in SMF_ParseHeader()
1119 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &numStreams, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1134 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &division, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1138 pSMFData->ppqn = 192; in SMF_ParseHeader()
1142 pSMFData->ppqn = (division & 0x7fff); in SMF_ParseHeader()
1143 pSMFData->tickConv = (EAS_U16) (((SMF_DEFAULT_TIMEBASE * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseHeader()
1146 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1148 pSMFData->streams = EAS_HWMalloc(hwInstData,sizeof(S_SMF_STREAM) * numStreams); in SMF_ParseHeader()
1149 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1153 EAS_HWMemSet((void *)(pSMFData->streams), 0, sizeof(S_SMF_STREAM) * numStreams); in SMF_ParseHeader()
1155 pSMFData->numStreams = numStreams; in SMF_ParseHeader()
1158 chunkStart = (EAS_U32) pSMFData->fileOffset; in SMF_ParseHeader()
1160 pSMFData->nextStream = NULL; in SMF_ParseHeader()
1161 for (i = 0; i < pSMFData->numStreams; i++) in SMF_ParseHeader()
1177 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, (EAS_I32) chunkStart)) != EAS_SUCCE… in SMF_ParseHeader()
1181 … if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &temp, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1185 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1196 pSMFData->streams[i].ticks = 0; in SMF_ParseHeader()
1197 pSMFData->streams[i].fileHandle = pSMFData->fileHandle; in SMF_ParseHeader()
1200 pSMFData->fileHandle = NULL; in SMF_ParseHeader()
1203 pSMFData->streams[i].startFilePos = (EAS_I32) chunkStart + SMF_CHUNK_INFO_SIZE; in SMF_ParseHeader()
1206 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_ParseHeader()
1209 if ((result = SMF_GetDeltaTime(hwInstData, &pSMFData->streams[i])) != EAS_SUCCESS) in SMF_ParseHeader()
1212 if (pSMFData->streams[i].ticks < ticks) in SMF_ParseHeader()
1214 ticks = pSMFData->streams[i].ticks; in SMF_ParseHeader()
1215 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_ParseHeader()
1219 if (i < (pSMFData->numStreams - 1)) in SMF_ParseHeader()
1221 …if ((result = EAS_HWDupHandle(hwInstData, pSMFData->streams[i].fileHandle, &pSMFData->fileHandle))… in SMF_ParseHeader()
1227 if (pSMFData->nextStream) in SMF_ParseHeader()
1228 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks); in SMF_ParseHeader()
1255 static void SMF_UpdateTime (S_SMF_DATA *pSMFData, EAS_U32 ticks) in SMF_UpdateTime() argument
1259 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_UpdateTime()
1262 temp1 = (ticks >> 10) * pSMFData->tickConv; in SMF_UpdateTime()
1263 temp2 = (ticks & 0x3ff) * pSMFData->tickConv; in SMF_UpdateTime()
1264 pSMFData->time += (EAS_I32)((temp1 << 8) + (temp2 >> 2)); in SMF_UpdateTime()