public static CreateIeeeFloatWaveFormat ( int sampleRate, int channels ) : |
||
sampleRate | int | sample rate |
channels | int | number of channels |
리턴 |
public WasapiLoopbackCaptureProvider(MMDevice device) : base(new WasapiLoopbackCapture(device)) { _wasapiOut = new WasapiOut(device, AudioClientShareMode.Shared, true, 200); _wasapiOut.Init(new SilenceProvider(Wf.CreateIeeeFloatWaveFormat(44100, 2))); }
public byte[] GetData(out WaveFormat waveFormat) { Bass.MusicFree(_channel); string fileName = _fileName; if ((_channel = Bass.CreateStream(fileName, 0, 0, BassFlags.Float | BassFlags.Decode)) == 0) { if ((_channel = Bass.MusicLoad(fileName, 0, 0, BassFlags.MusicSensitiveRamping | BassFlags.Float | BassFlags.Decode, 1)) == 0) { throw new Exception("Can't open the file"); } } Bass.ChannelGetInfo(_channel, out var info); waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(info.Frequency, info.Channels); if (info.Channels != 2) { Bass.MusicFree(_channel); Bass.StreamFree(_channel); throw new Exception("only stereo sources are supported"); } var len = (int)Bass.ChannelGetLength(_channel); var bytes = new byte[len]; var o = Bass.ChannelGetData(_channel, bytes, len); if (o == -1) { throw new Exception(Bass.LastError.ToString()); } return(bytes); }
/// <summary> /// Creates a new MixingWaveProvider32 /// </summary> // Token: 0x06000A68 RID: 2664 RVA: 0x0001E56A File Offset: 0x0001C76A public MixingWaveProvider32() { this.waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(44100, 2); this.bytesPerSample = 4; this.inputs = new List <IWaveProvider>(); }
/// <summary> /// Allows you to specify the sample rate and channels for this WaveProvider /// (should be initialised before you pass it to a wave player) /// </summary> public void SetWaveFormat(int sampleRate, int channels) { this.waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channels); }