public GeneticAlgorithm(INeuralNetworkConverter converter, IMutator mutator, IMixer mixer, ISelector selector) { this.converter = converter; this.mutator = mutator; this.mixer = mixer; this.selector = selector; }
void ICanvas3DControl.OnLoaded() { try { this.Renderer = this.info.RenderFactory.Open(this.info.XwtRender, this, this, this.impl.FPS, this.impl.VideoSize); this.Audio = new AudioOut(48000, AudioFormat.Float32, ChannelsLayout.Stereo, 2); this.Mixer = new Mixer(this.Audio.SampleRate, this.Audio.Format, this.Audio.ChannelLayout); this.impl.OnLoaded(false); using (var lck = this.Renderer.GetDrawLock()) { this.impl.OnLoaded(true); } //this.Display.WaitBuffered(); // this.Audio?.Buffered.WaitOne(-1, false); //this.movie.p } catch (Exception e) { throw; } }
void ICanvas3DControl.Unloading() { if (this.Renderer != null) { this.Renderer.Stop(); this.Audio?.Stop(); this.impl.Stop(); this.impl.Unloading(false); this.Mixer?.Dispose(); this.Mixer = null; this.Audio?.Dispose(); this.Audio = null; using (var lck = this.Renderer.GetDrawLock()) { this.impl.Unloading(true); } this.Renderer.Dispose(); this.Renderer = null; } }
public Player_V2(ScummEngine scumm, IMixer mixer, bool pcjr) : base(scumm, mixer, pcjr) { // Initialize square generator _level = 0; _RNG = NG_PRESET; if (_pcjr) { _decay = PCJR_DECAY; _update_step = (((uint)_sampleRate << FIXP_SHIFT) / (111860 * 2)); } else { _decay = SPK_DECAY; _update_step = (((uint)_sampleRate << FIXP_SHIFT) / (1193000 * 2)); } // Adapt _decay to sample rate. It must be squared when // sample rate doubles. for (var i = 0; (_sampleRate << i) < 30000; i++) _decay = _decay * _decay / 65536; _timer_output = 0; for (var i = 0; i < 4; i++) _timer_count[i] = 0; SetMusicVolume(255); _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
protected Player_V2Base(ScummEngine scumm, IMixer mixer, bool pcjr) { _vm = scumm; _mixer = mixer; _pcjr = pcjr; _sampleRate = _mixer.OutputRate; _isV3Game = (scumm.Game.Version >= 3); _header_len = scumm.Game.IsOldBundle ? 4 : 6; // Initialize sound queue _current_nr = _next_nr = 0; _current_data = _next_data = null; // Initialize channel code for (int i = 0; i < 4; ++i) ClearChannel(i); _next_tick = 0; _tick_len = (uint)(_sampleRate << FIXP_SHIFT) / FREQ_HZ; // Initialize V3 music timer _music_timer_ctr = _music_timer = 0; _ticks_per_music_timer = 65535; if (_pcjr) { _freqs_table = pcjr_freq_table; } else { _freqs_table = spk_freq_table; } }
public PsxStreamDecoder(IMixer mixer, CDSpeed speed, PixelFormat screenFormat, uint frameCount = 0) { _mixer = mixer; _speed = speed; _screenFormat = screenFormat; _frameCount = frameCount; }
public SmackerAudioTrack(IMixer mixer, AudioInfo audioInfo, SoundType soundType) { _mixer = mixer; _audioInfo = audioInfo; _soundType = soundType; _audioStream = new QueuingAudioStream((int)_audioInfo.sampleRate, _audioInfo.isStereo); }
public Player_SID(ScummEngine scumm, IMixer mixer, ISid sid) { _sid = sid; for (int i = 0; i < 7; ++i) { _soundQueue[i] = -1; } _mixer = mixer; _sampleRate = _mixer.OutputRate; _vm = scumm; // sound speed is slightly different on NTSC and PAL machines // as the SID clock depends on the frame rate. // ScummVM does not distinguish between NTSC and PAL targets // so we use the NTSC timing here as the music was composed for // NTSC systems (music on PAL systems is slower). _videoSystem = VideoStandard.Ntsc; resStatus[1] = 0; resStatus[2] = 0; InitSID(); ResetSID(); _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
public SmackerAudioTrack(IMixer mixer, AudioInfo audioInfo, SoundType soundType) { Mixer = mixer; _audioInfo = audioInfo; SoundType = soundType; _audioStream = new QueuingAudioStream((int)_audioInfo.sampleRate, _audioInfo.isStereo); }
public MidiDriver_TOWNS(IMixer mixer) { _baseTempo = 10080; _rand = 1; // We set exteral mutex handling to true to avoid lockups in SCUMM which has its own mutex. _intf = new TownsAudioInterface(mixer, this, true); _channels = new TownsMidiInputChannel[32]; for (int i = 0; i < 32; i++) _channels[i] = new TownsMidiInputChannel(this, i > 8 ? (i + 1) : i); _out = new TownsMidiOutputChannel[6]; for (int i = 0; i < 6; i++) { _out[i] = new TownsMidiOutputChannel(this, i); } _chanState = new TownsMidiChanState[32]; for (int i = 0; i < _chanState.Length; i++) { _chanState[i] = new TownsMidiChanState(); } _operatorLevelTable = new byte[2048]; for (int i = 0; i < 64; i++) { for (int ii = 0; ii < 32; ii++) _operatorLevelTable[(i << 5) + ii] = (byte)(((i * (ii + 1)) >> 5) & 0xff); } for (int i = 0; i < 64; i++) _operatorLevelTable[i << 5] = 0; }
public Player_V3M(ScummEngine scumm, IMixer mixer) : base(scumm, mixer, 5, 0x1E, true) { // Channel 0 seems to be what was played on low-end macs, that couldn't // handle multi-channel music and play the game at the same time. I'm // not sure if stream 4 is ever used, but let's use it just in case. }
public TransitionQueueElement(ISource <Frame> source1, ISource <Frame> source2, IMixer mixer, TimeSpan duration) { _source1 = source1; _source2 = source2; Mixer = mixer; Duration = duration; }
internal void OnUnloading() { if (this.Renderer != null) { this.audiostop.Set(); this.Renderer.Stop(); this.Audio?.Stop(); this.MoviePlayer?.Stop(); try { this.audiothread.Join(); } catch { } this.MoviePlayer?.Dispose(); this.MoviePlayer = null; this.Mixer?.Dispose(); this.Mixer = null; this.Audio?.Dispose(); this.Audio = null; using (var lck = this.Renderer.GetDrawLock()) { this.shader?.Dispose(); this.vertices?.Dispose(); this.shadertex?.Dispose(); this.verticestex?.Dispose(); } this.Renderer.Dispose(); this.Renderer = null; } }
public Player_Towns_v2(ScummEngine vm, IMixer mixer, IIMuse imuse, bool disposeIMuse) : base(vm, true) { _imuse = imuse; _imuseDispose = disposeIMuse; _soundOverride = new SoundOvrParameters[_numSoundMax]; _intf = new TownsAudioInterface(mixer, null); }
public Player_AppleII(ScummEngine scumm, IMixer mixer) { _mixer = mixer; _vm = scumm; _sampleConverter = new SampleConverter(); ResetState(); SetSampleRate(_mixer.OutputRate); _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
public AudioStream open_audio(uint ind, IMixer mixer, AudioStream.FrameReadyFunction frameready) { Trace.Assert(!this.audiostreams.Any(_stream => _stream.info.ind == this.AudioStreams[ind].info.ind)); var result = this.AudioStreams[ind].open(mixer.SampleRate, mixer.Format, mixer.ChannelLayout, frameready); this.audiostreams.Add(result); return(result); }
public PCSpeakerDriver(IMixer mixer) : base(mixer) { _pcSpk = new PCSpeaker(mixer.OutputRate); for (int i = 0; i < _channels.Length; i++) { _channels[i] = new MidiChannelPcSpk(); } }
public Sound(ScummEngine vm, IMixer mixer) { this.vm = vm; soundQueue = new Stack <int>(); soundQueueIMuse = new Queue <int>(); timer = new Timer(OnCDTimer, this, -1, -1); // initialize output & player _mixer = mixer; }
public Player_Towns_v1(ScummEngine vm, IMixer mixer) : base(vm, false) { if (_vm.Game.Version == 3) { _soundOverride = new SoundOvrParameters[_numSoundMax]; } _driver = new TownsEuphonyDriver(mixer); }
public Sound(ScummEngine vm, IMixer mixer) { this.vm = vm; soundQueue = new Stack<int>(); soundQueueIMuse = new Queue<int>(); timer = new Timer(OnCDTimer, this, -1, -1); // initialize output & player _mixer = mixer; }
public SmushMixer(IMixer mixer) { _mixer = mixer; for (var i = 0; i < _channels.Length; i++) { _channels[i] = new Channel(); _channels[i].Id = -1; _channels[i].Chan = null; _channels[i].Stream = null; } }
public Player_V1(ScummEngine scumm, IMixer mixer, bool pcjr) : base(scumm, mixer, pcjr) { // Initialize channel code for (int i = 0; i < 4; ++i) ClearChannel(i); _mplex_step = (uint)(_sampleRate << FIXP_SHIFT) / 1193000; _next_chunk = _repeat_chunk = 0; _forced_level = 0; _random_lsr = 0; }
public Music(IMixer mixer, string directory) { _mixer = mixer; _sampleRate = mixer.OutputRate; _volumeL = _volumeR = 192; _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); _handles = new MusicHandle[2]; for (int i = 0; i < _handles.Length; i++) { _handles[i] = new MusicHandle(directory); } }
public Player_Mac(ScummEngine scumm, IMixer mixer, int numberOfChannels, int channelMask, bool fadeNoteEnds) { _vm = scumm; _mixer = mixer; _sampleRate = _mixer.OutputRate; _soundPlaying = -1; _numberOfChannels = numberOfChannels; _channelMask = channelMask; _fadeNoteEnds = fadeNoteEnds; Debug.Assert(scumm != null); Debug.Assert(mixer != null); Init(); }
public Player_V1(ScummEngine scumm, IMixer mixer, bool pcjr) : base(scumm, mixer, pcjr) { // Initialize channel code for (int i = 0; i < 4; ++i) { ClearChannel(i); } _mplex_step = (uint)(_sampleRate << FIXP_SHIFT) / 1193000; _next_chunk = _repeat_chunk = 0; _forced_level = 0; _random_lsr = 0; }
public DefaultAudioCDManager(ScummEngine vm, IMixer mixer) { _vm = vm; _cd.playing = false; _cd.track = 0; _cd.start = 0; _cd.duration = 0; _cd.numLoops = 0; _cd.volume = Mixer.MaxChannelVolume; _cd.balance = 0; _mixer = mixer; _emulating = false; Debug.Assert(_mixer != null); }
/// <summary> /// Create music driver matching the given device handle, or NULL if there is no match. /// </summary> /// <returns>The midi.</returns> /// <param name = "mixer"></param> /// <param name="handle">Handle.</param> public static IMidiDriver CreateMidi(IMixer mixer, DeviceHandle handle) { IMidiDriver driver = null; var plugins = MusicManager.GetPlugins(); foreach (var m in plugins) { if (GetDeviceString(handle, DeviceStringType.DriverId) == m.Id) { driver = m.CreateInstance(mixer, handle); } } return(driver); }
public Player_MOD(IMixer mixer) { _mixer = mixer; _sampleRate = mixer.OutputRate; for (var i = 0; i < MOD_MAXCHANS; i++) { _channels[i].id = 0; _channels[i].vol = 0; _channels[i].freq = 0; _channels[i].input = null; _channels[i].ctr = 0; _channels[i].pos = 0; } _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
public Player_AD(ScummEngine scumm, IMixer mixer) { _vm = scumm; _mixer = mixer; _rate = mixer.OutputRate; // TODO: vs OPL // _opl2 = OPL::Config::create(); _opl2 = new DosBoxOPL(OplType.Opl2); _opl2.Init(_rate); _samplesPerCallback = _rate / AD_CALLBACK_FREQUENCY; _samplesPerCallbackRemainder = _rate % AD_CALLBACK_FREQUENCY; _samplesTillCallback = 0; _samplesTillCallbackRemainder = 0; WriteReg(0x01, 0x00); WriteReg(0xBD, 0x00); WriteReg(0x08, 0x00); WriteReg(0x01, 0x20); _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); _engineMusicTimer = 0; _soundPlaying = -1; _curOffset = 0; _sfxTimer = 4; _rndSeed = 1; for (int i = 0; i < _sfx.Length; ++i) { _sfx[i] = new SfxSlot(); _sfx[i].Resource = -1; for (int j = 0; j < _sfx[i].Channels.Length; ++j) { _sfx[i].Channels[j].HardwareChannel = -1; } } _numHWChannels = _hwChannels.Length; _musicVolume = _sfxVolume = 255; _isSeeking = false; }
public Player_V4A(ScummEngine scumm, IMixer mixer) { _vm = scumm; _mixer = mixer; _tfmxMusic = new Tfmx(_mixer.OutputRate, true); _tfmxSfx = new Tfmx(_mixer.OutputRate, true); Debug.Assert(scumm != null); Debug.Assert(mixer != null); Debug.Assert(_vm.Game.GameId == GameId.Monkey1); _tfmxMusic.SetSignalAction((num, value) => { if (num == 0) { _signal = value; } }); }
public static TownsAudioInterfaceInternal AddNewRef(IMixer mixer, TownsAudioInterface owner, ITownsAudioInterfacePluginDriver driver, bool externalMutexHandling) { _refCount++; if (_refCount == 1 && _refInstance == null) { _refInstance = new TownsAudioInterfaceInternal(mixer, owner, driver, externalMutexHandling); } else if (_refCount < 2 || _refInstance == null) { throw new InvalidOperationException("TownsAudioInterfaceInternal::addNewRef(): Internal reference management failure"); } else if (!_refInstance.AssignPluginDriver(owner, driver, externalMutexHandling)) { throw new InvalidOperationException("TownsAudioInterfaceInternal::addNewRef(): Plugin driver conflict"); } return(_refInstance); }
protected TownsPC98_FmSynth(IMixer mixer, FmSynthEmuType type, bool externalMutexHandling = false) { _mixer = mixer; _numChan = type == FmSynthEmuType._26 ? 3 : 6; _numSSG = type == FmSynthEmuType.Towns ? 0 : 3; _hasPercussion = type == FmSynthEmuType._26; _rtt = type == FmSynthEmuType.Towns ? 0x514767 : 0x5B8D80; _baserate = 55125.0f / mixer.OutputRate; _volumeA = 255; _volumeB = 255; _externalMutex = externalMutexHandling; for (int i = 0; i < _timers.Length; i++) { _timers[i] = new ChipTimer(); } _timers[0].cb = _timers[1].cb = IdleTimerCallback; _timerbase = (uint)(_baserate * 1000000.0f); }
public PsxAudioTrack(IMixer mixer, Stream sector) { _mixer = mixer; _endOfTrack = false; _adpcmStatus = new ADPCMStatus[2]; for (int i = 0; i < _adpcmStatus.Length; i++) { _adpcmStatus[i] = new ADPCMStatus(); } sector.Seek(19, SeekOrigin.Begin); byte format = (byte)sector.ReadByte(); bool stereo = (format & (1 << 0)) != 0; int rate = ((format & (1 << 2)) != 0) ? 18900 : 37800; _audStream = new QueuingAudioStream(rate, stereo); _dst = new byte[AUDIO_DATA_SAMPLE_COUNT * 2]; _buf = new byte[AUDIO_DATA_CHUNK_SIZE]; }
public ParserHandlerTests() { var mixers = new IMixer[] { new EqualLengthMixer(), new SingleVerseNumberMixer(), new LastMixer(), }; var booksJson = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Dictionary", "book-names.json")); var booksSettings = JsonConvert.DeserializeObject <BooksSettings>(booksJson); var books = Options.Create(booksSettings); var sectionsJson = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Dictionary", "sections.json")); var sectionsSettings = JsonConvert.DeserializeObject <SectionsSettings>(sectionsJson); var sections = Options.Create(sectionsSettings); var bibleAnalyser = new BibleAnalyser(new Bible(books, sections)); _parserHandler = new ParserHandler(new MixerFactory(mixers), bibleAnalyser); }
public IMuseDigital(ScummEngine7 scumm, IMixer mixer, int fps) { _vm = scumm; _mixer = mixer; _pause = false; _sound = new ImuseDigiSndMgr(_vm); Debug.Assert(_sound != null); _callbackFps = fps; ResetState(); for (int l = 0; l < MaxDigitalTracks + MaxDigitalFadeTracks; l++) { _track[l] = new Track(); _track[l].TrackId = l; } _timer = new Timer(new TimerCallback(o => Callback()), this, TimeSpan.Zero, TimeSpan.FromMilliseconds(1000 / _callbackFps)); _audioNames = null; _numAudioNames = 0; }
public MidiDriver_TOWNS(IMixer mixer) { _baseTempo = 10080; _rand = 1; // We set exteral mutex handling to true to avoid lockups in SCUMM which has its own mutex. _intf = new TownsAudioInterface(mixer, this, true); _channels = new TownsMidiInputChannel[32]; for (int i = 0; i < 32; i++) { _channels[i] = new TownsMidiInputChannel(this, i > 8 ? (i + 1) : i); } _out = new TownsMidiOutputChannel[6]; for (int i = 0; i < 6; i++) { _out[i] = new TownsMidiOutputChannel(this, i); } _chanState = new TownsMidiChanState[32]; for (int i = 0; i < _chanState.Length; i++) { _chanState[i] = new TownsMidiChanState(); } _operatorLevelTable = new byte[2048]; for (int i = 0; i < 64; i++) { for (int ii = 0; ii < 32; ii++) { _operatorLevelTable[(i << 5) + ii] = (byte)(((i * (ii + 1)) >> 5) & 0xff); } } for (int i = 0; i < 64; i++) { _operatorLevelTable[i << 5] = 0; } }
protected Player_V2Base(ScummEngine scumm, IMixer mixer, bool pcjr) { _vm = scumm; _mixer = mixer; _pcjr = pcjr; _sampleRate = _mixer.OutputRate; _isV3Game = (scumm.Game.Version >= 3); _header_len = scumm.Game.IsOldBundle ? 4 : 6; // Initialize sound queue _current_nr = _next_nr = 0; _current_data = _next_data = null; // Initialize channel code for (int i = 0; i < 4; ++i) { ClearChannel(i); } _next_tick = 0; _tick_len = (uint)(_sampleRate << FIXP_SHIFT) / FREQ_HZ; // Initialize V3 music timer _music_timer_ctr = _music_timer = 0; _ticks_per_music_timer = 65535; if (_pcjr) { _freqs_table = pcjr_freq_table; } else { _freqs_table = spk_freq_table; } }
public Player(MainWindow mainwindow, string filename, long timebase) { try { this.timebase = timebase; this.renderer = mainwindow.Renderer; this.audioout = mainwindow.Audio; this.mixer = mainwindow.Mixer; this.player = BaseLib.Media.MoviePlayer.Open(() => { }, filename); try { if (player.VideoStreams.Length > 0) { this.video = player.open_video(0, frameready); } if (player.AudioStreams.Length > 0) { this.audio = player.open_audio(0, mainwindow.Mixer, audioready); this.audiobuffer = new FifoStream(mainwindow.Audio.SampleSize * mainwindow.Audio.SampleRate * 3); this.mixer.Register(this.audiobuffer, this.audioout.Channels, false); } this.player.start(0, timebase); } catch { Dispose(true); GC.SuppressFinalize(this); throw; } } catch { GC.SuppressFinalize(this); throw; } }
public ScummEngine7(GameSettings game, IGraphicsManager graphicsManager, IInputManager inputManager, IMixer mixer) : base(game, graphicsManager, inputManager, mixer) { if (Game.GameId == GameId.Dig && (Game.Features.HasFlag(GameFeatures.Demo))) _smushFrameRate = 15; else _smushFrameRate = (Game.GameId == GameId.FullThrottle) ? 10 : 12; for (int i = 0; i < _subtitleQueue.Length; i++) { _subtitleQueue[i] = new SubtitleText(); } int dimuseTempo = 10; MusicEngine = IMuseDigital = new IMuseDigital(this, mixer, dimuseTempo); IMuseDigital.SetAudioNames(ResourceManager.AudioNames); // Create FT INSANE object if (Game.GameId == GameId.FullThrottle) Insane = new Insane.Insane(this); SmushMixer = new SmushMixer(Mixer); SmushPlayer = new SmushPlayer(this); }
public Player_V2(ScummEngine scumm, IMixer mixer, bool pcjr) : base(scumm, mixer, pcjr) { // Initialize square generator _level = 0; _RNG = NG_PRESET; if (_pcjr) { _decay = PCJR_DECAY; _update_step = (((uint)_sampleRate << FIXP_SHIFT) / (111860 * 2)); } else { _decay = SPK_DECAY; _update_step = (((uint)_sampleRate << FIXP_SHIFT) / (1193000 * 2)); } // Adapt _decay to sample rate. It must be squared when // sample rate doubles. for (var i = 0; (_sampleRate << i) < 30000; i++) { _decay = _decay * _decay / 65536; } _timer_output = 0; for (var i = 0; i < 4; i++) { _timer_count[i] = 0; } SetMusicVolume(255); _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
public override IMidiDriver CreateInstance(IMixer mixer, DeviceHandle handle) { return new NullMidiDriver(); }
public ScummEngine8(GameSettings game, IGraphicsManager graphicsManager, IInputManager inputManager, IMixer mixer) : base(game, graphicsManager, inputManager, mixer) { }
public abstract IMidiDriver CreateInstance(IMixer mixer, DeviceHandle handle);
public override IMidiDriver CreateInstance(IMixer mixer, DeviceHandle handle) { return new PCSpeakerDriver(mixer); }
/// <summary> /// Create music driver matching the given device handle, or NULL if there is no match. /// </summary> /// <returns>The midi.</returns> /// <param name = "mixer"></param> /// <param name="handle">Handle.</param> public static IMidiDriver CreateMidi(IMixer mixer, DeviceHandle handle) { IMidiDriver driver = null; var plugins = MusicManager.GetPlugins(); foreach (var m in plugins) { if (GetDeviceString(handle, DeviceStringType.DriverId) == m.Id) driver = m.CreateInstance(mixer, handle); } return driver; }
public ScummEngine2(GameSettings game, IGraphicsManager graphicsManager, IInputManager inputManager, IMixer mixer) : base(game, graphicsManager, inputManager, mixer) { _flashlight.XStrips = 7; _flashlight.YStrips = 7; /*if (Game.Platform == Platform.NES) { InitNESMouseOver(); _switchRoomEffect2 = _switchRoomEffect = 6; } else*/ { InitV2MouseOver(); // Seems in V2 there was only a single room effect (iris), // so we set that here. _switchRoomEffect2 = 1; _switchRoomEffect = 5; } _inventoryOffset = 0; VariableSentenceVerb = null; VariableSentenceObject1 = null; VariableSentenceObject2 = null; VariableSentencePreposition = null; VariableBackupVerb = null; VariableClickArea = null; VariableClickVerb = null; VariableClickObject = null; }
public TownsEuphonyDriver(IMixer mixer) { _intf = new TownsAudioInterface(mixer, this); ResetTempo(); }