コード例 #1
0
ファイル: MP2kSeq.cpp プロジェクト: vgmtrans/vgmtrans
bool MP2kSeq::GetHeaderInfo(void) {
    if (dwOffset + 2 > vgmfile->GetEndOffset()) {
        return false;
    }

    nNumTracks = GetShort(dwOffset);

    // if there are no tracks or there are more tracks than allowed
    // return an error; the sequence shall be deleted
    if (nNumTracks == 0 || nNumTracks > 24) {
        return false;
    }
    if (dwOffset + 8 + nNumTracks * 4 > vgmfile->GetEndOffset()) {
        return false;
    }

    VGMHeader *seqHdr = AddHeader(dwOffset, 8 + nNumTracks * 4, L"Sequence Header");
    seqHdr->AddSimpleItem(dwOffset, 1, L"Number of Tracks");
    seqHdr->AddSimpleItem(dwOffset + 1, 1, L"Unknown");
    seqHdr->AddSimpleItem(dwOffset + 2, 1, L"Priority");
    seqHdr->AddSimpleItem(dwOffset + 3, 1, L"Reverb");
    uint32_t dwInstPtr = GetWord(dwOffset + 4);
    seqHdr->AddPointer(dwOffset + 4, 4, dwInstPtr - 0x8000000, true, L"Instrument Pointer");
    for (unsigned int i = 0; i < nNumTracks; i++) {
        uint32_t dwTrackPtrOffset = dwOffset + 8 + i * 4;
        uint32_t dwTrackPtr = GetWord(dwTrackPtrOffset);
        seqHdr->AddPointer(dwTrackPtrOffset, 4, dwTrackPtr - 0x8000000, true, L"Track Pointer");
    }

    SetPPQN(0x30);
    return true;
}
コード例 #2
0
ファイル: RareSnesSeq.cpp プロジェクト: ValleyBell/vgmtrans
bool RareSnesSeq::GetHeaderInfo(void)
{
	SetPPQN(SEQ_PPQN);

	VGMHeader* seqHeader = AddHeader(dwOffset, MAX_TRACKS * 2 + 2, L"Sequence Header");
	uint32_t curHeaderOffset = dwOffset;
	for (int i = 0; i < MAX_TRACKS; i++)
	{
		uint16_t trkOff = GetShort(curHeaderOffset);
		seqHeader->AddPointer(curHeaderOffset, 2, trkOff, (trkOff != 0), L"Track Pointer");
		curHeaderOffset += 2;
	}
	initialTempo = GetByte(curHeaderOffset);
	seqHeader->AddTempo(curHeaderOffset++, 1, L"Tempo");
	seqHeader->AddUnknownItem(curHeaderOffset++, 1);

	return true;		//successful
}