Lines Matching refs:pData
110 static void PutBackChar (S_IMELODY_DATA *pData) in PutBackChar() argument
112 if (pData->index) in PutBackChar()
113 pData->index--; in PutBackChar()
117 EAS_INLINE void PutBackChar (S_IMELODY_DATA *pData) { if (pData->index) pData->index--; } in PutBackChar() argument
133 static EAS_BOOL IMY_PlayNote (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData, EAS_I8 note, EAS_INT par…
134 static EAS_BOOL IMY_PlayRest (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData);
135 static EAS_BOOL IMY_GetDuration (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_I32 *pDu…
136 static EAS_BOOL IMY_GetLEDState (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData);
137 static EAS_BOOL IMY_GetVibeState (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData);
138 static EAS_BOOL IMY_GetBackState (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData);
139 static EAS_BOOL IMY_GetVolume (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_BOOL inHea…
140 static EAS_BOOL IMY_GetNumber (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_INT *temp,…
141 static EAS_RESULT IMY_ParseHeader (S_EAS_DATA *pEASData, S_IMELODY_DATA* pData);
142 static EAS_I8 IMY_GetNextChar (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_BOOL inHea…
190 S_IMELODY_DATA* pData; in IMY_CheckFileType() local
209 pData = EAS_CMEnumData(EAS_CM_IMELODY_DATA); in IMY_CheckFileType()
211 pData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_IMELODY_DATA)); in IMY_CheckFileType()
212 if (!pData) in IMY_CheckFileType()
214 EAS_HWMemSet(pData, 0, sizeof(S_IMELODY_DATA)); in IMY_CheckFileType()
217 pData->fileHandle = fileHandle; in IMY_CheckFileType()
218 pData->fileOffset = offset; in IMY_CheckFileType()
219 pData->state = EAS_STATE_ERROR; in IMY_CheckFileType()
220 pData->state = EAS_STATE_OPEN; in IMY_CheckFileType()
223 *ppHandle = pData; in IMY_CheckFileType()
249 S_IMELODY_DATA* pData; in IMY_Prepare() local
257 pData = (S_IMELODY_DATA*) pInstData; in IMY_Prepare()
258 if (pData->state != EAS_STATE_OPEN) in IMY_Prepare()
262 if ((result = VMInitMIDI(pEASData, &pData->pSynth)) != EAS_SUCCESS) in IMY_Prepare()
269 if ((result = IMY_ParseHeader(pEASData, pData)) != EAS_SUCCESS) in IMY_Prepare()
276 pData ->state = EAS_STATE_READY; in IMY_Prepare()
301 S_IMELODY_DATA *pData; in IMY_Time() local
303 pData = (S_IMELODY_DATA*) pInstData; in IMY_Time()
307 *pTime = pData->time >> 8; in IMY_Time()
330 S_IMELODY_DATA* pData; in IMY_Event() local
336 pData = (S_IMELODY_DATA*) pInstData; in IMY_Event()
337 if (pData->state >= EAS_STATE_OPEN) in IMY_Event()
341 if (pData->time == 0) in IMY_Event()
348 VMProgramChange(pEASData->pVoiceMgr, pData->pSynth, IMELODY_CHANNEL, IMELODY_PROGRAM); in IMY_Event()
351 VMControlChange(pEASData->pVoiceMgr, pData->pSynth, IMELODY_CHANNEL, 7, 127); in IMY_Event()
355 if (pData->note) in IMY_Event()
362 VMStopNote(pEASData->pVoiceMgr, pData->pSynth, IMELODY_CHANNEL, pData->note, 0); in IMY_Event()
363 pData->note = 0; in IMY_Event()
366 if (pData->restTicks) in IMY_Event()
368 pData->time += pData->restTicks; in IMY_Event()
369 pData->restTicks = 0; in IMY_Event()
380 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_FALSE); in IMY_Event()
391 if (pData->repeatOffset < 0) in IMY_Event()
393 pData->repeatOffset = pData->startLine + (EAS_I32) pData->index; in IMY_Event()
410 if (pData->repeatCount >= 0) in IMY_Event()
414 if (pData->repeatCount > 0) in IMY_Event()
416 if (--pData->repeatCount == 0) in IMY_Event()
418 pData->repeatCount = -1; in IMY_Event()
427 if ((parserMode == eParserModePlay) || (pData->repeatCount != 0)) in IMY_Event()
434 …if ((result = EAS_HWFileSeek(pEASData->hwInstData, pData->fileHandle, pData->repeatOffset)) != EAS… in IMY_Event()
436 … IMY_ReadLine(pEASData->hwInstData, pData->fileHandle, pData->buffer, &pData->startLine); in IMY_Event()
437 pData->index = 0; in IMY_Event()
440 if (pData->repeatCount == -1) in IMY_Event()
441 pData->repeatOffset = -1; in IMY_Event()
448 if (!IMY_GetNumber(pEASData->hwInstData, pData, &temp, EAS_FALSE)) in IMY_Event()
450 else if (pData->repeatOffset > 0) in IMY_Event()
456 if (pData->repeatCount < 0) in IMY_Event()
457 pData->repeatCount = (EAS_I16) temp; in IMY_Event()
463 if (!IMY_GetVolume(pEASData->hwInstData, pData, EAS_FALSE)) in IMY_Event()
469 pData->noteModifier = -1; in IMY_Event()
474 pData->noteModifier = +1; in IMY_Event()
479 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_FALSE); in IMY_Event()
481 pData->octave = (EAS_U8) ((c - '0' + 1) * 12); in IMY_Event()
488 if (!IMY_GetLEDState(pEASData, pData)) in IMY_Event()
494 if (!IMY_GetVibeState(pEASData, pData)) in IMY_Event()
500 if (IMY_GetNextChar(pEASData->hwInstData, pData, EAS_FALSE) == 'a') in IMY_Event()
502 if (!IMY_GetBackState(pEASData, pData)) in IMY_Event()
507 PutBackChar(pData); in IMY_Event()
508 if (IMY_PlayNote(pEASData, pData, c, parserMode)) in IMY_Event()
517 if (IMY_PlayRest(pEASData, pData)) in IMY_Event()
535 if (IMY_PlayNote(pEASData, pData, c, parserMode)) in IMY_Event()
549 pData->state = EAS_STATE_STOPPING; in IMY_Event()
550 VMReleaseAllVoices(pEASData->pVoiceMgr, pData->pSynth); in IMY_Event()
575 S_IMELODY_DATA* pData; in IMY_State() local
578 pData = (S_IMELODY_DATA*) pInstData; in IMY_State()
581 if (pData->state == EAS_STATE_STOPPING) in IMY_State()
583 if (VMActiveVoices(pData->pSynth) == 0) in IMY_State()
585 pData->state = EAS_STATE_STOPPED; in IMY_State()
592 if (pData->state == EAS_STATE_PAUSING) in IMY_State()
594 if (VMActiveVoices(pData->pSynth) == 0) in IMY_State()
599 pData->state = EAS_STATE_PAUSED; in IMY_State()
604 *pState = pData->state; in IMY_State()
627 S_IMELODY_DATA* pData; in IMY_Close() local
634 pData = (S_IMELODY_DATA*) pInstData; in IMY_Close()
637 if ((result = EAS_HWCloseFile(pEASData->hwInstData, pData->fileHandle)) != EAS_SUCCESS) in IMY_Close()
641 if (pData->pSynth != NULL) in IMY_Close()
642 VMMIDIShutdown(pEASData, pData->pSynth); in IMY_Close()
646 EAS_HWFree(pEASData->hwInstData, pData); in IMY_Close()
670 S_IMELODY_DATA* pData; in IMY_Reset() local
676 pData = (S_IMELODY_DATA*) pInstData; in IMY_Reset()
679 VMReset(pEASData->pVoiceMgr, pData->pSynth, EAS_TRUE); in IMY_Reset()
682 pData->time = 0; in IMY_Reset()
683 pData->note = 0; in IMY_Reset()
686 pData->state = EAS_STATE_ERROR; in IMY_Reset()
687 …if ((result = EAS_HWFileSeek(pEASData->hwInstData, pData->fileHandle, pData->fileOffset)) != EAS_S… in IMY_Reset()
689 if ((result = IMY_ParseHeader (pEASData, pData)) != EAS_SUCCESS) in IMY_Reset()
696 pData->state = EAS_STATE_READY; in IMY_Reset()
719 S_IMELODY_DATA *pData; in IMY_Pause() local
726 pData = (S_IMELODY_DATA*) pInstData; in IMY_Pause()
727 if (pData->state == EAS_STATE_STOPPED) in IMY_Pause()
731 VMMuteAllVoices(pEASData->pVoiceMgr, pData->pSynth); in IMY_Pause()
732 pData->state = EAS_STATE_PAUSING; in IMY_Pause()
756 S_IMELODY_DATA *pData; in IMY_Resume() local
763 pData = (S_IMELODY_DATA*) pInstData; in IMY_Resume()
764 if (pData->state == EAS_STATE_STOPPED) in IMY_Resume()
768 pData->state = EAS_STATE_PLAY; in IMY_Resume()
793 S_IMELODY_DATA *pData; in IMY_SetData() local
795 pData = (S_IMELODY_DATA*) pInstData; in IMY_SetData()
801 EAS_HWMemCpy(&pData->metadata, (void*) value, sizeof(S_METADATA_CB)); in IMY_SetData()
831 S_IMELODY_DATA *pData; in IMY_GetData() local
833 pData = (S_IMELODY_DATA*) pInstData; in IMY_GetData()
843 *pValue = (EAS_I32) pData->pSynth; in IMY_GetData()
873 static EAS_BOOL IMY_PlayNote (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData, EAS_I8 note, EAS_INT par… in IMY_PlayNote() argument
884 if (!IMY_GetDuration(pEASData->hwInstData, pData, &duration)) in IMY_PlayNote()
888 pData->note = (EAS_U8) (pData->octave + noteTable[note - 'a'] + pData->noteModifier); in IMY_PlayNote()
889 velocity = (EAS_U8) (pData->volume ? pData->volume * IMELODY_VEL_MUL + IMELODY_VEL_OFS : 0); in IMY_PlayNote()
893 VMStartNote(pEASData->pVoiceMgr, pData->pSynth, IMELODY_CHANNEL, pData->note, velocity); in IMY_PlayNote()
900 switch (pData->style) in IMY_PlayNote()
904 pData->restTicks = duration >> 4; in IMY_PlayNote()
907 pData->restTicks = 0; in IMY_PlayNote()
911 pData->restTicks = duration >> 1; in IMY_PlayNote()
916 pData->restTicks = duration >> 4; in IMY_PlayNote()
921 pData->time += duration - pData->restTicks; in IMY_PlayNote()
924 pData->noteModifier = 0; in IMY_PlayNote()
945 static EAS_BOOL IMY_PlayRest (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData) in IMY_PlayRest() argument
954 if (!IMY_GetDuration(pEASData->hwInstData, pData, &duration)) in IMY_PlayRest()
962 pData->time += duration; in IMY_PlayRest()
983 static EAS_BOOL IMY_GetDuration (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_I32 *pDu… in IMY_GetDuration() argument
990 c = IMY_GetNextChar(hwInstData, pData, EAS_FALSE); in IMY_GetDuration()
1002 duration = pData->tick * (1 << ('5' - c)); in IMY_GetDuration()
1005 c = IMY_GetNextChar(hwInstData, pData, EAS_FALSE); in IMY_GetDuration()
1018 PutBackChar(pData); in IMY_GetDuration()
1041 static EAS_BOOL IMY_GetLEDState (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData) in IMY_GetLEDState() argument
1052 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_FALSE); in IMY_GetLEDState()
1106 static EAS_BOOL IMY_GetVibeState (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData) in IMY_GetVibeState() argument
1117 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_FALSE); in IMY_GetVibeState()
1171 static EAS_BOOL IMY_GetBackState (S_EAS_DATA *pEASData, S_IMELODY_DATA *pData) in IMY_GetBackState() argument
1182 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_FALSE); in IMY_GetBackState()
1236 static EAS_BOOL IMY_GetVolume (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_BOOL inHea… in IMY_GetVolume() argument
1245 c = IMY_GetNextChar(hwInstData, pData, inHeader); in IMY_GetVolume()
1248 if (pData->volume < 15) in IMY_GetVolume()
1249 pData->volume++; in IMY_GetVolume()
1254 if (pData->volume > 0) in IMY_GetVolume()
1255 pData->volume--; in IMY_GetVolume()
1263 c = IMY_GetNextChar(hwInstData, pData, inHeader); in IMY_GetVolume()
1267 PutBackChar(pData); in IMY_GetVolume()
1273 pData->volume = (EAS_U8) temp; in IMY_GetVolume()
1294 static EAS_BOOL IMY_GetNumber (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_INT *temp,… in IMY_GetNumber() argument
1307 c = IMY_GetNextChar(hwInstData, pData, inHeader); in IMY_GetNumber()
1316 PutBackChar(pData); in IMY_GetNumber()
1343 static EAS_BOOL IMY_GetVersion (S_IMELODY_DATA *pData, EAS_INT *pVersion) in IMY_GetVersion() argument
1352 c = pData->buffer[pData->index++]; in IMY_GetVersion()
1392 static void IMY_MetaData (S_IMELODY_DATA *pData, E_EAS_METADATA_TYPE metaType, EAS_I8 *buffer) in IMY_MetaData() argument
1397 if (!pData->metadata.callback) in IMY_MetaData()
1402 if (len >pData->metadata.bufferSize) in IMY_MetaData()
1403 len = pData->metadata.bufferSize; in IMY_MetaData()
1404 strncpy((char*) pData->metadata.buffer, (char*) buffer, (size_t) len); in IMY_MetaData()
1405 pData->metadata.buffer[len] = 0; in IMY_MetaData()
1408 pData->metadata.callback(metaType, pData->metadata.buffer, pData->metadata.pUserData); in IMY_MetaData()
1429 static EAS_RESULT IMY_ParseHeader (S_EAS_DATA *pEASData, S_IMELODY_DATA* pData) in IMY_ParseHeader() argument
1441 pData->time = 0; in IMY_ParseHeader()
1442 pData->tick = DEFAULT_TICK_CONV; in IMY_ParseHeader()
1443 pData->note = 0; in IMY_ParseHeader()
1444 pData->noteModifier = 0; in IMY_ParseHeader()
1445 pData ->restTicks = 0; in IMY_ParseHeader()
1446 pData->volume = 7; in IMY_ParseHeader()
1447 pData->octave = 60; in IMY_ParseHeader()
1448 pData->repeatOffset = -1; in IMY_ParseHeader()
1449 pData->repeatCount = -1; in IMY_ParseHeader()
1450 pData->style = 0; in IMY_ParseHeader()
1453 pData->index = 1; in IMY_ParseHeader()
1459 if (pData->index != 0) in IMY_ParseHeader()
1461 …if ((result = IMY_ReadLine(pEASData->hwInstData, pData->fileHandle, pData->buffer, &pData->startLi… in IMY_ParseHeader()
1469 token = IMY_ParseLine(pData->buffer, &pData->index); in IMY_ParseHeader()
1478 if (!IMY_GetVersion(pData, &temp)) in IMY_ParseHeader()
1491 if (!IMY_GetVersion(pData, &temp)) in IMY_ParseHeader()
1504 IMY_MetaData(pData, EAS_METADATA_TITLE, pData->buffer + pData->index); in IMY_ParseHeader()
1508 IMY_MetaData(pData, EAS_METADATA_AUTHOR, pData->buffer + pData->index); in IMY_ParseHeader()
1513 IMY_GetNumber(pEASData->hwInstData, pData, &temp, EAS_TRUE); in IMY_ParseHeader()
1515 pData->tick = TICK_CONVERT / temp; in IMY_ParseHeader()
1520 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_TRUE); in IMY_ParseHeader()
1522 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_TRUE); in IMY_ParseHeader()
1524 pData->style = (EAS_U8) (c - '0'); in IMY_ParseHeader()
1527 PutBackChar(pData); in IMY_ParseHeader()
1534 c = IMY_GetNextChar(pEASData->hwInstData, pData, EAS_TRUE); in IMY_ParseHeader()
1537 PutBackChar(pData); in IMY_ParseHeader()
1544 IMY_GetVolume(pEASData->hwInstData, pData, EAS_TRUE); in IMY_ParseHeader()
1559 pData->index = 1; in IMY_ParseHeader()
1582 static EAS_I8 IMY_GetNextChar (EAS_HW_DATA_HANDLE hwInstData, S_IMELODY_DATA *pData, EAS_BOOL inHea… in IMY_GetNextChar() argument
1590 c = pData->buffer[pData->index++]; in IMY_GetNextChar()
1599 pData->index = 0; in IMY_GetNextChar()
1600 pData->buffer[0] = 0; in IMY_GetNextChar()
1601 … if (IMY_ReadLine(hwInstData, pData->fileHandle, pData->buffer, &pData->startLine) != EAS_SUCCESS) in IMY_GetNextChar()
1610 if (IMY_ParseLine(pData->buffer, &index) == TOKEN_END) in IMY_GetNextChar()
1615 pData->buffer[0] = 0; in IMY_GetNextChar()