Exemplo n.º 1
0
FluidPlayer::FluidPlayer()
{
    //MIDI params
    midiOut.listPorts(); // via instance
    midiIn.listPorts(); // via instance

    midiOut.openPort("passthrough_in");	// by name
    midiIn.openPort("passthrough_out");	// by name
    //midiOut.openPort("Network Sonoromancer_host");
    //midiIn.openPort("Network Sonoromancer_host");

    midiIn.ignoreTypes(false, false, false);
    midiIn.addListener(this);

    baseNoteMessageLength = DEMISEMIQUAVER;
    upperTimesig = 4;
    lowerTimesig = 4;
    currentInstrumentIndex = 0;

    loadInstruments();
    loadScales();

    setRootNote(NOTE_C);
    setScale( getScaleByName("Minor"));

    setInstrument( instrumentList[0] );
}
Exemplo n.º 2
0
SoundGen2GS::SoundGen2GS(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) {
	_disabledMidi = !loadInstruments();

	_playingSound = -1;
	_playing = false;

	_sndBuffer = (int16 *)calloc(2, BUFFER_SIZE);

	_midiChannels.resize(16); // Set the amount of available MIDI channels

	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
Exemplo n.º 3
0
bool SoundTowns::init() {
	_vm->checkCD();
	int unused = 0;
	_musicFadeTable = _vm->staticres()->loadRawData(k1TownsMusicFadeTable, unused);
	_sfxWDTable = _vm->staticres()->loadRawData(k1TownsSFXwdTable, unused);
	_sfxBTTable = _vm->staticres()->loadRawData(k1TownsSFXbtTable, unused);
	_musicTrackData = new uint8[50570];

	if (!_driver->init())
		return false;

	if (!loadInstruments())
		return false;

	_driver->intf()->callback(68);
	_driver->intf()->callback(70, 0x33);
	_driver->setOutputVolume(1, 118, 118);

	return true;
}
Exemplo n.º 4
0
Arquivo: main.cpp Projeto: cyxx/rawgl
void Player::loadSfxModule(int num) {
	char path[MAXPATHLEN];
	snprintf(path, sizeof(path), kSfxFilePath, num);
	_sfxMod.buf = readFile(path);
	if (_sfxMod.buf.buf) {
		uint8_t *p = _sfxMod.buf.buf;
		_sfxMod.curOrder = 0;
		_sfxMod.numOrder = READ_BE_UINT16(p + 0x3E);
		fprintf(stdout, "curOrder = 0x%X numOrder = 0x%X\n", _sfxMod.curOrder, _sfxMod.numOrder);
		for (int i = 0; i < 0x80; ++i) {
			_sfxMod.orderTable[i] = *(p + 0x40 + i);
		}
		_delay = READ_BE_UINT16(p);
//		_delay = 15700;
		_delay = _delay * 60 / 7050;
		_bufData = p + 0xC0;
		fprintf(stdout, "eventDelay = %d\n", _delay);
		loadInstruments(p + 2);
		stop();
		start();
	}
}
Exemplo n.º 5
0
bool SoundTowns::init() {
	_vm->checkCD();
	int unused = 0;
	_musicFadeTable = _vm->staticres()->loadRawData(k1TownsMusicFadeTable, unused);
	_sfxWDTable = _vm->staticres()->loadRawData(k1TownsSFXwdTable, unused);
	_sfxBTTable = _vm->staticres()->loadRawData(k1TownsSFXbtTable, unused);
	_musicTrackData = new uint8[50570];

	if (!_player->init())
		return false;

	if (!loadInstruments())
		return false;

	/*_player->driver()->intf()->callback(68);
	_player->driver()->intf()->callback(70, 0x33);*/
	_player->driver()->setOutputVolume(1, 118, 118);

	// Initialize CD for audio
	g_system->getAudioCDManager()->open();

	return true;
}
Exemplo n.º 6
0
SoundGen2GS::SoundGen2GS(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMixer) {
	// Allocate memory for the wavetable
	_wavetable = new int8[SIERRASTANDARD_SIZE];

	// Apple IIGS AGI MIDI player advances 60 ticks per second. Strategy
	// here is to first generate audio for a 1/60th of a second and then
	// advance the MIDI player by one tick. Thus, make the output buffer
	// to be a 1/60th of a second in length.
	_outSize = _sampleRate / 60;
	_out = new int16[2 * _outSize]; // stereo

	// Initialize player variables
	_nextGen = 0;
	_ticks = 0;

	// Not playing anything yet
	_playingSound = -1;
	_playing = false;

	// Load instruments
	_disableMidi = !loadInstruments();

	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}