shithub: ft2-clone

ref: 252fc5e9896155c03e4e8642092589c9b7e4fec3
dir: /src/smploaders/ft2_load_raw.c/

View raw version
// RAW (header-less) sample loader

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "../ft2_header.h"
#include "../ft2_sample_ed.h"
#include "../ft2_sysreqs.h"
#include "../ft2_sample_loader.h"

bool loadRAW(FILE *f, uint32_t filesize)
{
	if (!allocateTmpSmpData(&tmpSmp, filesize))
	{
		loaderMsgBox("Not enough memory!");
		return false;
	}

	if (fread(tmpSmp.pek, filesize, 1, f) != 1)
	{
		okBoxThreadSafe(0, "System message", "General I/O error during loading! Is the file in use?");
		return false;
	}

	tmpSmp.len = filesize;
	tmpSmp.vol = 64;
	tmpSmp.pan = 128;

	return true;
}