public SinglePlayerStartScreen([NotNull] ISoundPlayer soundPlayer) { if (soundPlayer == null) { throw new ArgumentNullException("soundPlayer"); } _soundPlayer = soundPlayer; InitializeComponent(); GameContext.PushThreadContext(new GameContext()); try { DataContext = CivDatabase.Load() .Where(civ => civ.CivilizationType == CivilizationType.Empire) .ToList(); CivSelector.SelectionChanged += CivSelector_SelectionChanged; //Select Federation to begin with List <Civilization> tmp = (List <Civilization>)DataContext; CivSelector.SelectedIndex = 0; } finally { GameContext.PopThreadContext(); } }
public MessageUserControlViewModel(ITranslationUpdater translationUpdater, ISoundPlayer soundPlayer) : base(translationUpdater) { _soundPlayer = soundPlayer; ButtonRightCommand = new DelegateCommand(ExecuteButtonRight, CanExecuteButtonRight); ButtonLeftCommand = new DelegateCommand(ExecuteButtonLeft); }
public void Setup() { _camera = Substitute.For <ICamera>(); _soundPlayer = Substitute.For <ISoundPlayer>(); _uut = new CameraViewModel(_camera, _soundPlayer); _obj = new object(); }
public MessageWindowViewModel(ITranslator translator, ISoundPlayer soundPlayer) { _translator = translator; _soundPlayer = soundPlayer; ButtonRightCommand = new DelegateCommand(ExecuteButtonRight, CanExecuteButtonRight); ButtonLeftCommand = new DelegateCommand(ExecuteButtonLeft); }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); ISoundPlayer pl = ISoundPlayer.Instance; if (pl as ViNoSoundPlayer) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add((byte)m_SoundType); byteList.Add((byte)m_SoundID); } else if (pl as SimpleSoundPlayer) { string tag = ""; switch (m_SoundType) { case SoundType.MUSIC: tag = "playbgm"; break; case SoundType.SE: tag = "playse"; break; case SoundType.VOICE: tag = "playvoice"; break; default: Debug.LogError("undefined SoundType : " + m_SoundType.ToString()); break; } string loopStr = loop ? "true" : "false"; CodeGenerator.AddPlaySoundCode(byteList, tag, m_SoundName, loopStr); } code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public void Setup() { _soundPlayer = Substitute.For <ISoundPlayer>(); _errorCodeInterpreter = new ErrorCodeInterpreter(new TranslationFactory()); _clipboardService = Substitute.For <IClipboardService>(); _viewModel = new MessageViewModel(new DesignTimeTranslationUpdater(), _soundPlayer, _errorCodeInterpreter, _clipboardService); }
private void InitSoundPlayer() { if (_soundPlayer != null) { _soundPlayer.Dispose(); } switch (_config.Player.Format) { case SoundPlayerType.Wav: _soundPlayer = new WavPlayer(Logger, _config.Player.DeviceLatency); break; case SoundPlayerType.Spx: _soundPlayer = new SpeexPlayer(Logger, _config.Player.DeviceLatency); break; case SoundPlayerType.SpxCmd: _soundPlayer = new CommandSpeexPlayer(Logger); break; case SoundPlayerType.Silent: _soundPlayer = new SilentPlayer(); break; default: throw new Exception("Неизвестный формат плеера"); } _soundPlayer.PlayingStopped += SoundPlayer_PlayingStopped; }
/// <summary> /// Skips the text. /// </summary> /// <param name='vm'> /// Vm. /// </param> public override void SkipText(VirtualMachine vm) { if (vm.m_MsgTargetTextBox == null) { ViNoDebugger.LogWarning("Current ViNoTextBox is null."); vm.ProgressProgramCounter(1); return; } if (!vm.m_MsgTargetTextBox.reachedEnd) { vm.m_MsgTargetTextBox.DispTextQuick(); } else { // Stop Voice. ISoundPlayer pl = ISoundPlayer.Instance; if (pl != null) { if (pl.IsPlayingVoice()) { pl.StopVoice(); } } vm.ProgressProgramCounter(1); } }
private void lnkPlaySound_LinkClicked( object sender, LinkLabelLinkClickedEventArgs e ) { // TODO: Test for file existence // TODO: Test for exceptions // TODO: Run sound playing in a different thread // TODO: Provider way to stop the sound from playing. // TODO: Avoid issue where person presses play button and causes io exception as another process is using the wav file. if ( _soundPlayer == null ) { _soundPlayer = ServiceLocator.GetSoundPlayer(); _soundPlayer.SoundPlaybackEnded += new SoundPlaybackEnded( SoundPlayer_PlaybackEnded ); } if ( _soundPlayer.IsPlaybackEnded ) { if ( cbUseCustomSound.Checked ) { _soundPlayer.SoundFile = new Uri( new FileInfo( txtBreakSound.Text ).FullName ); } else { // Kudos: DefaultSound http://www.freesound.org/samplesViewSingle.php?id=118648 _soundPlayer.SoundFile = new Uri( new FileInfo( "DefaultSound.wav" ).FullName ); } _soundPlayer.Play(); lnkPlaySound.Text = "Stop Sound"; } else { StopPlayingSound(); } }
public PlaySoundAppService(IPlaySoundFileRepository repository, ServerPathHelper serverPathHelper, ISoundPlayer soundPlayer, ITextSpeaker textSpeaker) { _repository = repository; _serverPathHelper = serverPathHelper; _soundPlayer = soundPlayer; _textSpeaker = textSpeaker; }
static private void AddAudioCode(List <byte> byteList, DialogPartData data) { ISoundPlayer pl = ISoundPlayer.Instance; if (pl as ViNoSoundPlayer) { if (data.isBGM) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add(0); // 0: BGM. byteList.Add((byte)data.bgmAudioID); } if (data.isSE) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add(1); // 1: SE. byteList.Add((byte)data.seAudioID); } if (data.isVoice) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add(2); // 2: VOICE. byteList.Add((byte)data.voiceAudioID); } else { byteList.Add(Opcode.STOP_VOICE); } } else if (pl as SimpleSoundPlayer) { if (data.isBGM) { // Loop. AddPlaySoundCode(byteList, "playbgm", data.bgmAudioKey, "true"); /* * Hashtable args = new Hashtable(); * args[ "eventType" ] = "playbgm"; * args[ "storage" ] = data.bgmAudioKey; * args[ "loop" ] = "true"; * ByteCodeScriptTools.AddTablePairsCode( byteList , args ); * ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); * //*/ } if (data.isSE) { AddPlaySoundCode(byteList, "playse", data.seAudioKey, "false"); } if (data.isVoice) { AddPlaySoundCode(byteList, "playvoice", data.voiceAudioKey, "false"); } } }
public SoundQueue(ISoundPlayer soundPlayer, ISoundNameService soundNameService, double timerQueueInterval) { Player = soundPlayer; SoundNameService = soundNameService; _timerInvokeSoundQueue = new Timer(timerQueueInterval); _timerInvokeSoundQueue.Elapsed += TimerInvokeSoundQueue_Elapsed; _timerInvokeSoundQueue.Start(); }
public SoundResourcesLoadSystem(Contexts contexts, SoundParentController soundParentController) : base(contexts.sound) { _soundPlayer = contexts.session.clientSessionObjects.SoundPlayer; _timeManager = contexts.session.clientSessionObjects.TimeManager; _playerContext = contexts.player; _bulletContext = contexts.bullet; _soundParentController = soundParentController; }
// ReSharper disable once MemberCanBeProtected.Global public RecommendPdfArchitectWindowViewModel(ISoundPlayer soundPlayer, IProcessStarter processStarter, ITranslationUpdater translationUpdater) : base(translationUpdater) { _soundPlayer = soundPlayer; _processStarter = processStarter; InfoCommand = new DelegateCommand(ExecuteInfo); DownloadCommand = new DelegateCommand(ExecuteDownload); }
public ClientVehicleSoundManager(ISoundEntityFactory soundEntityFactory, ISoundPlayer soundPlayer) { _soundConfigManager = SingletonManager.Get <VehicleSoundConfigManager>(); _soundEntityFactory = soundEntityFactory; _soundPlayer = soundPlayer; _soundEntityCache = new Dictionary <int, SoundEntity>(); _actionSoundIdList = new List <int>(); }
// ReSharper disable once MemberCanBeProtected.Global public RecommendPdfArchitectWindowViewModel(ISoundPlayer soundPlayer, IWebLinkLauncher webLinkLauncher, ITranslationUpdater translationUpdater) : base(translationUpdater) { _soundPlayer = soundPlayer; _webLinkLauncher = webLinkLauncher; InfoCommand = new DelegateCommand(ExecuteInfo); DownloadCommand = new DelegateCommand(ExecuteDownload); }
public MainViewModel(ISoundPlayer soundPlayer) { _soundPlayer = soundPlayer; OpenDevicePageCommand = new Command(OpenDevicePage); PlaySoundCommand = new Command(PlaySound); OpenSpeechPageCommand = new Command(OpenSpeechPage); ShowToastCommand = new Command(ShowToast); }
private void StopSound() { if (soundService != null) { soundService.Stop(); soundService = null; } }
public ComposerViewModel(ISoundGeneratorService soundGeneratorService, ISoundPlayer soundPlayer) { this.soundGeneratorService = soundGeneratorService; this.soundPlayer = soundPlayer; Tune = new Tune { Tempo = 120 }; }
public RingtonesViewModel( IRingtoneStoreService ringtoneStore, ISoundPlayer soundPlayer) { this.ringtoneStore = ringtoneStore; this.soundPlayer = soundPlayer; //this.MyTunes = ringtoneStore.GetTunes().ToList(); }
/// <summary> /// Load the specified info. /// </summary> /// <returns> /// If Load Succeed return true , Load Failed return false. /// </returns> static public bool Load(ViNoSaveInfo info) { bool levelNameNotMatchThisScene = !info.data.m_LoadedLevelName.Equals(Application.loadedLevelName); if (levelNameNotMatchThisScene) { ViNoDebugger.LogError("SaveData Level Name is : \"" + info.data.m_LoadedLevelName + "\" but this level is \"" + Application.loadedLevelName + "\""); return(false); } // Load Scene from XML. if (ViNoSceneManager.Instance != null) { ViNoSceneManager.Instance.Load(info); } bool haveLevelName = !string.IsNullOrEmpty(info.data.m_LoadedLevelName); bool haveNodeName = !string.IsNullOrEmpty(info.data.m_NodeName); bool isLoad = (haveLevelName && haveNodeName); if (isLoad) { // Deserialize VM. VM vm = VM.Instance; if (vm != null) { vm.ClearTextBuilder(); SystemUtility.ClearAllTextBoxMessage(); vm.Deserialize(info.data.m_NodeName); GameObject scenarioObj = GetScenarioObject(info); // Play from File ?. ScenarioNode scenario = scenarioObj.GetComponent <ScenarioNode>(); scenario.startFromSave = true; scenario.PlayFrom(info.data.m_NodeName); } // Load Sound. if (ISoundPlayer.Instance != null) { ISoundPlayer pl = ISoundPlayer.Instance; pl.OnLoad(info.data); } // Deactivate Selections. if (ISelectionsCtrl.Instance != null) { ISelectionsCtrl.Instance.ChangeActive(false); } } return(isLoad); }
public SoundTestSystem(IWorld world, ISoundSystem soundSystem, IInputManager inputManager) : base(world, world.EntityFilter(10).With <SoundClipComponent>()) { _keyboard = inputManager.Keyboard; _sound = Map <SoundClipComponent>(); _soundEffects = soundSystem.GetPlayer("SoundEffects"); _music = soundSystem.GetPlayer("Music"); _volume = _soundEffects.GetVolume(); }
public OutputFacade(ICursorHelper cursorHelper, IGridPainter gridPainter, IGridResultPainter gridResultPainter, ITextResultDisplayer textResultDisplayer, ISoundPlayer soundPlayer, IOutputWriter outputWriter) { _cursorHelper = cursorHelper; _gridPainter = gridPainter; _gridResultPainter = gridResultPainter; _textResultDisplayer = textResultDisplayer; _soundPlayer = soundPlayer; _outputWriter = outputWriter; }
public MessageViewModel(ITranslationUpdater translationUpdater, ISoundPlayer soundPlayer, ErrorCodeInterpreter errorCodeInterpreter, IClipboardService clipboardService) : base(translationUpdater) { _soundPlayer = soundPlayer; _errorCodeInterpreter = errorCodeInterpreter; _clipboardService = clipboardService; LeftButtonCommand = new DelegateCommand(ButtonLeftExecute); MiddleButtonCommand = new DelegateCommand(MiddleButtonExecute, MiddleButtonCanExecute); RightButtonCommand = new DelegateCommand(RightButtonExecute, RightButtonCanExecute); }
private void Initialize(ISoundPlayer soundPlayer, IBgmEventProvider bgmEventProvider, List <ISeEventProvider> seEventProviders) { seEventProviders.Select(x => x.PlaySeTriggerAsObservable()) .Merge() .Subscribe(soundPlayer.PlayOneShot) .AddTo(this); bgmEventProvider.PlayBgmTriggerAsObservable() .TakeUntilDestroy(this) .Subscribe(soundPlayer.Play, soundPlayer.Stop); }
// ReSharper disable once MemberCanBeProtected.Global public RecommendPdfArchitectWindowViewModel(ISoundPlayer soundPlayer, IWebLinkLauncher webLinkLauncher, ITranslationUpdater translationUpdater, IPdfArchitectCheck pdfArchitectCheck, IProcessStarter processStarter, IFile file) : base(translationUpdater) { _soundPlayer = soundPlayer; _webLinkLauncher = webLinkLauncher; _pdfArchitectCheck = pdfArchitectCheck; _processStarter = processStarter; _file = file; InfoCommand = new DelegateCommand(ExecuteInfo); DownloadCommand = new DelegateCommand(ExecuteDownload); }
public MainForm() { InitializeComponent(); _field = new Field(10, 10, 10); _inputManager = new InputManager(_field, this); _fieldView = new ControlFieldView(_field, new ControlViewAdapter(this), _inputManager); _soundPlayer = new WaveSoundPlayer(_field); _stopwatch = new StdStopwatch(); _field.Modified += FieldModified; }
public void Construct( [Inject(Id = "GameCamera")] CinemachineVirtualCamera playerGameCamera, IHapticManager hapticManager, ISoundPlayer soundPlayer, GameManager gameManager, GameData gameData) { _playerGameCamera = playerGameCamera; _hapticManager = hapticManager; _soundPlayer = soundPlayer; _gameManager = gameManager; _gameData = gameData; }
void playse(Hashtable param) { string audioPath = param["storage"] as string; bool loop = false; if (param.ContainsKey("loop")) { loop = ((param["loop"] as string) == "true") ? true : false; } ISoundPlayer player = ISoundPlayer.Instance; player.PlaySE(audioPath, loop, 0f); }
public LoopCreationViewModel(ISoundPlayer soundPlayer, IInstrumentManager instrumentManager, IOrpheeFileExporter orpheeFileExporter) { this.DisplayedTrack = new OrpheeTrack(0, Channel.Channel1); this._soundPlayer = soundPlayer; this.InstrumentManager = instrumentManager; this._orpheeFileExporter = orpheeFileExporter; this.DisplayedTrack.CurrentInstrument = this.InstrumentManager.CurrentInstrument; this.ToggleButtonNoteCommand = new DelegateCommand<IToggleButtonNote>(ToggleButtonNoteExec); this.AddColumnsCommand = new DelegateCommand(AddColumnsCommandExec); this.RemoveAColumnCommand = new DelegateCommand(RemoveAColumnCommandExec); this.SaveButtonCommand = new DelegateCommand(SaveButtonCommandExec); this.LoadButtonCommand = new DelegateCommand(LoadButtonCommandExec); }
public SoundProvider() { this.pacmanMovePlayer = new PacmanMovePlayer(); this.pacmanChompPlayer = new PacmanChompPlayer(); this.pacmanDeathPlayer = new PacmanDeathPlayer(); this.fruitStepPlayer = new FruitStepPlayer(); this.eatFruitPlayer = new EatFruitPlayer(); this.eatGhostPlayer = new EatGhostPlayer(); this.scaredPlayer = new ScaredPlayer(); this.retraitPlayer = new RetraitPlayer(); this.beginningPlayer = new BeginningPlayer(); this.intermissionPlayer = new IntermissionPlayer(); this.extraLifePlayer = new ExtraLifePlayer(); }
/// <summary> /// データの読み込み。 /// </summary> /// <param name="root">レベル データの入っているフォルダー。</param> /// <param name="factory">サウンドプレイヤーのファクトリ。</param> public async Task LoadFromLocalAsync(IStorage root, ISoundPlayerFactory factory) { var json = await root.ReadStringAsync("level.json"); Level = Newtonsoft.Json.JsonConvert.DeserializeObject <Level>(json); var imageFolder = await root.GetSubfolderAsync(Images); ImageFiles = await imageFolder.GetFilesAsync(); var sound = await root.GetSubfolderAsync(Sounds); SoundPlayer = factory.Create(sound); }
/// <summary> /// Initialize game engine. /// </summary> /// <param name="game"></param> public void Init(Game game) { Logger.Write(LogType.Info, "Initializing engine."); ContentManager.Instance.Init(game); timerManager = new TimerManager(); game.Services.AddService(typeof (TimerManager), timerManager); screenManager = new ScreenManager(game); game.Services.AddService(typeof (ScreenManager), screenManager); if (SoundPlayer == null) SoundPlayer = new SoundPlayer(); game.Services.AddService(typeof (ISoundPlayer), SoundPlayer); Logger.Write(LogType.Info, "Engine initialized."); }
private void StopSound() { if ( soundService != null ) { soundService.Stop(); soundService = null; } }
/// <summary> /// OnEnable and Get the Music Names. /// </summary> void OnEnable( ) { if( m_SoundPlInstance == null ){ m_SoundPlInstance = GameObject.FindObjectOfType( typeof( ISoundPlayer ) ) as ISoundPlayer; } if( m_SoundPlInstance != null ){ if( m_SoundPlInstance as ViNoSoundPlayer ){ ViNoSoundPlayer pl = m_SoundPlInstance as ViNoSoundPlayer; m_SoundEntries = pl.GetSoundEntryNames(); m_VoiceEntries = pl.GetVoiceEntryNames(); m_SeEntries = pl.GetSeEntryNames(); } } }
private void PlaySound() { if (soundService == null) soundService = ServiceLocator.GetSoundPlayer(); if ( Properties.Settings.Default.UseCustomSound ) { soundService.SoundFile = new Uri( Properties.Settings.Default.BreakSoundFile ); } else { soundService.SoundFile = new Uri( new FileInfo( "DefaultSound.wav" ).FullName ); } soundService.Play(track_workDurationCompletedCount); }
private void InitSoundPlayer() { if (_soundPlayer != null) _soundPlayer.Dispose(); switch (_config.Player.Format) { case SoundPlayerType.Wav: _soundPlayer = new WavPlayer(Logger, _config.Player.DeviceLatency); break; case SoundPlayerType.Spx: _soundPlayer = new SpeexPlayer(Logger, _config.Player.DeviceLatency); break; case SoundPlayerType.SpxCmd: _soundPlayer = new CommandSpeexPlayer(Logger); break; case SoundPlayerType.Silent: _soundPlayer = new SilentPlayer(); break; default: throw new Exception("Неизвестный формат плеера"); } _soundPlayer.PlayingStopped += SoundPlayer_PlayingStopped; }
public void Play(ISoundPlayer soundPlayer) { soundPlayer.Play(this._sourceEffectInstance); }
public static void InitSoundSource(ISoundPlayer player) { _player = player; }
public WhenAToggleButtonNoteIsClicked() { this.OrpheeFileExporterMock = new Mock<IOrpheeFileExporter>(); this.InstrumentManagerMock = new Mock<IInstrumentManager>(); this.MidiLibRepositoryMock = new Mock<IMidiLibRepository>(); this.SoundPlayer = new SoundPlayer(this.MidiLibRepositoryMock.Object); this.LoopCreationViewModel = new LoopCreationViewModel(this.SoundPlayer, this.InstrumentManagerMock.Object, this.OrpheeFileExporterMock.Object); }
public void LoadFile(string file) { if (File.Exists(file)) { if (m_SoundPlayer != null) { m_SoundPlayer.Dispose(); m_SoundPlayer = null; } using (var fileStream = File.OpenRead(file)) { m_SoundPlayer = new IrrKlangSoundPlayer(file) { Volume = GetConvertedVolume(Volume) }; //m_SoundPlayer = new NAudioSoundPlayer(fileStream, WavePlayerType.DirectSound) { Volume = GetConvertedFloatValue(Volume) }; var fileName = Path.GetFileNameWithoutExtension(file); if(fileName.Length > 40) { fileName.Remove(41); fileName += "..."; } playerContainer.Text = fileName; m_OpenFileDialog.FileName = file; StopCountdown(); } } }
public void Play(ISoundPlayer soundPlayer) { // nothing to do }