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);
109 S_SMF_DATA* pSMFData; in SMF_CheckFileType() local
140 pSMFData = EAS_CMEnumData(EAS_CM_SMF_DATA); in SMF_CheckFileType()
143 pSMFData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_SMF_DATA)); in SMF_CheckFileType()
144 EAS_HWMemSet((void *)pSMFData,0, sizeof(S_SMF_DATA)); in SMF_CheckFileType()
146 if (!pSMFData) in SMF_CheckFileType()
150 pSMFData->fileHandle = fileHandle; in SMF_CheckFileType()
151 pSMFData->fileOffset = offset; in SMF_CheckFileType()
152 pSMFData->pSynth = NULL; in SMF_CheckFileType()
153 pSMFData->time = 0; in SMF_CheckFileType()
154 pSMFData->state = EAS_STATE_OPEN; in SMF_CheckFileType()
155 *ppHandle = pSMFData; in SMF_CheckFileType()
180 S_SMF_DATA* pSMFData; in SMF_Prepare() local
184 pSMFData = (S_SMF_DATA *) pInstData; in SMF_Prepare()
185 if (pSMFData->state != EAS_STATE_OPEN) in SMF_Prepare()
189 if ((result = VMInitMIDI(pEASData, &pSMFData->pSynth)) != EAS_SUCCESS) in SMF_Prepare()
196 if ((result = SMF_ParseHeader(pEASData->hwInstData, pSMFData)) != EAS_SUCCESS) in SMF_Prepare()
200 pSMFData->state = EAS_STATE_READY; in SMF_Prepare()
225 S_SMF_DATA *pSMFData; in SMF_Time() local
227 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Time()
231 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Time()
236 if (pSMFData->nextStream == NULL) in SMF_Time()
245 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_Time()
252 *pTime = pSMFData->time >> 8; in SMF_Time()
254 *pTime = pSMFData->time >> 8; in SMF_Time()
277 S_SMF_DATA* pSMFData; in SMF_Event() local
284 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Event()
285 if (pSMFData->state >= EAS_STATE_OPEN) in SMF_Event()
288 if (!pSMFData->nextStream) { in SMF_Event()
294 ticks = pSMFData->nextStream->ticks; in SMF_Event()
297 pSMFData->state = EAS_STATE_ERROR; in SMF_Event()
301 if (pSMFData->nextStream->midiStream.jetData & MIDI_FLAGS_JET_MUTE) in SMF_Event()
306 …if ((result = SMF_ParseEvent(pEASData, pSMFData, pSMFData->nextStream, parserMode)) != EAS_SUCCESS) in SMF_Event()
313 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
317 else if (pSMFData->nextStream->ticks != SMF_END_OF_TRACK) in SMF_Event()
319 if ((result = SMF_GetDeltaTime(pEASData->hwInstData, pSMFData->nextStream)) != EAS_SUCCESS) in SMF_Event()
326 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
330 else if (pSMFData->nextStream->ticks == ticks) in SMF_Event()
332 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
339 pSMFData->nextStream = NULL; in SMF_Event()
340 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Event()
342 if (pSMFData->streams[i].ticks < temp) in SMF_Event()
344 temp = pSMFData->streams[i].ticks; in SMF_Event()
345 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Event()
350 if (pSMFData->nextStream) in SMF_Event()
352 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
355 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks - ticks); in SMF_Event()
359 pSMFData->state = EAS_STATE_STOPPING; in SMF_Event()
360 VMReleaseAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Event()
387 S_SMF_DATA* pSMFData; in SMF_State() local
390 pSMFData = (S_SMF_DATA*) pInstData; in SMF_State()
393 if (pSMFData->state == EAS_STATE_STOPPING) in SMF_State()
395 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
396 pSMFData->state = EAS_STATE_STOPPED; in SMF_State()
399 if (pSMFData->state == EAS_STATE_PAUSING) in SMF_State()
401 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
402 pSMFData->state = EAS_STATE_PAUSED; in SMF_State()
406 *pState = pSMFData->state; in SMF_State()
429 S_SMF_DATA* pSMFData; in SMF_Close() local
433 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Close()
436 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Close()
438 if (pSMFData->streams[i].fileHandle != NULL) in SMF_Close()
440 …if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->streams[i].fileHandle)) != EAS_SUCCE… in SMF_Close()
444 if (pSMFData->fileHandle != NULL) in SMF_Close()
445 if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->fileHandle)) != EAS_SUCCESS) in SMF_Close()
449 if (pSMFData->pSynth != NULL) in SMF_Close()
450 VMMIDIShutdown(pEASData, pSMFData->pSynth); in SMF_Close()
455 if (pSMFData->streams) in SMF_Close()
456 EAS_HWFree(pEASData->hwInstData, pSMFData->streams); in SMF_Close()
459 EAS_HWFree(pEASData->hwInstData, pSMFData); in SMF_Close()
484 S_SMF_DATA* pSMFData; in SMF_Reset() local
489 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Reset()
492 pSMFData->time = 0; in SMF_Reset()
495 VMReset(pEASData->pVoiceMgr, pSMFData->pSynth, EAS_TRUE); in SMF_Reset()
499 pSMFData->nextStream = NULL; in SMF_Reset()
500 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Reset()
504 …if ((result = EAS_HWFileSeek(pEASData->hwInstData, pSMFData->streams[i].fileHandle, pSMFData->stre… in SMF_Reset()
508 pSMFData->streams[i].ticks = 0; in SMF_Reset()
511 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_Reset()
514 if ((result = SMF_GetDeltaTime(pEASData->hwInstData,&pSMFData->streams[i])) != EAS_SUCCESS) in SMF_Reset()
516 if (pSMFData->streams[i].ticks < ticks) in SMF_Reset()
518 ticks = pSMFData->streams[i].ticks; in SMF_Reset()
519 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Reset()
524 pSMFData->state = EAS_STATE_READY; in SMF_Reset()
547 S_SMF_DATA *pSMFData; in SMF_Pause() local
550 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Pause()
551 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Pause()
555 VMMuteAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Pause()
556 pSMFData->state = EAS_STATE_PAUSING; in SMF_Pause()
580 S_SMF_DATA *pSMFData; in SMF_Resume() local
583 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Resume()
584 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Resume()
588 pSMFData->state = EAS_STATE_PLAY; in SMF_Resume()
612 S_SMF_DATA *pSMFData; in SMF_SetData() local
614 pSMFData = (S_SMF_DATA*) pInstData; in SMF_SetData()
620 EAS_HWMemCpy(&pSMFData->metadata, (void*) value, sizeof(S_METADATA_CB)); in SMF_SetData()
630 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
631 pSMFData->streams[i].midiStream.jetData = in SMF_SetData()
632 (pSMFData->streams[i].midiStream.jetData & in SMF_SetData()
635 pSMFData->flags |= SMF_FLAGS_JET_STREAM; in SMF_SetData()
644 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
647 pSMFData->streams[i].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
649 pSMFData->streams[i].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
657 if (value < pSMFData->numStreams) in SMF_SetData()
658 pSMFData->streams[value].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
665 if (value < pSMFData->numStreams) in SMF_SetData()
666 pSMFData->streams[value].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
699 S_SMF_DATA *pSMFData; in SMF_GetData() local
701 pSMFData = (S_SMF_DATA*) pInstData; in SMF_GetData()
706 if (pSMFData->numStreams == 1) in SMF_GetData()
715 if (pSMFData->pSynth) in SMF_GetData()
716 VMGetPolyphony(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
722 if (pSMFData->pSynth) in SMF_GetData()
723 VMGetPriority(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
728 *pValue = pSMFData->transposition; in SMF_GetData()
733 *pValue = (EAS_I32) pSMFData->pSynth; in SMF_GetData()
821 static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSM… in SMF_ParseMetaEvent() argument
877 pSMFData->tickConv = (EAS_U16) (((temp * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseMetaEvent()
878 pSMFData->flags |= SMF_FLAGS_HAS_TEMPO; in SMF_ParseMetaEvent()
884 pSMFData->flags |= SMF_FLAGS_HAS_TIME_SIG; in SMF_ParseMetaEvent()
888 else if (pSMFData->metadata.callback) in SMF_ParseMetaEvent()
907 readLen = pSMFData->metadata.bufferSize - 1; in SMF_ParseMetaEvent()
910 …if ((result = EAS_HWReadFile(pEASData->hwInstData, pSMFStream->fileHandle, pSMFData->metadata.buff… in SMF_ParseMetaEvent()
912 pSMFData->metadata.buffer[readLen] = 0; in SMF_ParseMetaEvent()
913 … pSMFData->metadata.callback(metaType, pSMFData->metadata.buffer, pSMFData->metadata.pUserData); in SMF_ParseMetaEvent()
941 static EAS_RESULT SMF_ParseSysEx (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseSysEx() argument
954 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, f0, parserM… in SMF_ParseSysEx()
963 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseSysEx()
968 pSMFData->flags |= SMF_FLAGS_HAS_GM_ON; in SMF_ParseSysEx()
990 static EAS_RESULT SMF_ParseEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseEvent() argument
1002 if ((result = SMF_ParseMetaEvent(pEASData, pSMFData, pSMFStream)) != EAS_SUCCESS) in SMF_ParseEvent()
1009 if ((result = SMF_ParseSysEx(pEASData, pSMFData, pSMFStream, c, parserMode)) != EAS_SUCCESS) in SMF_ParseEvent()
1016 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1024 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1031 if (pSMFData->time == 0) in SMF_ParseEvent()
1033 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_ParseEvent()
1036 pSMFData->flags &= ~SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1038 else if ((pSMFData->flags & SMF_FLAGS_SETUP_BAR) == SMF_FLAGS_SETUP_BAR) in SMF_ParseEvent()
1039 pSMFData->flags = (pSMFData->flags & ~SMF_FLAGS_SETUP_BAR) | SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1067 EAS_RESULT SMF_ParseHeader (EAS_HW_DATA_HANDLE hwInstData, S_SMF_DATA *pSMFData) in SMF_ParseHeader() argument
1080 pSMFData->numStreams = 0; in SMF_ParseHeader()
1083 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_HEAD… in SMF_ParseHeader()
1085 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1089 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_NUM_… in SMF_ParseHeader()
1091 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &numStreams, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1106 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &division, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1110 pSMFData->ppqn = 192; in SMF_ParseHeader()
1114 pSMFData->ppqn = (division & 0x7fff); in SMF_ParseHeader()
1115 pSMFData->tickConv = (EAS_U16) (((SMF_DEFAULT_TIMEBASE * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseHeader()
1118 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1120 pSMFData->streams = EAS_HWMalloc(hwInstData,sizeof(S_SMF_STREAM) * numStreams); in SMF_ParseHeader()
1121 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1125 EAS_HWMemSet((void *)(pSMFData->streams), 0, sizeof(S_SMF_STREAM) * numStreams); in SMF_ParseHeader()
1127 pSMFData->numStreams = numStreams; in SMF_ParseHeader()
1130 chunkStart = (EAS_U32) pSMFData->fileOffset; in SMF_ParseHeader()
1132 pSMFData->nextStream = NULL; in SMF_ParseHeader()
1133 for (i = 0; i < pSMFData->numStreams; i++) in SMF_ParseHeader()
1149 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, (EAS_I32) chunkStart)) != EAS_SUCCE… in SMF_ParseHeader()
1153 … if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &temp, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1157 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1168 pSMFData->streams[i].ticks = 0; in SMF_ParseHeader()
1169 pSMFData->streams[i].fileHandle = pSMFData->fileHandle; in SMF_ParseHeader()
1172 pSMFData->fileHandle = NULL; in SMF_ParseHeader()
1175 pSMFData->streams[i].startFilePos = (EAS_I32) chunkStart + SMF_CHUNK_INFO_SIZE; in SMF_ParseHeader()
1178 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_ParseHeader()
1181 if ((result = SMF_GetDeltaTime(hwInstData, &pSMFData->streams[i])) != EAS_SUCCESS) in SMF_ParseHeader()
1184 if (pSMFData->streams[i].ticks < ticks) in SMF_ParseHeader()
1186 ticks = pSMFData->streams[i].ticks; in SMF_ParseHeader()
1187 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_ParseHeader()
1191 if (i < (pSMFData->numStreams - 1)) in SMF_ParseHeader()
1193 …if ((result = EAS_HWDupHandle(hwInstData, pSMFData->streams[i].fileHandle, &pSMFData->fileHandle))… in SMF_ParseHeader()
1199 if (pSMFData->nextStream) in SMF_ParseHeader()
1200 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks); in SMF_ParseHeader()
1227 static void SMF_UpdateTime (S_SMF_DATA *pSMFData, EAS_U32 ticks) in SMF_UpdateTime() argument
1231 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_UpdateTime()
1234 temp1 = (ticks >> 10) * pSMFData->tickConv; in SMF_UpdateTime()
1235 temp2 = (ticks & 0x3ff) * pSMFData->tickConv; in SMF_UpdateTime()
1236 pSMFData->time += (EAS_I32)((temp1 << 8) + (temp2 >> 2)); in SMF_UpdateTime()