示例#1
0
// load and set up a 2sf file
int setup_playback(char *name)
{
	int res;

	res = read_in_file(name);

	if (res < 0) {
		return res;
	}

	m1sdr_Init(44100);
	m1sdr_SetCallback(do_frame);
	m1sdr_PlayStart();

	if ((c != NULL) && (c->inf_title[0] != '\0'))
	{
		BOLD();
		//printf("Playing \"%s\" by %s from %s.  Copyright %s %s.\nFilename: %s\n", c->inf_title, c->inf_artist, c->inf_game, c->inf_copy, c->inf_year, name);
		printf("Playing \"%s\" by %s from %s.\n", c->inf_title, c->inf_artist, c->inf_game);
		printf("Copyright %s %s.\n", c->inf_copy, c->inf_year);
		printf("Filename: %s.\n", name);
		NONBOLDYELLOW();
		printf("----------------------------------------------------------------\n");
		NORMAL();
	}
	else
	{
		BOLD();
		printf("Playing %s\n", name);
		NORMAL();
	}

	return 0;
}
示例#2
0
文件: dsnd.c 项目: Kinglions/modizer
void m1sdr_SetSamplesPerTick(UINT32 spf)
{
	if (spf != (nDSoundFps/10))
	{
		m1sdr_Exit();
		nDSoundFps = spf * 10;
		m1sdr_Init(nDSoundSamRate);
	}
}
示例#3
0
文件: main.c 项目: Koss64/deadbeef
int main(int argv, char *argc[])
{
	FILE *file;
	uint8 *buffer;
	uint32 size, filesig;

	printf("AOSDK test program v1.0 by R. Belmont [AOSDK release 1.4.8]\nCopyright (c) 2007-2009 R. Belmont and Richard Bannister - please read license.txt for license details\n\n");

	// check if an argument was given
	if (argv < 2)
	{
		printf("Error: must specify a filename!\n");
		return -1;
	}	

	file = fopen(argc[1], "rb");

	if (!file)
	{
		printf("ERROR: could not open file %s\n", argc[1]);
		return -1;
	}

	// get the length of the file by seeking to the end then reading the current position
	fseek(file, 0, SEEK_END);
	size = ftell(file);
	// reset the pointer
	fseek(file, 0, SEEK_SET);

	buffer = malloc(size);

	if (!buffer)
	{
		fclose(file);
		printf("ERROR: could not allocate %d bytes of memory\n", size);
		return -1;
	}

	// read the file
	fread(buffer, size, 1, file);
	fclose(file);

	// now try to identify the file
	type = 0;
	filesig = buffer[0]<<24 | buffer[1]<<16 | buffer[2]<<8 | buffer[3];
	while (types[type].sig != 0xffffffff)
	{
		if (filesig == types[type].sig)
		{
			break;
		}
		else
		{
			type++;
		}
	}

	// now did we identify it above or just fall through?
	if (types[type].sig != 0xffffffff)
	{
		printf("File identified as %s\n", types[type].name);
	}
	else
	{
		printf("ERROR: File is unknown, signature bytes are %02x %02x %02x %02x\n", buffer[0], buffer[1], buffer[2], buffer[3]);
		free(buffer);
		return -1;
	}

    void *handle = (*types[type].start)(argc[1], buffer, size);

	if (!handle)
	{
		free(buffer);
		printf("ERROR: Engine rejected file!\n");
		return -1;
	}
	
#if 0
	m1sdr_Init(44100);
	m1sdr_SetCallback(do_frame);
	m1sdr_PlayStart();

	printf("\n\nPlaying.  Press CTRL-C to stop.\n");

	while (1)
	{
		m1sdr_TimeCheck();
	}		
#endif
	free(buffer);

	return 1;
}