private Factory(VBAN.Protocol <T> protocol, IDataRateValue <TS> sampleRate, int samples, int channel, IFormatValue <TS> format, int codec, string streamName) { Protocol = protocol.Value; SampleRate = sampleRate.Value; Samples = samples; Channel = channel; Format = format.Value; Codec = codec; StreamName = streamName; Counter = 0; }
internal Builder(VBAN.Protocol <T> protocol) { Protocol = protocol; switch (Protocol.Value) { case 0x00: SampleRate = VBAN.SampleRate.Hz48000 as IDataRateValue <TS>; Samples = 255; Channel = 2; Format = VBAN.AudioFormat.Int16 as IFormatValue <TS>; StreamName = "Stream1"; return; case 0x20: StreamName = "MIDI1"; break; case 0x40: SampleRate = VBAN.BitsPerSecond.Bps256000 as IDataRateValue <TS>; Samples = 0; Channel = 0; Format = VBAN.Format.Byte8 as IFormatValue <TS>; // if because we are in a shared branch if (StreamName == null) { StreamName = "Command1"; } return; case 0x60: // SERVICE protocol is not supported break; default: throw new InvalidOperationException("Unknown Protocol: " + protocol); } }
public static Builder <T, TS> CreateBuilder(VBAN.Protocol <T> protocol) { return(new Builder <T, TS>(protocol)); }
public static Factory <T, TS> DefaultFactory <T, TS>(VBAN.Protocol <T> forProtocol) where T : TS { return(Factory <T, TS> .CreateBuilder(forProtocol).Build()); }
internal Builder(VBAN.Protocol <T> protocol) { Protocol = protocol; SetDefaultFactory(); }
public static Factory <T, TS> ProtocolDefault(VBAN.Protocol <T> protocol) { return(CreateBuilder(protocol) .SetDefaultFactory() .Build()); }
public Builder(VBAN.Protocol <T> protocol) { Protocol = protocol; }