Пример #1
0
    void __declspec(dllexport) DLL_StartPlayback(int sid, int track)
    {
      WaitForSingleObject(hMutex,INFINITE);
      SSid* result = (SSid*)sid;

      result->tune.selectSong(track);
      result->player.load(&result->tune);
      result->config.clockDefault = SID2_CLOCK_PAL;
      result->config.clockForced = false;
      result->config.clockSpeed = SID2_CLOCK_CORRECT;
      result->config.emulateStereo = true;
      result->config.environment = sid2_envR;
      result->config.forceDualSids = false;
      result->config.frequency = 48000;
      result->config.leftVolume = 255;
      result->config.optimisation = SID2_DEFAULT_OPTIMISATION;
      result->config.playback = sid2_stereo;
      result->config.powerOnDelay = SID2_DEFAULT_POWER_ON_DELAY;
      result->config.precision = 16;
      result->config.rightVolume = 255;
      result->config.sampleFormat = SID2_LITTLE_SIGNED;
      if (!result->config.sidEmulation)
      {
        ReSIDBuilder* rs = new ReSIDBuilder("Resid Builder");
        rs->create (result->player.info().maxsids);
        rs->filter(false);
        rs->sampling(48000);
        result->config.sidEmulation = rs;
      }

      result->player.config(result->config);
      result->player.fastForward(100*32);
      ReleaseMutex(hMutex);
    }
Пример #2
0
  void *sidcxx_load(const void *data, int length, int subsong, char *errbuf, 
		    size_t errlen)
  {
    struct sidwrap *sw = new sidwrap();

    memset(&sw->conf, 0, sizeof(sid2_config_t));

    if(!sw->st.read((const uint_least8_t *)data, length)) {
      delete sw;
      snprintf(errbuf, errlen, "Unable to read data");
      return NULL;
    }

    sw->p.debug(true, stderr);

    sw->st.selectSong(subsong);
    if(sw->p.load(&sw->st)) {
      snprintf(errbuf, errlen, "Unable to load");
      return NULL;
    }



    ReSIDBuilder *rs = new ReSIDBuilder("ReSID");
    if(!rs || !*rs) {
      snprintf(errbuf, errlen, "Unable to create SID emulator");
      return NULL;
    }
    rs->create(sw->p.info().maxsids);
    if(!*rs) {
      snprintf(errbuf, errlen, "Unable to config SID emulator");
      return NULL;
    }
    rs->filter(false);
    if(!*rs) {
      snprintf(errbuf, errlen, "Unable to config SID emulator (filter)");
      return NULL;
    }
    rs->sampling(44100);
    if(!*rs) {
      snprintf(errbuf, errlen, "Unable to config SID emulator (samplerate)");
      return NULL;
    }

    sw->conf = sw->p.config();
    sw->conf.frequency    = 44100;
    sw->conf.precision    = 16;
    sw->conf.playback     = sid2_stereo;
    sw->conf.sampleFormat = SID2_LITTLE_SIGNED;

    /* These should be configurable ... */
    sw->conf.clockSpeed    = SID2_CLOCK_CORRECT;
    sw->conf.clockForced   = true;
    sw->conf.sidModel      = SID2_MODEL_CORRECT;
    sw->conf.optimisation  = SID2_DEFAULT_OPTIMISATION;
    sw->conf.sidSamples    = true;
    sw->conf.clockDefault  = SID2_CLOCK_PAL;
    sw->conf.sidDefault    = SID2_MOS6581;

    sw->conf.sidEmulation = rs;

    int r = sw->p.config(sw->conf);
    if(r) {
      snprintf(errbuf, errlen, "Unable to config SID player");
      return NULL;
    }
    return sw;
  }