Ejemplo n.º 1
0
CEmuopl::CEmuopl(int rate, bool bit16, bool usestereo)
  : use16bit(bit16), stereo(usestereo), mixbufSamples(0)
{
  opl[0] = OPLCreate(OPL_TYPE_YM3812, 3579545, rate);
  opl[1] = OPLCreate(OPL_TYPE_YM3812, 3579545, rate);
  mixbuf0 = 0;
  mixbuf1 = 0;

  currType = TYPE_DUAL_OPL2;

  init();
}
Ejemplo n.º 2
0
Y8950* y8950Create(Mixer* mixer)
{
    Y8950* y8950;
    
    y8950 = (Y8950*)calloc(1, sizeof(Y8950));

    y8950->mixer = mixer;
    y8950->timerRunning1 = 0;
    y8950->timerRunning2 = 0;

    y8950->timer1 = boardTimerCreate(onTimeout1, y8950);
    y8950->timer2 = boardTimerCreate(onTimeout2, y8950);
    
    y8950->ykIo = ykIoCreate();

    y8950->handle = mixerRegisterChannel(mixer, MIXER_CHANNEL_MSXAUDIO, 0, y8950Sync, y8950SetSampleRate, y8950);

    y8950->opl = OPLCreate(OPL_TYPE_Y8950, FREQUENCY, SAMPLERATE, 256, y8950);
    OPLSetOversampling(y8950->opl, boardGetY8950Oversampling());
    OPLResetChip(y8950->opl);

    y8950->rate = mixerGetSampleRate(mixer);

    return y8950;
}
Ejemplo n.º 3
0
/**
 * Initializes a new music track.
 * @param volume Music volume modifier (1.0 = 100%).
 */
AdlibMusic::AdlibMusic(float volume) : Music(), _data(0), _size(0), _volume(volume)
{
	rate = Options::audioSampleRate;
	if (!opl[0])
	{
		opl[0] = OPLCreate(OPL_TYPE_YM3812, 3579545, rate);
	}
	if (!opl[1])
	{
		opl[1] = OPLCreate(OPL_TYPE_YM3812, 3579545, rate);
	}
	// magic value - length of 1 tick per samplerate
	if (delayRates.empty())
	{
		delayRates[8000] = 114 * 4;
		delayRates[11025] = 157 * 4;
		delayRates[16000] = 228 * 4;
		delayRates[22050] = 314 * 4;
		delayRates[32000] = 456 * 4;
		delayRates[44100] = 629 * 4;
		delayRates[48000] = 685 * 4;
	}
}