/// <summary> /// Creates a user sample stream. /// </summary> /// <param name="freq">The default sample rate. The sample rate can be changed using <see cref="Channel.SetAttribute" />. </param> /// <param name="channels">The number of channels... 1 = mono, 2 = stereo, 4 = quadraphonic, 6 = 5.1, 8 = 7.1. </param> /// <param name="configs">Configure of create a steam. </param> /// <param name="handler"> /// The user defined stream writing function, or one of the <see cref="PresetStreamPushHandler" /> /// and <see cref="PresetStreamDummyHandler" />. /// </param> /// <param name="user">User instance data to pass to the callback function. Unused when creating a dummy or push stream. </param> /// <returns> /// If successful, the new stream's handle is returned, else 0 is returned. Use <see cref="GetErrorCode" /> to get the /// error code. /// </returns> /// <remarks> /// Sample streams allow any sample data to be played through Bass, and are particularly useful for playing a large /// amount of sample data without requiring a large amount of memory. If you wish to play a sample format that BASS /// does not support, then you can create a stream and decode the sample data into it. /// BASS can automatically stream MP3, MP2, MP1, OGG, WAV and AIFF files, using <see cref="CreateFile" />, and also /// from HTTP and FTP servers, using <see cref="CreateURL" />. <see cref="CreateFileUser" /> allows streaming from /// other sources too. /// </remarks> public AudioStream(StreamHandler handler, int freq, int channels, StreamCreateConfig configs, IntPtr user) { IntPtr handlerHandle = IntPtr.Zero; if (handler == PresetStreamDummyHandler) { handlerHandle = PresetStreamProcess.Dummy; } else if (handler == PresetStreamPushHandler) { handlerHandle = PresetStreamProcess.Push; } else { handlerHandle = Marshal.GetFunctionPointerForDelegate(handlerHandle); } Handle = AudioStreamModule.StreamCreateFunction.CheckResult( AudioStreamModule.StreamCreateFunction.Delegate(freq, channels, configs, handlerHandle, user)); }
/// <summary> /// Creates a user sample stream. /// </summary> /// <param name="freq">The default sample rate. The sample rate can be changed using <see cref="Channel.SetAttribute" />. </param> /// <param name="channels">The number of channels... 1 = mono, 2 = stereo, 4 = quadraphonic, 6 = 5.1, 8 = 7.1. </param> /// <param name="configs">Configure of create a steam. </param> /// <param name="handler"> /// The user defined stream writing function, or one of the <see cref="PresetStreamPushHandler" /> /// and <see cref="PresetStreamDummyHandler" />. /// </param> /// <param name="user">User instance data to pass to the callback function. Unused when creating a dummy or push stream. </param> /// <returns> /// If successful, the new stream's handle is returned, else 0 is returned. Use <see cref="GetErrorCode" /> to get the /// error code. /// </returns> /// <remarks> /// Sample streams allow any sample data to be played through Bass, and are particularly useful for playing a large /// amount of sample data without requiring a large amount of memory. If you wish to play a sample format that BASS /// does not support, then you can create a stream and decode the sample data into it. /// BASS can automatically stream MP3, MP2, MP1, OGG, WAV and AIFF files, using <see cref="CreateFile" />, and also /// from HTTP and FTP servers, using <see cref="CreateURL" />. <see cref="CreateFileUser" /> allows streaming from /// other sources too. /// </remarks> public AudioStream(StreamHandler handler, int freq, int channels, StreamCreateConfig configs, IntPtr user) { IntPtr handlerHandle = IntPtr.Zero; if (handler == PresetStreamDummyHandler) { handlerHandle = PresetStreamProcess.Dummy; } else if (handler == PresetStreamPushHandler) { handlerHandle = PresetStreamProcess.Push; } else { handlerHandle = Marshal.GetFunctionPointerForDelegate(handlerHandle); } Handle = AudioStreamModule.StreamCreateFunction.CheckResult( AudioStreamModule.StreamCreateFunction.Delegate(freq, channels, configs, handlerHandle, user)); }