MediaPortal.MusicPlayer.BASS.BassAudioEngine.InitDirectSoundDevice C# (CSharp) Method

InitDirectSoundDevice() private method

Initialise the DirectSound Device
private InitDirectSoundDevice ( ) : bool
return bool
    private bool InitDirectSoundDevice()
    {
      bool result = false;

      int soundDevice = GetSoundDevice();

      result =
        Bass.BASS_Init(soundDevice, 44100, BASSInit.BASS_DEVICE_DEFAULT | BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero);

      BASS_INFO info = Bass.BASS_GetInfo();
      if (info != null)
      {
        _deviceOutputChannels = info.speakers;

        Log.Info("BASS: Device Information");
        Log.Info("BASS: ---------------------------------------------");
        Log.Info("BASS: Name: {0}", info.ToString());
        Log.Info("BASS: Directsound version: {0}", info.dsver);
        Log.Info("BASS: # Output Channels: {0}", info.speakers);
        Log.Debug("BASS: Minimum Buffer Samples: {0}", info.minbuf);
        Log.Debug("BASS: Current Sample rate: {0}", info.freq);
        Log.Debug("BASS: Maximum Sample rate: {0}", info.maxrate);
        Log.Debug("BASS: Minimum Sample rate: {0}", info.minrate);
        Log.Info("BASS: ---------------------------------------------");
      }

      // Bass will maximize the value to 100 ms
      Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 80);

      if (!result)
      {
        HandleBassError("InitDirectSoundDevice");
      }

      return result;
    }