コード例 #1
0
void checkpointIds() {
	int orig[16];
	int plus[16];
	size_t i;
	size_t c;

	memset(orig, -1, sizeof(orig));
	memset(plus, -1, sizeof(plus));

	checkpoint(NULL);
	schedf("    ATRAC3+:");
	for (i = 0, c = 0; i < ARRAY_SIZE(plus); ++i) {
		plus[i] = sceAtracGetAtracID(0x1000);
		if (plus[i] >= 0) {
			schedf(" %d", plus[i]);
		}
		++c;
	}
	if (c == 0) {
		schedf(" (none)");
	}

	schedf(", ATRAC3:");
	for (i = 0, c = 0; i < ARRAY_SIZE(orig); ++i) {
		orig[i] = sceAtracGetAtracID(0x1001);
		if (orig[i] >= 0) {
			schedf(" %d", orig[i]);
		}
		++c;
	}
	if (c == 0) {
		schedf(" (none)");
	}

	for (i = 0; i < ARRAY_SIZE(plus); ++i) {
		sceAtracReleaseAtracID(plus[i]);
	}

	for (i = 0; i < ARRAY_SIZE(orig); ++i) {
		sceAtracReleaseAtracID(orig[i]);
	}

	schedf("\n");
}
コード例 #2
0
ファイル: getinfo.cpp プロジェクト: hrydgard/pspautotests
extern "C" int main(int argc, char *argv[]) {
	LoadAtrac();

	sceAtracReinit(0, 3);

	Atrac3File at3("../sample.at3");
	at3.Require();

	int atracID = sceAtracSetDataAndGetID(at3.Data(), at3.Size());

	checkpointNext("Atrac IDs:");
	testGetInfo("  Normal", atracID);
	testGetInfo("  Invalid ID", -1);
	testGetInfo("  Unused ID", 1);

	checkpointNext("Other states:");
	int withoutDataID = sceAtracGetAtracID(0x1000);
	testGetInfo("  No data", withoutDataID);
	sceAtracReleaseAtracID(withoutDataID);
	forceAtracState(atracID, 8);
	testGetInfo("  State 8", atracID);
	forceAtracState(atracID, 16);
	testGetInfo("  State 16", atracID);
	forceAtracState(atracID, 1);
	sceAtracReleaseAtracID(atracID);

	checkpointNext("Stream types:");
	int halfwayID = sceAtracSetHalfwayBufferAndGetID(at3.Data(), at3.Size() / 2, at3.Size());
	testGetInfo("  Halfway", atracID);
	sceAtracReleaseAtracID(halfwayID);
	testGetInfo("  No loop", at3);
	testGetInfoWithLooped("  End loop", at3, 2048, 249548);
	testGetInfoWithLooped("  Middle loop", at3, 2048, 200000);
	testGetInfoWithLooped("  Late loop", at3, 200000, 249548);

	checkpointNext("Loop end cutoff:");
	testGetInfoWithLooped("  200335", at3, 2048, 200335);
	testGetInfoWithLooped("  200336", at3, 2048, 200336);

	testGetInfoTwice(at3);

	UnloadAtrac();
	return 0;
}
コード例 #3
0
int main(int argc, char *argv[]) {
	sceUtilityLoadModule(PSP_MODULE_AV_AVCODEC);
	sceUtilityLoadModule(PSP_MODULE_AV_ATRAC3PLUS);

	checkpointNext("sceAtracReinit ID usage:");

	checkpoint("  Initial ids:");
	checkpointIds();

	checkpoint("  sceAtracReinit(2, 2): %08x", sceAtracReinit(2, 2));
	checkpointIds();

	checkpoint("  sceAtracReinit(3, 1): %08x", sceAtracReinit(3, 1));
	checkpointIds();

	checkpoint("  sceAtracReinit(999, 0): %08x", sceAtracReinit(999, 0));
	checkpointIds();

	checkpoint("  sceAtracReinit(0, 999): %08x", sceAtracReinit(0, 999));
	checkpointIds();

	checkpoint("  sceAtracReinit(999, 999): %08x", sceAtracReinit(0, 999));
	checkpointIds();

	checkpoint("  sceAtracReinit(0, 0): %08x", sceAtracReinit(0, 0));
	checkpointIds();

	checkpoint("  sceAtracReinit(0, 0): %08x", sceAtracReinit(0, 0));
	checkpointIds();

	checkpoint("  sceAtracReinit(0, -1): %08x", sceAtracReinit(0, -1));
	checkpointIds();

	checkpoint("  sceAtracReinit(0, -1): %08x", sceAtracReinit(0, -1));
	checkpointIds();

	checkpointNext("sceAtracReinit while open:");
	checkpoint("  Reset: %08x", sceAtracReinit(2, 2));
	int orig = sceAtracGetAtracID(0x1001);
	checkpoint("  With allocated, just one: %08x", sceAtracReinit(1, 0));
	checkpoint("  With allocated, free: %08x", sceAtracReinit(0, 0));
	sceAtracReleaseAtracID(orig);

	checkpointNext("ID reuse:");
	checkpoint("  Reset: %08x", sceAtracReinit(6, 0));
	checkpointIds();

	int reuse[6];
	size_t i;
	for (i = 0; i < ARRAY_SIZE(reuse) - 1; ++i) {
		reuse[i] = sceAtracGetAtracID(0x1001);
	}
	checkpoint("  Allocated #0-#4 (#5 still free)");
	checkpoint("  Release #3: %08x", sceAtracReleaseAtracID(reuse[3]));
	checkpoint("  Allocate new: %s", sceAtracGetAtracID(0x1001) == reuse[3] ? "#3" : "different");
	for (i = 0; i < ARRAY_SIZE(reuse) - 1; ++i) {
		sceAtracReleaseAtracID(reuse[i]);
	}

	return 0;
}