Lines Matching refs:pData
95 static EAS_RESULT OTA_ParseHeader (S_EAS_DATA *pEASData, S_OTA_DATA* pData);
96 static EAS_RESULT OTA_FetchBitField (EAS_HW_DATA_HANDLE hwInstData, S_OTA_DATA *pData, EAS_I32 numBits, EAS_U8 *pValue);
97 static EAS_RESULT OTA_SavePosition (EAS_HW_DATA_HANDLE hwInstData, S_OTA_DATA *pData, S_OTA_LOC *pLoc);
98 static EAS_RESULT OTA_RestorePosition (EAS_HW_DATA_HANDLE hwInstData, S_OTA_DATA *pData, S_OTA_LOC *pLoc);
163 S_OTA_DATA* pData;
199 pData = EAS_CMEnumData(EAS_CM_OTA_DATA);
201 pData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_OTA_DATA));
202 if (!pData)
207 EAS_HWMemSet(pData, 0, sizeof(S_OTA_DATA));
210 pData->fileHandle = fileHandle;
211 pData->fileOffset = offset;
212 pData->state = EAS_STATE_OPEN;
213 *ppHandle = pData;
246 S_OTA_DATA* pData;
250 pData = (S_OTA_DATA*) pInstData;
251 if (pData->state != EAS_STATE_OPEN)
255 if ((result = VMInitMIDI(pEASData, &pData->pSynth)) != EAS_SUCCESS)
261 pData->state = EAS_STATE_ERROR;
262 if ((result = OTA_ParseHeader(pEASData, pData)) != EAS_SUCCESS)
265 pData->state = EAS_STATE_READY;
290 S_OTA_DATA *pData;
292 pData = (S_OTA_DATA*) pInstData;
296 *pTime = pData->time >> 8;
319 S_OTA_DATA* pData;
324 pData = (S_OTA_DATA*) pInstData;
325 if (pData->state >= EAS_STATE_OPEN)
329 if (pData->time == 0)
333 VMProgramChange(pEASData->pVoiceMgr, pData->pSynth, OTA_CHANNEL, OTA_PROGRAM);
337 VMControlChange(pEASData->pVoiceMgr, pData->pSynth, OTA_CHANNEL, 7, 127);
341 if (pData->note)
344 VMStopNote(pEASData->pVoiceMgr, pData->pSynth, OTA_CHANNEL, pData->note, 0);
345 pData->note = 0;
348 if (pData->restTicks)
350 pData->time += (EAS_I32) pData->restTicks;
351 pData->restTicks = 0;
357 while (pData->current.patternLen == 0)
361 if (pData->loopCount && ((parserMode == eParserModePlay) || (pData->loopCount != OTA_INFINITE_LOOP)))
364 if (pData->loopCount != OTA_INFINITE_LOOP)
365 pData->loopCount--;
368 if ((result = OTA_RestorePosition(pEASData->hwInstData, pData, &pData->patterns[pData->currentPattern])) != EAS_SUCCESS)
373 else if (pData->restore.fileOffset < 0)
377 if (pData->numPatterns == 0)
379 pData->state = EAS_STATE_STOPPING;
380 VMReleaseAllVoices(pEASData->pVoiceMgr, pData->pSynth);
385 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 3, &temp)) != EAS_SUCCESS)
394 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 2, &pData->currentPattern)) != EAS_SUCCESS)
398 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 4, &pData->loopCount)) != EAS_SUCCESS)
402 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 8, &pData->current.patternLen)) != EAS_SUCCESS)
406 if (pData->current.patternLen)
408 if ((result = OTA_SavePosition(pEASData->hwInstData, pData, &pData->patterns[pData->currentPattern])) != EAS_SUCCESS)
416 if (pData->patterns[pData->currentPattern].fileOffset < 0)
423 if ((result = OTA_SavePosition(pEASData->hwInstData, pData, &pData->restore)) != EAS_SUCCESS)
427 if ((result = OTA_RestorePosition(pEASData->hwInstData, pData, &pData->patterns[pData->currentPattern])) != EAS_SUCCESS)
432 pData->numPatterns--;
438 if ((result = OTA_RestorePosition(pEASData->hwInstData, pData, &pData->restore)) != EAS_SUCCESS)
444 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 3, &temp)) != EAS_SUCCESS)
451 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 4, &pData->note)) != EAS_SUCCESS)
455 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 3, &temp)) != EAS_SUCCESS)
457 duration = pData->tick * (0x20 >> temp);
460 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 2, &temp)) != EAS_SUCCESS)
485 if (pData->note)
489 pData->style)
492 pData->restTicks = duration >> 4;
495 pData->restTicks = 0;
498 pData->restTicks = duration >> 1;
505 pData->note += pData->octave;
507 VMStartNote(pEASData->pVoiceMgr, pData->pSynth, OTA_CHANNEL, pData->note, pData->velocity);
508 pData->time += (EAS_I32) duration - (EAS_I32) pData->restTicks;
513 pData->time += (EAS_I32) duration;
518 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 2, &temp)) != EAS_SUCCESS)
520 pData->octave = (EAS_U8) (temp * 12 + 59);
525 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 2, &pData->style)) != EAS_SUCCESS)
531 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 5, &temp)) != EAS_SUCCESS)
533 pData->tick = bpmTable[temp];
538 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 4, &temp)) != EAS_SUCCESS)
540 pData->velocity = temp ? (EAS_U8) (temp * OTA_VEL_MUL + OTA_VEL_OFS) : 0;
549 pData->current.patternLen--;
574 S_OTA_DATA* pData;
577 pData = (S_OTA_DATA*) pInstData;
580 if (pData->state == EAS_STATE_STOPPING)
582 if (VMActiveVoices(pData->pSynth) == 0)
583 pData->state = EAS_STATE_STOPPED;
586 if (pData->state == EAS_STATE_PAUSING)
588 if (VMActiveVoices(pData->pSynth) == 0)
589 pData->state = EAS_STATE_PAUSED;
593 *pState = pData->state;
616 S_OTA_DATA* pData;
619 pData = (S_OTA_DATA*) pInstData;
622 if ((result = EAS_HWCloseFile(pEASData->hwInstData, pData->fileHandle)) != EAS_SUCCESS)
626 if (pData->pSynth != NULL)
627 VMMIDIShutdown(pEASData, pData->pSynth);
631 EAS_HWFree(pEASData->hwInstData, pData);
655 S_OTA_DATA* pData;
658 pData = (S_OTA_DATA*) pInstData;
661 VMReset(pEASData->pVoiceMgr, pData->pSynth, EAS_TRUE);
662 pData->note = 0;
665 pData->state = EAS_STATE_ERROR;
666 if ((result = OTA_ParseHeader (pEASData, pData)) != EAS_SUCCESS)
669 pData->state = EAS_STATE_READY;
692 S_OTA_DATA *pData;
695 pData = (S_OTA_DATA*) pInstData;
696 if (pData->state == EAS_STATE_STOPPED)
700 VMMuteAllVoices(pEASData->pVoiceMgr, pData->pSynth);
701 pData->state = EAS_STATE_PAUSING;
725 S_OTA_DATA *pData;
728 pData = (S_OTA_DATA*) pInstData;
729 if (pData->state == EAS_STATE_STOPPED)
733 pData->state = EAS_STATE_PLAY;
757 S_OTA_DATA *pData;
759 pData = (S_OTA_DATA *) pInstData;
765 EAS_HWMemCpy(&pData->metadata, (void*) value, sizeof(S_METADATA_CB));
795 S_OTA_DATA *pData;
797 pData = (S_OTA_DATA*) pInstData;
808 *pValue = pData->transposition;
813 *pValue = (EAS_I32) pData->pSynth;
844 static EAS_RESULT OTA_ParseHeader (S_EAS_DATA *pEASData, S_OTA_DATA* pData)
853 pData->flags = 0;
854 pData->time = 0;
855 pData->tick = DEFAULT_TICK_CONV;
856 pData->patterns[0].fileOffset = pData->patterns[1].fileOffset =
857 pData->patterns[2].fileOffset = pData->patterns[3].fileOffset = -1;
858 pData->current.bitCount = 0;
859 pData->current.patternLen = 0;
860 pData->loopCount = 0;
861 pData->restore.fileOffset = -1;
862 pData->note = 0;
863 pData->restTicks = 0;
864 pData->velocity = OTA_VEL_DEFAULT;
865 pData->style = 0;
866 pData->octave = 59;
869 if ((result = EAS_HWFileSeek(pEASData->hwInstData, pData->fileHandle, pData->fileOffset)) != EAS_SUCCESS)
873 if ((result = EAS_HWGetByte(pEASData->hwInstData, pData->fileHandle, &temp)) != EAS_SUCCESS)
883 pData->current.bitCount = 0;
884 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 7, &temp)) != EAS_SUCCESS)
903 pData->flags |= OTA_FLAGS_UNICODE;
913 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 3, &temp)) != EAS_SUCCESS)
920 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 4, &titleLen)) != EAS_SUCCESS)
924 if (pData->flags & OTA_FLAGS_UNICODE)
928 if (pData->metadata.buffer)
929 EAS_HWMemSet(pData->metadata.buffer, 0, pData->metadata.bufferSize);
935 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 8, &temp)) != EAS_SUCCESS)
939 if (pData->metadata.callback)
941 if (i < (pData->metadata.bufferSize - 1))
942 pData->metadata.buffer[i] = (char) temp;
947 if (pData->metadata.callback)
948 (*pData->metadata.callback)(EAS_METADATA_TITLE, pData->metadata.buffer, pData->metadata.pUserData);
959 if ((result = OTA_FetchBitField(pEASData->hwInstData, pData, 8, &pData->numPatterns)) != EAS_SUCCESS)
963 if (pData->numPatterns == 0)
989 static EAS_RESULT OTA_FetchBitField (EAS_HW_DATA_HANDLE hwInstData, S_OTA_DATA *pData, EAS_I32 numBits, EAS_U8 *pValue)
998 bitsLeft = pData->current.bitCount - numBits;
1004 if (pData->current.bitCount)
1006 value = pData->current.dataByte << -bitsLeft;
1009 if ((result = EAS_HWGetByte(hwInstData, pData->fileHandle, &pData->current.dataByte)) != EAS_SUCCESS)
1017 value |= pData->current.dataByte >> bitsLeft;
1018 pData->current.bitCount = (EAS_U8) bitsLeft;
1019 pData->current.dataByte = pData->current.dataByte & (0xff >> (8 - bitsLeft));
1025 value |= pData->current.dataByte;
1026 pData->current.bitCount = 0;
1049 pData, S_OTA_LOC *pLoc)
1051 EAS_HWMemCpy(pLoc, &pData->current, sizeof(S_OTA_LOC));
1052 return EAS_HWFilePos(hwInstData, pData->fileHandle, &pLoc->fileOffset);
1071 static EAS_RESULT OTA_RestorePosition (EAS_HW_DATA_HANDLE hwInstData, S_OTA_DATA *pData, S_OTA_LOC *pLoc)
1073 EAS_HWMemCpy(&pData->current, pLoc, sizeof(S_OTA_LOC));
1074 pData->restore.fileOffset = -1;
1075 return EAS_HWFileSeek(hwInstData, pData->fileHandle, pLoc->fileOffset);