@@ -10,9 +10,7 @@ use std::os::raw;
1010use std:: { self , ptr} ;
1111
1212use super :: error:: Error ;
13- use super :: types:: {
14- sample_format_flags, DeviceIndex , DeviceKind , SampleFormat , SampleFormatFlags , Time ,
15- } ;
13+ use super :: types:: { DeviceIndex , DeviceKind , SampleFormat , SampleFormatFlags , Time } ;
1614use super :: Sample ;
1715
1816pub use self :: callback_flags:: CallbackFlags ;
@@ -85,7 +83,7 @@ pub trait Writer: Flow {
8583}
8684
8785/// An alias for the boxed Callback function type.
88- type CallbackFn = FnMut (
86+ type CallbackFn = dyn FnMut (
8987 * const raw:: c_void ,
9088 * mut raw:: c_void ,
9189 raw:: c_ulong ,
@@ -699,21 +697,22 @@ pub mod flags {
699697 ///
700698 /// See the [bitflags repo](https://github.com/rust-lang/bitflags/blob/master/src/lib.rs)
701699 /// for examples of composing flags together.
702- pub flags Flags : :: std:: os:: raw:: c_ulong {
700+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
701+ pub struct Flags : :: std:: os:: raw:: c_ulong {
703702 /// No flags.
704- const NO_FLAG = ffi:: PA_NO_FLAG ,
703+ const NO_FLAG = ffi:: PA_NO_FLAG ;
705704 /// Disable default clipping of out of range samples.
706- const CLIP_OFF = ffi:: PA_CLIP_OFF ,
705+ const CLIP_OFF = ffi:: PA_CLIP_OFF ;
707706 /// Disable default dithering.
708- const DITHER_OFF = ffi:: PA_DITHER_OFF ,
707+ const DITHER_OFF = ffi:: PA_DITHER_OFF ;
709708 /// Flag requests that where possible a full duplex stream will not discard overflowed
710709 /// input samples without calling the stream callback.
711- const NEVER_DROP_INPUT = ffi:: PA_NEVER_DROP_INPUT ,
710+ const NEVER_DROP_INPUT = ffi:: PA_NEVER_DROP_INPUT ;
712711 /// Call the stream callback to fill initial output buffers, rather than the default
713712 /// behavior of priming the buffers with zeros (silence)
714- const PA_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK = ffi:: PA_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK ,
713+ const PA_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK = ffi:: PA_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK ;
715714 /// A mask specifying the platform specific bits.
716- const PA_PLATFORM_SPECIFIC_FLAGS = ffi:: PA_PLATFORM_SPECIFIC_FLAGS ,
715+ const PA_PLATFORM_SPECIFIC_FLAGS = ffi:: PA_PLATFORM_SPECIFIC_FLAGS ;
717716 }
718717 }
719718
@@ -755,27 +754,28 @@ pub mod callback_flags {
755754 use ffi;
756755 bitflags ! {
757756 /// Flag bit constants for the status flags passed to the stream's callback function.
758- pub flags CallbackFlags : :: std:: os:: raw:: c_ulong {
757+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
758+ pub struct CallbackFlags : :: std:: os:: raw:: c_ulong {
759759 /// No flags.
760- const NO_FLAG = ffi:: PA_NO_FLAG ,
760+ const NO_FLAG = ffi:: PA_NO_FLAG ;
761761 /// In a stream opened with paFramesPerBufferUnspecified, indicates that input data is
762762 /// all silence (zeros) because no real data is available. In a stream opened without
763763 /// `FramesPerBufferUnspecified`, it indicates that one or more zero samples have been
764764 /// inserted into the input buffer to compensate for an input underflow.
765- const INPUT_UNDERFLOW = ffi:: INPUT_UNDERFLOW ,
765+ const INPUT_UNDERFLOW = ffi:: INPUT_UNDERFLOW ;
766766 /// In a stream opened with paFramesPerBufferUnspecified, indicates that data prior to
767767 /// the first sample of the input buffer was discarded due to an overflow, possibly
768768 /// because the stream callback is using too much CPU time. Otherwise indicates that
769769 /// data prior to one or more samples in the input buffer was discarded.
770- const INPUT_OVERFLOW = ffi:: INPUT_OVERFLOW ,
770+ const INPUT_OVERFLOW = ffi:: INPUT_OVERFLOW ;
771771 /// Indicates that output data (or a gap) was inserted, possibly because the stream
772772 /// callback is using too much CPU time.
773- const OUTPUT_UNDERFLOW = ffi:: OUTPUT_UNDERFLOW ,
773+ const OUTPUT_UNDERFLOW = ffi:: OUTPUT_UNDERFLOW ;
774774 /// Indicates that output data will be discarded because no room is available.
775- const OUTPUT_OVERFLOW = ffi:: OUTPUT_OVERFLOW ,
775+ const OUTPUT_OVERFLOW = ffi:: OUTPUT_OVERFLOW ;
776776 /// Some of all of the output data will be used to prime the stream, input data may be
777777 /// zero.
778- const PRIMING_OUTPUT = ffi:: PRIMING_OUTPUT ,
778+ const PRIMING_OUTPUT = ffi:: PRIMING_OUTPUT ;
779779 }
780780 }
781781
@@ -850,7 +850,7 @@ impl<S: Sample> Parameters<S> {
850850 /// `UseHostApiSpecificDeviceSpecification` flag.
851851 pub fn from_c_params ( c_params : ffi:: PaStreamParameters ) -> Option < Self > {
852852 let sample_format_flags: SampleFormatFlags = c_params. sampleFormat . into ( ) ;
853- let is_interleaved = !sample_format_flags. contains ( sample_format_flags :: NON_INTERLEAVED ) ;
853+ let is_interleaved = !sample_format_flags. contains ( SampleFormatFlags :: NON_INTERLEAVED ) ;
854854 let c_sample_format = SampleFormat :: from_flags ( c_params. sampleFormat . into ( ) ) ;
855855 if S :: sample_format ( ) != c_sample_format {
856856 return None ;
@@ -883,7 +883,7 @@ impl<S: Sample> From<Parameters<S>> for ffi::PaStreamParameters {
883883 let sample_format = S :: sample_format ( ) ;
884884 let mut sample_format_flags = sample_format. flags ( ) ;
885885 if !is_interleaved {
886- sample_format_flags. insert ( sample_format_flags :: NON_INTERLEAVED ) ;
886+ sample_format_flags. insert ( SampleFormatFlags :: NON_INTERLEAVED ) ;
887887 }
888888 ffi:: PaStreamParameters {
889889 device : device. into ( ) ,
0 commit comments