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()
284 if (!pSMFData->nextStream) { in SMF_Event()
290 ticks = pSMFData->nextStream->ticks; in SMF_Event()
293 pSMFData->state = EAS_STATE_ERROR; in SMF_Event()
297 if (pSMFData->nextStream->midiStream.jetData & MIDI_FLAGS_JET_MUTE) in SMF_Event()
302 …if ((result = SMF_ParseEvent(pEASData, pSMFData, pSMFData->nextStream, parserMode)) != EAS_SUCCESS) in SMF_Event()
309 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
313 else if (pSMFData->nextStream->ticks != SMF_END_OF_TRACK) in SMF_Event()
315 if ((result = SMF_GetDeltaTime(pEASData->hwInstData, pSMFData->nextStream)) != EAS_SUCCESS) in SMF_Event()
322 pSMFData->nextStream->ticks = SMF_END_OF_TRACK; in SMF_Event()
326 else if (pSMFData->nextStream->ticks == ticks) in SMF_Event()
328 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
335 pSMFData->nextStream = NULL; in SMF_Event()
336 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Event()
338 if (pSMFData->streams[i].ticks < temp) in SMF_Event()
340 temp = pSMFData->streams[i].ticks; in SMF_Event()
341 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Event()
346 if (pSMFData->nextStream) in SMF_Event()
348 pSMFData->state = EAS_STATE_PLAY; in SMF_Event()
351 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks - ticks); in SMF_Event()
355 pSMFData->state = EAS_STATE_STOPPING; in SMF_Event()
356 VMReleaseAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Event()
383 S_SMF_DATA* pSMFData; in SMF_State() local
386 pSMFData = (S_SMF_DATA*) pInstData; in SMF_State()
389 if (pSMFData->state == EAS_STATE_STOPPING) in SMF_State()
391 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
392 pSMFData->state = EAS_STATE_STOPPED; in SMF_State()
395 if (pSMFData->state == EAS_STATE_PAUSING) in SMF_State()
397 if (VMActiveVoices(pSMFData->pSynth) == 0) in SMF_State()
398 pSMFData->state = EAS_STATE_PAUSED; in SMF_State()
402 *pState = pSMFData->state; in SMF_State()
425 S_SMF_DATA* pSMFData; in SMF_Close() local
429 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Close()
432 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Close()
434 if (pSMFData->streams[i].fileHandle != NULL) in SMF_Close()
436 …if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->streams[i].fileHandle)) != EAS_SUCCE… in SMF_Close()
440 if (pSMFData->fileHandle != NULL) in SMF_Close()
441 if ((result = EAS_HWCloseFile(pEASData->hwInstData, pSMFData->fileHandle)) != EAS_SUCCESS) in SMF_Close()
445 if (pSMFData->pSynth != NULL) in SMF_Close()
446 VMMIDIShutdown(pEASData, pSMFData->pSynth); in SMF_Close()
451 if (pSMFData->streams) in SMF_Close()
452 EAS_HWFree(pEASData->hwInstData, pSMFData->streams); in SMF_Close()
455 EAS_HWFree(pEASData->hwInstData, pSMFData); in SMF_Close()
480 S_SMF_DATA* pSMFData; in SMF_Reset() local
485 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Reset()
488 pSMFData->time = 0; in SMF_Reset()
491 VMReset(pEASData->pVoiceMgr, pSMFData->pSynth, EAS_TRUE); in SMF_Reset()
495 pSMFData->nextStream = NULL; in SMF_Reset()
496 for (i = 0; i < pSMFData->numStreams; i++) in SMF_Reset()
500 …if ((result = EAS_HWFileSeek(pEASData->hwInstData, pSMFData->streams[i].fileHandle, pSMFData->stre… in SMF_Reset()
504 pSMFData->streams[i].ticks = 0; in SMF_Reset()
507 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_Reset()
510 if ((result = SMF_GetDeltaTime(pEASData->hwInstData,&pSMFData->streams[i])) != EAS_SUCCESS) in SMF_Reset()
512 if (pSMFData->streams[i].ticks < ticks) in SMF_Reset()
514 ticks = pSMFData->streams[i].ticks; in SMF_Reset()
515 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_Reset()
520 pSMFData->state = EAS_STATE_READY; in SMF_Reset()
543 S_SMF_DATA *pSMFData; in SMF_Pause() local
546 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Pause()
547 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Pause()
551 VMMuteAllVoices(pEASData->pVoiceMgr, pSMFData->pSynth); in SMF_Pause()
552 pSMFData->state = EAS_STATE_PAUSING; in SMF_Pause()
576 S_SMF_DATA *pSMFData; in SMF_Resume() local
579 pSMFData = (S_SMF_DATA*) pInstData; in SMF_Resume()
580 if (pSMFData->state == EAS_STATE_STOPPED) in SMF_Resume()
584 pSMFData->state = EAS_STATE_PLAY; in SMF_Resume()
608 S_SMF_DATA *pSMFData; in SMF_SetData() local
610 pSMFData = (S_SMF_DATA*) pInstData; in SMF_SetData()
616 EAS_HWMemCpy(&pSMFData->metadata, (void*) value, sizeof(S_METADATA_CB)); in SMF_SetData()
626 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
627 pSMFData->streams[i].midiStream.jetData = in SMF_SetData()
628 (pSMFData->streams[i].midiStream.jetData & in SMF_SetData()
631 pSMFData->flags |= SMF_FLAGS_JET_STREAM; in SMF_SetData()
640 for (i = 0; i < pSMFData->numStreams; i++) in SMF_SetData()
643 pSMFData->streams[i].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
645 pSMFData->streams[i].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
653 if (value < pSMFData->numStreams) in SMF_SetData()
654 pSMFData->streams[value].midiStream.jetData |= MIDI_FLAGS_JET_MUTE; in SMF_SetData()
661 if (value < pSMFData->numStreams) in SMF_SetData()
662 pSMFData->streams[value].midiStream.jetData &= ~MIDI_FLAGS_JET_MUTE; in SMF_SetData()
695 S_SMF_DATA *pSMFData; in SMF_GetData() local
697 pSMFData = (S_SMF_DATA*) pInstData; in SMF_GetData()
702 if (pSMFData->numStreams == 1) in SMF_GetData()
711 if (pSMFData->pSynth) in SMF_GetData()
712 VMGetPolyphony(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
718 if (pSMFData->pSynth) in SMF_GetData()
719 VMGetPriority(pEASData->pVoiceMgr, pSMFData->pSynth, pValue); in SMF_GetData()
724 *pValue = pSMFData->transposition; in SMF_GetData()
729 *pValue = (EAS_I32) pSMFData->pSynth; in SMF_GetData()
817 static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSM… in SMF_ParseMetaEvent() argument
857 pSMFData->tickConv = (EAS_U16) (((temp * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseMetaEvent()
858 pSMFData->flags |= SMF_FLAGS_HAS_TEMPO; in SMF_ParseMetaEvent()
864 pSMFData->flags |= SMF_FLAGS_HAS_TIME_SIG; in SMF_ParseMetaEvent()
868 else if (pSMFData->metadata.callback) in SMF_ParseMetaEvent()
887 readLen = pSMFData->metadata.bufferSize - 1; in SMF_ParseMetaEvent()
890 …if ((result = EAS_HWReadFile(pEASData->hwInstData, pSMFStream->fileHandle, pSMFData->metadata.buff… in SMF_ParseMetaEvent()
892 pSMFData->metadata.buffer[readLen] = 0; in SMF_ParseMetaEvent()
893pSMFData->metadata.callback(metaType, pSMFData->metadata.buffer, pSMFData->metadata.pUserData); in SMF_ParseMetaEvent()
921 static EAS_RESULT SMF_ParseSysEx (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseSysEx() argument
934 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, f0, parserM… in SMF_ParseSysEx()
943 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseSysEx()
948 pSMFData->flags |= SMF_FLAGS_HAS_GM_ON; in SMF_ParseSysEx()
970 static EAS_RESULT SMF_ParseEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData, S_SMF_STREAM *pSMFStr… in SMF_ParseEvent() argument
982 if ((result = SMF_ParseMetaEvent(pEASData, pSMFData, pSMFStream)) != EAS_SUCCESS) in SMF_ParseEvent()
989 if ((result = SMF_ParseSysEx(pEASData, pSMFData, pSMFStream, c, parserMode)) != EAS_SUCCESS) in SMF_ParseEvent()
996 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1004 …if ((result = EAS_ParseMIDIStream(pEASData, pSMFData->pSynth, &pSMFStream->midiStream, c, parserMo… in SMF_ParseEvent()
1011 if (pSMFData->time == 0) in SMF_ParseEvent()
1013 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_ParseEvent()
1016 pSMFData->flags &= ~SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1018 else if ((pSMFData->flags & SMF_FLAGS_SETUP_BAR) == SMF_FLAGS_SETUP_BAR) in SMF_ParseEvent()
1019 pSMFData->flags = (pSMFData->flags & ~SMF_FLAGS_SETUP_BAR) | SMF_FLAGS_CHASE_MODE; in SMF_ParseEvent()
1047 EAS_RESULT SMF_ParseHeader (EAS_HW_DATA_HANDLE hwInstData, S_SMF_DATA *pSMFData) in SMF_ParseHeader() argument
1058 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_HEAD… in SMF_ParseHeader()
1060 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1064 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, pSMFData->fileOffset + SMF_OFS_NUM_… in SMF_ParseHeader()
1066 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &pSMFData->numStreams, EAS_TRUE)) !=… in SMF_ParseHeader()
1070 if (pSMFData->numStreams > MAX_SMF_STREAMS) in SMF_ParseHeader()
1073 pSMFData->numStreams = MAX_SMF_STREAMS; in SMF_ParseHeader()
1074 } else if (pSMFData->numStreams == 0) in SMF_ParseHeader()
1081 …if ((result = EAS_HWGetWord(hwInstData, pSMFData->fileHandle, &division, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1085 pSMFData->ppqn = 192; in SMF_ParseHeader()
1089 pSMFData->ppqn = (division & 0x7fff); in SMF_ParseHeader()
1090 pSMFData->tickConv = (EAS_U16) (((SMF_DEFAULT_TIMEBASE * 1024) / pSMFData->ppqn + 500) / 1000); in SMF_ParseHeader()
1093 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1095 pSMFData->streams = EAS_HWMalloc(hwInstData,sizeof(S_SMF_STREAM) * pSMFData->numStreams); in SMF_ParseHeader()
1096 if (pSMFData->streams == NULL) in SMF_ParseHeader()
1100 EAS_HWMemSet((void *)(pSMFData->streams), 0, sizeof(S_SMF_STREAM) * pSMFData->numStreams); in SMF_ParseHeader()
1104 chunkStart = (EAS_U32) pSMFData->fileOffset; in SMF_ParseHeader()
1106 pSMFData->nextStream = NULL; in SMF_ParseHeader()
1107 for (i = 0; i < pSMFData->numStreams; i++) in SMF_ParseHeader()
1123 …if ((result = EAS_HWFileSeek(hwInstData, pSMFData->fileHandle, (EAS_I32) chunkStart)) != EAS_SUCCE… in SMF_ParseHeader()
1127 … if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &temp, EAS_TRUE)) != EAS_SUCCESS) in SMF_ParseHeader()
1131 …if ((result = EAS_HWGetDWord(hwInstData, pSMFData->fileHandle, &chunkSize, EAS_TRUE)) != EAS_SUCCE… in SMF_ParseHeader()
1142 pSMFData->streams[i].ticks = 0; in SMF_ParseHeader()
1143 pSMFData->streams[i].fileHandle = pSMFData->fileHandle; in SMF_ParseHeader()
1146 pSMFData->fileHandle = NULL; in SMF_ParseHeader()
1149 pSMFData->streams[i].startFilePos = (EAS_I32) chunkStart + SMF_CHUNK_INFO_SIZE; in SMF_ParseHeader()
1152 EAS_InitMIDIStream(&pSMFData->streams[i].midiStream); in SMF_ParseHeader()
1155 if ((result = SMF_GetDeltaTime(hwInstData, &pSMFData->streams[i])) != EAS_SUCCESS) in SMF_ParseHeader()
1158 if (pSMFData->streams[i].ticks < ticks) in SMF_ParseHeader()
1160 ticks = pSMFData->streams[i].ticks; in SMF_ParseHeader()
1161 pSMFData->nextStream = &pSMFData->streams[i]; in SMF_ParseHeader()
1165 if (i < (pSMFData->numStreams - 1)) in SMF_ParseHeader()
1167 …if ((result = EAS_HWDupHandle(hwInstData, pSMFData->streams[i].fileHandle, &pSMFData->fileHandle))… in SMF_ParseHeader()
1173 if (pSMFData->nextStream) in SMF_ParseHeader()
1174 SMF_UpdateTime(pSMFData, pSMFData->nextStream->ticks); in SMF_ParseHeader()
1201 static void SMF_UpdateTime (S_SMF_DATA *pSMFData, EAS_U32 ticks) in SMF_UpdateTime() argument
1205 if (pSMFData->flags & SMF_FLAGS_CHASE_MODE) in SMF_UpdateTime()
1208 temp1 = (ticks >> 10) * pSMFData->tickConv; in SMF_UpdateTime()
1209 temp2 = (ticks & 0x3ff) * pSMFData->tickConv; in SMF_UpdateTime()
1210 pSMFData->time += (EAS_I32)((temp1 << 8) + (temp2 >> 2)); in SMF_UpdateTime()