예제 #1
0
파일: emuadpcm.c 프로젝트: arouge/msxplug
EMU8950_ADPCM_API ADPCM *
ADPCM_new (e_uint32 clk, e_uint32 rate)
{
  ADPCM *_this;

  _this = (ADPCM *) malloc (sizeof (ADPCM));
  if (!_this)
    return NULL;

  _this->clk = clk;
  _this->rate = rate ? rate : 44100;

  /* 256Kbytes RAM */
  _this->memory[0] = (e_uint8 *) malloc (256 * 1024);
  if (!_this->memory[0])
    goto Error_Exit;
  memset (_this->memory[0], 0, 256 * 1024);

  /* 256Kbytes ROM */
  _this->memory[1] = (e_uint8 *) malloc (256 * 1024);
  if (!_this->memory[1])
    goto Error_Exit;
  memset (_this->memory[1], 0, 256 * 1024);

  ADPCM_reset (_this);

  return _this;

Error_Exit:
  ADPCM_delete (_this);
  return NULL;
}
예제 #2
0
EMU8950_ADPCM_API ADPCM *ADPCM_new(void)
{
  ADPCM *_this;

  _this = malloc(sizeof(ADPCM));
  if(!_this) return NULL;

  /* 256Kbytes RAM */
  _this->memory[0] = malloc(256*1024);
  if(!_this->memory[0]) goto Error_Exit;
  memset(_this->memory[0],0,256*1024);

  /* 256Kbytes ROM */
  _this->memory[1] = malloc(256*1024);
  if(!_this->memory[1]) goto Error_Exit;
  memset(_this->memory[1],0,256*1024);

  ADPCM_reset(_this);

  return _this;

Error_Exit:
  ADPCM_delete(_this);
  return NULL;
}