public Sound(Mixer mixer, Disk disk, byte volume) { _skyDisk = disk; _mixer = mixer; SaveSounds[0] = SaveSounds[1] = 0xFFFF; _mainSfxVolume = volume; }
protected MusicBase(Mixer mixer, Disk disk) { _mixer = mixer; _skyDisk = disk; _currentMusic = 0; _musicVolume = 127; _numberOfChannels = _currentMusic = 0; }
public AdLibMusic(Mixer mixer, Disk disk) : base(mixer, disk) { _driverFileBase = 60202; _sampleRate = mixer.OutputRate; _opl = new DosBoxOPL(OplType.Opl2); _opl.Init(_sampleRate); _soundHandle = _mixer.PlayStream(SoundType.Music, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
public Mt32Music(MidiDriver midiDrv, Mixer mixer, Disk disk) : base(mixer, disk) { _driverFileBase = 60200; _midiDrv = midiDrv; var midiRes = _midiDrv.Open(); if (midiRes != 0) throw new InvalidOperationException(string.Format("Can't open midi device. Errorcode: {0}", midiRes)); _timerCount = 0; _midiDrv.SetTimerCallback(this, TimerCall); _midiDrv.SendMt32Reset(); }
public Intro(Disk disk, Screen screen, MusicBase music, Sound sound, Text skyText, Mixer mixer, SkySystem system) { _skyDisk = disk; _skyScreen = screen; _skyMusic = music; _skySound = sound; _skyText = skyText; _mixer = mixer; _system = system; _textBuf = new byte[10000]; _saveBuf = new byte[10000]; }
public SkyEngine(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager, IAudioOutput output, ISaveFileManager saveFileManager, bool debugMode = false) { _system = new SkySystem(gfxManager, inputManager, saveFileManager); _mixer = new Mixer(44100); // HACK: _mixer.Read(new byte[0], 0); output.SetSampleProvider(_mixer); var directory = ServiceLocator.FileStorage.GetDirectoryName(settings.Game.Path); _skyDisk = new Disk(directory); _skySound = new Sound(_mixer, _skyDisk, Mixer.MaxChannelVolume); SystemVars.Instance.GameVersion = _skyDisk.DetermineGameVersion(); // TODO: music var dev = MidiDriver.DetectDevice(MusicDriverTypes.AdLib | MusicDriverTypes.Midi /*| MDT_PREFER_MT32*/, settings.AudioDevice); if (MidiDriver.GetMusicType(dev) == MusicType.AdLib) { SystemVars.Instance.SystemFlags |= SystemFlags.Sblaster; _skyMusic = new AdLibMusic(_mixer, _skyDisk); } else { SystemVars.Instance.SystemFlags |= SystemFlags.Roland; if ((MidiDriver.GetMusicType(dev) == MusicType.MT32)/* || ConfMan.getBool("native_mt32")*/) _skyMusic = new Mt32Music((MidiDriver)MidiDriver.CreateMidi(_mixer, dev), _mixer, _skyDisk); else _skyMusic = new GmMusic((MidiDriver)MidiDriver.CreateMidi(_mixer, dev), _mixer, _skyDisk); } if (IsCDVersion) { // TODO: configuration //if (ConfMan.hasKey("nosubtitles")) //{ // warning("Configuration key 'nosubtitles' is deprecated. Use 'subtitles' instead"); // if (!ConfMan.getBool("nosubtitles")) // _systemVars.systemFlags |= SF_ALLOW_TEXT; //} //if (ConfMan.getBool("subtitles")) // _systemVars.systemFlags |= SF_ALLOW_TEXT; //if (!ConfMan.getBool("speech_mute")) // _systemVars.systemFlags |= SF_ALLOW_SPEECH; } else SystemVars.Instance.SystemFlags |= SystemFlags.AllowText; SystemVars.Instance.SystemFlags |= SystemFlags.PlayVocs; SystemVars.Instance.GameSpeed = 80; _skyCompact = new SkyCompact(); _skyText = new Text(_skyDisk, _skyCompact); _skyMouse = new Mouse(_system, _skyDisk, _skyCompact); _skyScreen = new Screen(_system, _skyDisk, _skyCompact); InitVirgin(); InitItemList(); LoadFixedItems(); _skyLogic = new Logic(_skyCompact, _skyScreen, _skyDisk, _skyText, _skyMusic, _skyMouse, _skySound); _skyMouse.Logic = _skyLogic; _skyScreen.Logic = _skyLogic; _skySound.Logic = _skyLogic; _skyText.Logic = _skyLogic; _skyControl = new Control(_skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _skyCompact, _system); _skyLogic.Control = _skyControl; // TODO: language // TODO: Setup mixer //SyncSoundSettings(); // TODO: debugger //_debugger = new Debugger(_skyLogic, _skyMouse, _skyScreen, _skyCompact); }
public SwordEngine(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager, IAudioOutput output, ISaveFileManager saveFileManager, bool debugMode) { Settings = settings; GraphicsManager = gfxManager; _mixer = new Mixer(44100); // HACK: _mixer.Read(new byte[0], 0); output.SetSampleProvider(_mixer); System = new SwordSystem(gfxManager, inputManager, saveFileManager); var gameId = ((SwordGameDescriptor)settings.Game).GameId; _features = gameId == SwordGameId.Sword1Demo || gameId == SwordGameId.Sword1MacDemo || gameId == SwordGameId.Sword1PsxDemo ? 1U : 0; // TODO: debug // _console = new SwordConsole(this); SystemVars.Platform = settings.Game.Platform; // TODO: // CheckCdFiles(); // TODO: debug(5, "Starting resource manager"); var directory = ServiceLocator.FileStorage.GetDirectoryName(settings.Game.Path); var path = ServiceLocator.FileStorage.Combine(directory, "swordres.rif"); _resMan = new ResMan(directory, path, SystemVars.Platform == Platform.Macintosh); // TODO: debug(5, "Starting object manager"); _objectMan = new ObjectMan(_resMan); _mouse = new Mouse(System, _resMan, _objectMan); _screen = new Screen(directory, System, _resMan, _objectMan); _music = new Music(Mixer, directory); _sound = new Sound(settings, _mixer, _resMan); _menu = new Menu(_screen, _mouse); _logic = new Logic(this, _objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, Mixer); _mouse.UseLogicAndMenu(_logic, _menu); // TODO: //SyncSoundSettings(); SystemVars.JustRestoredGame = 0; SystemVars.CurrentCd = 0; SystemVars.ControlPanelMode = ControlPanelMode.CP_NEWGAME; SystemVars.ForceRestart = false; SystemVars.WantFade = true; //_systemVars.realLanguage = Common::parseLanguage(ConfMan.get("language")); SystemVars.RealLanguage = new CultureInfo("en-GB"); //switch (SystemVars.RealLanguage.TwoLetterISOLanguageName) //{ // case "de": // SystemVars.Language = Language.BS1_GERMAN; // break; // case "fr": // SystemVars.Language = Language.BS1_FRENCH; // break; // case "it": // SystemVars.Language = Language.BS1_ITALIAN; // break; // case "es": // SystemVars.Language = Language.BS1_SPANISH; // break; // case "pt": // SystemVars.Language = Language.BS1_PORT; // break; // case "cz": // SystemVars.Language = Language.BS1_CZECH; // break; // default: // SystemVars.Language = Language.BS1_ENGLISH; // break; //} // TODO: //_systemVars.showText = ConfMan.getBool("subtitles"); SystemVars.PlaySpeech = 1; _mouseState = 0; // Some Mac versions use big endian for the speech files but not all of them. if (SystemVars.Platform == Platform.Macintosh) _sound.CheckSpeechFileEndianness(); _logic.Initialize(); _objectMan.Initialize(); _mouse.Initialize(); _control = new Control(saveFileManager, _resMan, _objectMan, System, _mouse, _sound, _music); }
public Sound(GameSettings settings, Mixer mixer, ResMan resMan) { _mixer = mixer; _resMan = resMan; _settings = settings; _speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192; _fxQueue = new QueueElement[MAX_FXQ_LENGTH]; for (int i = 0; i < _fxQueue.Length; i++) { _fxQueue[i] = new QueueElement(); } }
public static ScummEngine Create(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager, IAudioOutput output, bool debugMode = false) { ScummEngine engine = null; var game = (GameInfo)settings.Game; var mixer = new Mixer(44100); output.SetSampleProvider(mixer); if (game.Version == 0) { engine = new ScummEngine0(settings, gfxManager, inputManager, mixer); } else if ((game.Version == 1) || (game.Version == 2)) { engine = new ScummEngine2(settings, gfxManager, inputManager, mixer); } else if (game.Version == 3) { engine = new ScummEngine3(settings, gfxManager, inputManager, mixer); } else if (game.Version == 4) { engine = new ScummEngine4(settings, gfxManager, inputManager, mixer); } else if (game.Version == 5) { engine = new ScummEngine5(settings, gfxManager, inputManager, mixer); } else if (game.Version == 6) { engine = new ScummEngine6(settings, gfxManager, inputManager, mixer); } else if (game.Version == 7) { engine = new ScummEngine7(settings, gfxManager, inputManager, mixer); } else if (game.Version == 8) { engine = new ScummEngine8(settings, gfxManager, inputManager, mixer); } Instance = engine; engine.DebugMode = debugMode; engine.InitOpCodes(); engine.SetupVars(); engine.ResetScummVars(); return engine; }