Example #1
0
        public static BASS_WASAPI_DEVICEINFO BASS_WASAPI_GetDeviceInfo(int device)
        {
            BASS_WASAPI_DEVICEINFO bass_WASAPI_DEVICEINFO = new BASS_WASAPI_DEVICEINFO();

            if (BassWasapi.BASS_WASAPI_GetDeviceInfo(device, bass_WASAPI_DEVICEINFO))
            {
                return(bass_WASAPI_DEVICEINFO);
            }
            return(null);
        }
Example #2
0
        public static int BASS_WASAPI_GetDeviceCount()
        {
            BASS_WASAPI_DEVICEINFO info = new BASS_WASAPI_DEVICEINFO();
            int num = 0;

            while (BassWasapi.BASS_WASAPI_GetDeviceInfo(num, info))
            {
                num++;
            }
            BassWasapi.BASS_WASAPI_GetCPU();
            return(num);
        }
Example #3
0
        public static BASS_WASAPI_DEVICEINFO[] BASS_WASAPI_GetDeviceInfos()
        {
            List <BASS_WASAPI_DEVICEINFO> list = new List <BASS_WASAPI_DEVICEINFO>();
            int num = 0;
            BASS_WASAPI_DEVICEINFO item;

            while ((item = BassWasapi.BASS_WASAPI_GetDeviceInfo(num)) != null)
            {
                list.Add(item);
                num++;
            }
            BassWasapi.BASS_WASAPI_GetCPU();
            return(list.ToArray());
        }
Example #4
0
 public BassWasapiHandler(int device, bool exclusive, bool eventSystem, int freq, int chans, float buffer, float period)
 {
     this._device      = device;
     this._exclusive   = exclusive;
     this._eventSystem = eventSystem;
     if (!BassWasapi.BASS_WASAPI_GetDeviceInfo(device, this._wasapiDeviceInfo))
     {
         throw new ArgumentException("Invalid device: " + Enum.GetName(typeof(BASSError), Bass.Bass.BASS_ErrorGetCode()));
     }
     if (exclusive)
     {
         this._numchans = chans;
     }
     else
     {
         this._numchans = this._wasapiDeviceInfo.mixchans;
     }
     if (exclusive)
     {
         this._samplerate = freq;
     }
     else
     {
         this._samplerate = this._wasapiDeviceInfo.mixfreq;
     }
     this._updatePeriod = period;
     if (buffer == 0f)
     {
         this._bufferLength = ((this._updatePeriod == 0f) ? this._wasapiDeviceInfo.defperiod : this._updatePeriod) * 4f;
     }
     else
     {
         this._bufferLength = buffer;
     }
     if (this.IsInput)
     {
         this.UseInput = true;
         return;
     }
     this._internalMixer = BassMix.BASS_Mixer_StreamCreate(this._samplerate, this._numchans, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_AAC_FRAME960);
     if (this._internalMixer == 0)
     {
         throw new NotSupportedException("Internal Mixer: " + Enum.GetName(typeof(BASSError), Bass.Bass.BASS_ErrorGetCode()));
     }
 }