Lines Matching refs:pSMFData
56 static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSM…
57 static EAS_RESULT SMF_ParseSysEx (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr…
58 static EAS_RESULT SMF_ParseEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr…
60 static void SMF_UpdateTime (S_SMF_DATA *pSMFData, EAS_U32 ticks);
106 S_SMF_DATA* pSMFData; in SMF_CheckFileType() local
136 pSMFData = EAS_CMEnumData(EAS_CM_SMF_DATA); in SMF_CheckFileType()
139 pSMFData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_SMF_DATA)); in SMF_CheckFileType()
140 EAS_HWMemSet((void *)pSMFData,0, sizeof(S_SMF_DATA)); in SMF_CheckFileType()
142 if (!pSMFData) in SMF_CheckFileType()
146 pSMFData->fileHandle = fileHandle; in SMF_CheckFileType()
147 pSMFData->fileOffset = offset; in SMF_CheckFileType()
148 pSMFData->pSynth = NULL; in SMF_CheckFileType()
149 pSMFData->time = 0; in SMF_CheckFileType()
150 pSMFData->state = EAS_STATE_OPEN; in SMF_CheckFileType()
151 *ppHandle = pSMFData; in SMF_CheckFileType()
176 S_SMF_DATA* pSMFData; in SMF_Prepare() local
180 pSMFData = (S_SMF_DATA *) pInstData; in SMF_Prepare()
181 if (pSMFData->state != EAS_STATE_OPEN) in SMF_Prepare()
185 if ((result = VMInitMIDI(pEASData, &pSMFData->pSynth)) != EAS_SUCCESS) in SMF_Prepare()
192 if ((result = SMF_ParseHeader(pEASData->hwInstData, pSMFData)) != EAS_SUCCESS) in SMF_Prepare()
196 pSMFData->state = EAS_STATE_READY; in SMF_Prepare()
221 S_SMF_DATA *pSMFData; in SMF_Time() local
223 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Time()
227 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Time()
232 if (pSMFData->nextStream == NULL) in SMF_Time()
241 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_Time()
248 *pTime = pSMFData->time >> 8; in SMF_Time()
250 *pTime = pSMFData->time >> 8; in SMF_Time()
273 S_SMF_DATA* pSMFData; in SMF_Event() local
280 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Event()
281 if (pSMFData->state >= EAS_STATE_OPEN) in SMF_Event()
285 ticks = pSMFData->nextStream->ticks; in SMF_Event()
288 pSMFData->state = EAS_STATE_ERROR; in SMF_Event()
292 if (pSMFData->nextStream->midiStream.jetData & MIDI_FLAGS_JET_MUTE) in SMF_Event()
297 …if ((result = SMF_ParseEvent(pEASData, pSMFData, pSMFData->nextStream, parserMode)) != EAS_SUCCESS) in SMF_Event()
304 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
308 else if (pSMFData->nextStream->ticks != SMF_END_OF_TRACK) in SMF_Event()
310 if ((result = SMF_GetDeltaTime(pEASData->hwInstData, pSMFData->nextStream)) != EAS_SUCCESS) in SMF_Event()
317 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
321 else if (pSMFData->nextStream->ticks == ticks) in SMF_Event()
323 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
330 pSMFData->nextStream = NULL; in SMF_Event()
331 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Event()
333 if (pSMFData->streams[i].ticks < temp) in SMF_Event()
335 temp = pSMFData->streams[i].ticks; in SMF_Event()
336 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Event()
341 if (pSMFData->nextStream) in SMF_Event()
343 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
346 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks - ticks); in SMF_Event()
350 pSMFData->state = EAS_STATE_STOPPING; in SMF_Event()
351 VMReleaseAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Event()
378 S_SMF_DATA* pSMFData; in SMF_State() local
381 pSMFData = (S_SMF_DATA*) pInstData; in SMF_State()
384 if (pSMFData->state == EAS_STATE_STOPPING) in SMF_State()
386 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
387 pSMFData->state = EAS_STATE_STOPPED; in SMF_State()
390 if (pSMFData->state == EAS_STATE_PAUSING) in SMF_State()
392 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
393 pSMFData->state = EAS_STATE_PAUSED; in SMF_State()
397 *pState = pSMFData->state; in SMF_State()
420 S_SMF_DATA* pSMFData; in SMF_Close() local
424 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Close()
427 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Close()
429 if (pSMFData->streams[i].fileHandle != NULL) in SMF_Close()
431 …if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->streams[i].fileHandle)) != EAS_SUCCE… in SMF_Close()
435 if (pSMFData->fileHandle != NULL) in SMF_Close()
436 if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->fileHandle)) != EAS_SUCCESS) in SMF_Close()
440 if (pSMFData->pSynth != NULL) in SMF_Close()
441 VMMIDIShutdown(pEASData, pSMFData->pSynth); in SMF_Close()
446 if (pSMFData->streams) in SMF_Close()
447 EAS_HWFree(pEASData->hwInstData, pSMFData->streams); in SMF_Close()
450 EAS_HWFree(pEASData->hwInstData, pSMFData); in SMF_Close()
475 S_SMF_DATA* pSMFData; in SMF_Reset() local
480 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Reset()
483 pSMFData->time = 0; in SMF_Reset()
486 VMReset(pEASData->pVoiceMgr, pSMFData->pSynth, EAS_TRUE); in SMF_Reset()
490 pSMFData->nextStream = NULL; in SMF_Reset()
491 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Reset()
495 …if ((result = EAS_HWFileSeek(pEASData->hwInstData, pSMFData->streams[i].fileHandle, pSMFData->stre… in SMF_Reset()
499 pSMFData->streams[i].ticks = 0; in SMF_Reset()
502 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_Reset()
505 if ((result = SMF_GetDeltaTime(pEASData->hwInstData,&pSMFData->streams[i])) != EAS_SUCCESS) in SMF_Reset()
507 if (pSMFData->streams[i].ticks < ticks) in SMF_Reset()
509 ticks = pSMFData->streams[i].ticks; in SMF_Reset()
510 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Reset()
515 pSMFData->state = EAS_STATE_READY; in SMF_Reset()
538 S_SMF_DATA *pSMFData; in SMF_Pause() local
541 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Pause()
542 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Pause()
546 VMMuteAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Pause()
547 pSMFData->state = EAS_STATE_PAUSING; in SMF_Pause()
571 S_SMF_DATA *pSMFData; in SMF_Resume() local
574 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Resume()
575 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Resume()
579 pSMFData->state = EAS_STATE_PLAY; in SMF_Resume()
603 S_SMF_DATA *pSMFData; in SMF_SetData() local
605 pSMFData = (S_SMF_DATA*) pInstData; in SMF_SetData()
611 EAS_HWMemCpy(&pSMFData->metadata, (void*) value, sizeof(S_METADATA_CB)); in SMF_SetData()
621 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
622 pSMFData->streams[i].midiStream.jetData = in SMF_SetData()
623 (pSMFData->streams[i].midiStream.jetData & in SMF_SetData()
626 pSMFData->flags |= SMF_FLAGS_JET_STREAM; in SMF_SetData()
635 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
638 pSMFData->streams[i].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
640 pSMFData->streams[i].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
648 if (value < pSMFData->numStreams) in SMF_SetData()
649 pSMFData->streams[value].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
656 if (value < pSMFData->numStreams) in SMF_SetData()
657 pSMFData->streams[value].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
690 S_SMF_DATA *pSMFData; in SMF_GetData() local
692 pSMFData = (S_SMF_DATA*) pInstData; in SMF_GetData()
697 if (pSMFData->numStreams == 1) in SMF_GetData()
706 if (pSMFData->pSynth) in SMF_GetData()
707 VMGetPolyphony(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
713 if (pSMFData->pSynth) in SMF_GetData()
714 VMGetPriority(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
719 *pValue = pSMFData->transposition; in SMF_GetData()
724 *pValue = (EAS_I32) pSMFData->pSynth; in SMF_GetData()
812 static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSM… in SMF_ParseMetaEvent() argument
852 pSMFData->tickConv = (EAS_U16) (((temp * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseMetaEvent()
853 pSMFData->flags |= SMF_FLAGS_HAS_TEMPO; in SMF_ParseMetaEvent()
859 pSMFData->flags |= SMF_FLAGS_HAS_TIME_SIG; in SMF_ParseMetaEvent()
863 else if (pSMFData->metadata.callback) in SMF_ParseMetaEvent()
882 readLen = pSMFData->metadata.bufferSize - 1; in SMF_ParseMetaEvent()
885 …if ((result = EAS_HWReadFile(pEASData->hwInstData, pSMFStream->fileHandle, pSMFData->metadata.buff… in SMF_ParseMetaEvent()
887 pSMFData->metadata.buffer[readLen] = 0; in SMF_ParseMetaEvent()
888 … pSMFData->metadata.callback(metaType, pSMFData->metadata.buffer, pSMFData->metadata.pUserData); in SMF_ParseMetaEvent()
916 static EAS_RESULT SMF_ParseSysEx (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseSysEx() argument
929 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, f0, parserM… in SMF_ParseSysEx()
938 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseSysEx()
943 pSMFData->flags |= SMF_FLAGS_HAS_GM_ON; in SMF_ParseSysEx()
965 static EAS_RESULT SMF_ParseEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseEvent() argument
977 if ((result = SMF_ParseMetaEvent(pEASData, pSMFData, pSMFStream)) != EAS_SUCCESS) in SMF_ParseEvent()
984 if ((result = SMF_ParseSysEx(pEASData, pSMFData, pSMFStream, c, parserMode)) != EAS_SUCCESS) in SMF_ParseEvent()
991 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
999 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1006 if (pSMFData->time == 0) in SMF_ParseEvent()
1008 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_ParseEvent()
1011 pSMFData->flags &= ~SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1013 else if ((pSMFData->flags & SMF_FLAGS_SETUP_BAR) == SMF_FLAGS_SETUP_BAR) in SMF_ParseEvent()
1014 pSMFData->flags = (pSMFData->flags & ~SMF_FLAGS_SETUP_BAR) | SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1042 EAS_RESULT SMF_ParseHeader (EAS_HW_DATA_HANDLE hwInstData, S_SMF_DATA *pSMFData) in SMF_ParseHeader() argument
1053 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_HEAD… in SMF_ParseHeader()
1055 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1059 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_NUM_… in SMF_ParseHeader()
1061 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &pSMFData->numStreams, EAS_TRUE)) !=… in SMF_ParseHeader()
1065 if (pSMFData->numStreams > MAX_SMF_STREAMS) in SMF_ParseHeader()
1068 pSMFData->numStreams = MAX_SMF_STREAMS; in SMF_ParseHeader()
1072 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &division, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1076 pSMFData->ppqn = 192; in SMF_ParseHeader()
1080 pSMFData->ppqn = (division & 0x7fff); in SMF_ParseHeader()
1081 pSMFData->tickConv = (EAS_U16) (((SMF_DEFAULT_TIMEBASE * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseHeader()
1084 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1086 pSMFData->streams = EAS_HWMalloc(hwInstData,sizeof(S_SMF_STREAM) * pSMFData->numStreams); in SMF_ParseHeader()
1087 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1091 EAS_HWMemSet((void *)(pSMFData->streams), 0, sizeof(S_SMF_STREAM) * pSMFData->numStreams); in SMF_ParseHeader()
1095 chunkStart = (EAS_U32) pSMFData->fileOffset; in SMF_ParseHeader()
1097 pSMFData->nextStream = NULL; in SMF_ParseHeader()
1098 for (i = 0; i < pSMFData->numStreams; i++) in SMF_ParseHeader()
1114 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, (EAS_I32) chunkStart)) != EAS_SUCCE… in SMF_ParseHeader()
1118 … if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &temp, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1122 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1133 pSMFData->streams[i].ticks = 0; in SMF_ParseHeader()
1134 pSMFData->streams[i].fileHandle = pSMFData->fileHandle; in SMF_ParseHeader()
1137 pSMFData->fileHandle = NULL; in SMF_ParseHeader()
1140 pSMFData->streams[i].startFilePos = (EAS_I32) chunkStart + SMF_CHUNK_INFO_SIZE; in SMF_ParseHeader()
1143 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_ParseHeader()
1146 if ((result = SMF_GetDeltaTime(hwInstData, &pSMFData->streams[i])) != EAS_SUCCESS) in SMF_ParseHeader()
1149 if (pSMFData->streams[i].ticks < ticks) in SMF_ParseHeader()
1151 ticks = pSMFData->streams[i].ticks; in SMF_ParseHeader()
1152 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_ParseHeader()
1156 if (i < (pSMFData->numStreams - 1)) in SMF_ParseHeader()
1158 …if ((result = EAS_HWDupHandle(hwInstData, pSMFData->streams[i].fileHandle, &pSMFData->fileHandle))… in SMF_ParseHeader()
1164 if (pSMFData->nextStream) in SMF_ParseHeader()
1165 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks); in SMF_ParseHeader()
1192 static void SMF_UpdateTime (S_SMF_DATA *pSMFData, EAS_U32 ticks) in SMF_UpdateTime() argument
1196 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_UpdateTime()
1199 temp1 = (ticks >> 10) * pSMFData->tickConv; in SMF_UpdateTime()
1200 temp2 = (ticks & 0x3ff) * pSMFData->tickConv; in SMF_UpdateTime()
1201 pSMFData->time += (EAS_I32)((temp1 << 8) + (temp2 >> 2)); in SMF_UpdateTime()