Beispiel #1
0
static void pipe_Exit(void)
{
#if defined unix || (defined __APPLE__ && defined __MACH__)
	int pstat;
	pid_t pid2;
#endif

	VC_Exit();
	MikMod_free(audiobuffer);
	if(pipeout) {
		_mm_delete_file_writer(pipeout);
		pipeout=NULL;
	}
	if(pipefile) {
#if !defined unix && (!defined __APPLE__ || !defined __MACH__)
#ifdef __WATCOMC__
		_pclose(pipefile);
#else
		pclose(pipefile);
#endif
#ifdef __EMX__
		_fsetmode(stdout,"t");
#endif
#else
		fclose(pipefile);
		do {
			pid2=waitpid(pid,&pstat,0);
		} while (pid2==-1 && errno==EINTR);
#endif
		pipefile=NULL;
	}
}
Beispiel #2
0
static int WAV_Init(void)
{
#if (MIKMOD_UNIX)
	if (!MD_Access(filename?filename:FILENAME)) {
		_mm_errno=MMERR_OPENING_FILE;
		return 1;
	}
#endif

	if(!(wavfile=fopen(filename?filename:FILENAME,"wb"))) {
		_mm_errno=MMERR_OPENING_FILE;
		return 1;
	}
	if(!(wavout=_mm_new_file_writer (wavfile))) {
		fclose(wavfile);unlink(filename?filename:FILENAME);
		wavfile=NULL;
		return 1;
	}
	if(!(audiobuffer=(SBYTE*)MikMod_malloc(BUFFERSIZE))) {
		_mm_delete_file_writer(wavout);
		fclose(wavfile);unlink(filename?filename:FILENAME);
		wavfile=NULL;wavout=NULL;
		return 1;
	}

	md_mode|=DMODE_SOFT_MUSIC|DMODE_SOFT_SNDFX;

	if (VC_Init()) {
		_mm_delete_file_writer(wavout);
		fclose(wavfile);unlink(filename?filename:FILENAME);
		wavfile=NULL;wavout=NULL;
		return 1;
	}
	dumpsize=0;
	putheader();

	return 0;
}
Beispiel #3
0
static void WAV_Exit(void)
{
	VC_Exit();

	/* write in the actual sizes now */
	if(wavout) {
		putheader();
		_mm_delete_file_writer(wavout);
		fclose(wavfile);
		wavfile=NULL;wavout=NULL;
	}
	MikMod_free(audiobuffer);
	audiobuffer=NULL;
}