private void FillWASAPIDeviceList() { _WASAPIDevices.Clear(); BassPlayerSettings settings = Controller.GetSettings(); BASS_WASAPI_DEVICEINFO[] deviceDescriptions = BassWasapi.BASS_WASAPI_GetDeviceInfos(); for (int i = 0; i < deviceDescriptions.Length; i++) { // Skip input devices, they have same name as output devices. BASS_WASAPI_DEVICEINFO deviceInfo = deviceDescriptions[i]; bool skip = !WASAPIOutputDevice.IsValidDevice(deviceInfo); ServiceRegistration.Get <ILogger>().Debug("{5} WASAPI Device {0}: '{1}' Flags: {2} Device path: [{3}] Ch: {4}", i, deviceInfo.name, deviceInfo.flags, deviceInfo.id, deviceInfo.mixchans, skip ? "Skip" : "Use "); if (skip) { continue; } ListItem deviceItem = new ListItem(Consts.KEY_NAME, deviceInfo.name) { Selected = deviceInfo.name == settings.WASAPIDevice }; deviceItem.SelectedProperty.Attach(delegate { var selected = _WASAPIDevices.FirstOrDefault(d => d.Selected); WASAPIDevice = selected != null ? selected.Labels[Consts.KEY_NAME].ToString() : string.Empty; }); deviceItem.SetLabel(KEY_GROUP, "WASAPI"); _WASAPIDevices.Add(deviceItem); } _WASAPIDevices.FireChange(); }
public override void Save() { BassPlayerSettings settings = SettingsManager.Load <BassPlayerSettings>(); settings.CrossFadingEnabled = _yes; SettingsManager.Save(settings); }
private void FillWASAPIDeviceList() { _WASAPIDevices.Clear(); BassPlayerSettings settings = Controller.GetSettings(); BASS_WASAPI_DEVICEINFO[] deviceDescriptions = BassWasapi.BASS_WASAPI_GetDeviceInfos(); for (int i = 0; i < deviceDescriptions.Length; i++) { // Skip input devices, they have same name as output devices. BASS_WASAPI_DEVICEINFO deviceInfo = deviceDescriptions[i]; if ((deviceInfo.flags & (BASSWASAPIDeviceInfo.BASS_DEVICE_INPUT | BASSWASAPIDeviceInfo.BASS_DEVICE_DISABLED /*| BASSWASAPIDeviceInfo.BASS_DEVICE_UNPLUGGED */)) != 0) { continue; } ListItem deviceItem = new ListItem(Consts.KEY_NAME, deviceInfo.name) { Selected = deviceInfo.name == settings.WASAPIDevice }; deviceItem.SelectedProperty.Attach(delegate { var selected = _WASAPIDevices.FirstOrDefault(d => d.Selected); WASAPIDevice = selected != null ? selected.Labels[Consts.KEY_NAME].ToString() : string.Empty; }); deviceItem.SetLabel(KEY_GROUP, "WASAPI"); _WASAPIDevices.Add(deviceItem); } _WASAPIDevices.FireChange(); }
public override void Save() { BassPlayerSettings settings = SettingsManager.Load <BassPlayerSettings>(); settings.CrossFadeDurationSecs = _value; SettingsManager.Save(settings); }
public override void Save() { BassPlayerSettings settings = SettingsManager.Load <BassPlayerSettings>(); settings.SeekIncrementSeconds = (int)_value; SettingsManager.Save(settings); }
public void SaveSettings() { ISettingsManager settingsManager = ServiceRegistration.Get <ISettingsManager>(); BassPlayerSettings settings = settingsManager.Load <BassPlayerSettings>(); settings.DirectSoundBufferSizeMilliSecs = DirectSoundBufferSize; settings.PlaybackBufferSizeMilliSecs = WasapiBufferSize; settingsManager.Save(settings); }
/// <summary> /// Reclculates the visualization stream byte-offset according usersettings. /// </summary> private void UpdateVizLatencyCorrection() { BassPlayerSettings settings = Controller.GetSettings(); _vizReadOffset = InternalSettings.VizLatencyCorrectionRange.Add(settings.VizStreamLatencyCorrection); _vizReadOffsetBytes = AudioRingBuffer.CalculateLength(_inputStream.SampleRate, _inputStream.Channels, _vizReadOffset); Log.Debug("Vizstream reading offset: {0} ms", _vizReadOffset.TotalMilliseconds); }
/// <summary> /// Saves the current state to the settings file. /// </summary> public void SaveSettings() { ISettingsManager settingsManager = ServiceRegistration.Get <ISettingsManager>(); BassPlayerSettings settings = settingsManager.Load <BassPlayerSettings>(); settings.OutputMode = UseDirectSound ? OutputMode.DirectSound : OutputMode.WASAPI; settings.WASAPIExclusiveMode = EnableWASAPIExclusive; settings.WASAPIDevice = WASAPIDevice; settings.DirectSoundDevice = DirectSoundDevice; settingsManager.Save(settings); }
private void InitModel() { BassPlayerSettings settings = Controller.GetSettings(); EnableWASAPIExclusive = settings.WASAPIExclusiveMode; DirectSoundDevice = settings.DirectSoundDevice; WASAPIDevice = settings.WASAPIDevice; UseDirectSound = settings.OutputMode == OutputMode.DirectSound; UseWASAPI = settings.OutputMode == OutputMode.WASAPI; FillDirectSoundDeviceList(); FillWASAPIDeviceList(); }
private void InitModel() { BassPlayerSettings settings = Controller.GetSettings(); IsNormalMode = settings.SongTransitionMode == PlaybackMode.Normal; IsGaplessMode = settings.SongTransitionMode == PlaybackMode.Gapless; IsCrossFadingMode = settings.SongTransitionMode == PlaybackMode.CrossFading; CrossFadeDuration crossFadeDuration = new CrossFadeDuration(); crossFadeDuration.Load(); _numberSelectController = new NumberSelectController(); _numberSelectController.Initialize(crossFadeDuration); CrossFadeDuration = settings.CrossFadeDurationSecs; }
public PlaybackBuffer(Controller controller) { _controller = controller; _silence = new Silence(); BassPlayerSettings settings = Controller.GetSettings(); _bufferSize = settings.PlaybackBufferSize; _streamWriteProcDelegate = OutputStreamWriteProc; _vizRawStreamWriteProcDelegate = VizRawStreamWriteProc; _notifyBufferUpdateThread = new AutoResetEvent(false); _updateThreadFinished = new AutoResetEvent(false); }
/// <summary> /// Creates an IOutputDevice object based on usersettings. /// </summary> /// <returns></returns> public IOutputDevice CreateOutputDevice() { IOutputDevice outputDevice; BassPlayerSettings settings = Controller.GetSettings(); switch (settings.OutputMode) { case OutputMode.DirectSound: outputDevice = new DirectXOutputDevice(_controller); break; default: throw new BassPlayerException(String.Format("Unimplemented audio output mode {0}", settings.OutputMode)); } return(outputDevice); }
private void InitModel() { BassPlayerSettings settings = Controller.GetSettings(); DirectSoundBuffer directSoundBuffer = new DirectSoundBuffer(); directSoundBuffer.Load(); _directSoundBufferSizeController = new NumberSelectController(); _directSoundBufferSizeController.Initialize(directSoundBuffer); PlaybackBufferSize wasapiBuffer = new PlaybackBufferSize(); wasapiBuffer.Load(); _wasapiBufferSizeController = new NumberSelectController(); _wasapiBufferSizeController.Initialize(wasapiBuffer); DirectSoundBufferSize = settings.DirectSoundBufferSizeMilliSecs; WasapiBufferSize = settings.PlaybackBufferSizeMilliSecs; }
public static bool CanPlay(IResourceLocator locator, string mimeType) { // First check the Mime Type if (!string.IsNullOrEmpty(mimeType) && !mimeType.StartsWith("audio")) { return(false); } using (IResourceAccessor accessor = locator.CreateAccessor()) { if (accessor is AudioCDResourceAccessor || accessor is INetworkResourceAccessor) { return(true); } string ext = DosPathHelper.GetExtension(accessor.ResourcePathName).ToLowerInvariant(); BassPlayerSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <BassPlayerSettings>(); return(settings.SupportedExtensions.IndexOf(ext) > -1); } }
public void SaveSettings() { ISettingsManager settingsManager = ServiceRegistration.Get <ISettingsManager>(); BassPlayerSettings settings = settingsManager.Load <BassPlayerSettings>(); if (IsNormalMode) { settings.SongTransitionMode = PlaybackMode.Normal; } if (IsGaplessMode) { settings.SongTransitionMode = PlaybackMode.Gapless; } if (IsCrossFadingMode) { settings.SongTransitionMode = PlaybackMode.CrossFading; } settings.CrossFadeDurationSecs = CrossFadeDuration; settingsManager.Save(settings); }
private void FillDirectSoundDeviceList() { _directSoundDevices.Clear(); BassPlayerSettings settings = Controller.GetSettings(); BASS_DEVICEINFO[] deviceDescriptions = Bass.BASS_GetDeviceInfos(); for (int i = 0; i < deviceDescriptions.Length; i++) { BASS_DEVICEINFO deviceInfo = deviceDescriptions[i]; ListItem deviceItem = new ListItem(Consts.KEY_NAME, deviceInfo.name) { Selected = deviceInfo.name == settings.DirectSoundDevice }; deviceItem.SelectedProperty.Attach(delegate { var selected = DirectSoundDevices.FirstOrDefault(d => d.Selected); DirectSoundDevice = selected != null ? selected.Labels[Consts.KEY_NAME].ToString() : string.Empty; }); deviceItem.SetLabel(KEY_GROUP, "DirectSound"); _directSoundDevices.Add(deviceItem); } _directSoundDevices.FireChange(); }
public static void SaveSettings(BassPlayerSettings settings) { ServiceRegistration.Get <ISettingsManager>().Save(settings); }