@@ -10,9 +10,7 @@ use std::os::raw;
10
10
use std:: { self , ptr} ;
11
11
12
12
use 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 } ;
16
14
use super :: Sample ;
17
15
18
16
pub use self :: callback_flags:: CallbackFlags ;
@@ -85,7 +83,7 @@ pub trait Writer: Flow {
85
83
}
86
84
87
85
/// An alias for the boxed Callback function type.
88
- type CallbackFn = FnMut (
86
+ type CallbackFn = dyn FnMut (
89
87
* const raw:: c_void ,
90
88
* mut raw:: c_void ,
91
89
raw:: c_ulong ,
@@ -699,21 +697,22 @@ pub mod flags {
699
697
///
700
698
/// See the [bitflags repo](https://github.com/rust-lang/bitflags/blob/master/src/lib.rs)
701
699
/// 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 {
703
702
/// No flags.
704
- const NO_FLAG = ffi:: PA_NO_FLAG ,
703
+ const NO_FLAG = ffi:: PA_NO_FLAG ;
705
704
/// Disable default clipping of out of range samples.
706
- const CLIP_OFF = ffi:: PA_CLIP_OFF ,
705
+ const CLIP_OFF = ffi:: PA_CLIP_OFF ;
707
706
/// Disable default dithering.
708
- const DITHER_OFF = ffi:: PA_DITHER_OFF ,
707
+ const DITHER_OFF = ffi:: PA_DITHER_OFF ;
709
708
/// Flag requests that where possible a full duplex stream will not discard overflowed
710
709
/// 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 ;
712
711
/// Call the stream callback to fill initial output buffers, rather than the default
713
712
/// 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 ;
715
714
/// 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 ;
717
716
}
718
717
}
719
718
@@ -755,27 +754,28 @@ pub mod callback_flags {
755
754
use ffi;
756
755
bitflags ! {
757
756
/// 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 {
759
759
/// No flags.
760
- const NO_FLAG = ffi:: PA_NO_FLAG ,
760
+ const NO_FLAG = ffi:: PA_NO_FLAG ;
761
761
/// In a stream opened with paFramesPerBufferUnspecified, indicates that input data is
762
762
/// all silence (zeros) because no real data is available. In a stream opened without
763
763
/// `FramesPerBufferUnspecified`, it indicates that one or more zero samples have been
764
764
/// 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 ;
766
766
/// In a stream opened with paFramesPerBufferUnspecified, indicates that data prior to
767
767
/// the first sample of the input buffer was discarded due to an overflow, possibly
768
768
/// because the stream callback is using too much CPU time. Otherwise indicates that
769
769
/// 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 ;
771
771
/// Indicates that output data (or a gap) was inserted, possibly because the stream
772
772
/// callback is using too much CPU time.
773
- const OUTPUT_UNDERFLOW = ffi:: OUTPUT_UNDERFLOW ,
773
+ const OUTPUT_UNDERFLOW = ffi:: OUTPUT_UNDERFLOW ;
774
774
/// 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 ;
776
776
/// Some of all of the output data will be used to prime the stream, input data may be
777
777
/// zero.
778
- const PRIMING_OUTPUT = ffi:: PRIMING_OUTPUT ,
778
+ const PRIMING_OUTPUT = ffi:: PRIMING_OUTPUT ;
779
779
}
780
780
}
781
781
@@ -850,7 +850,7 @@ impl<S: Sample> Parameters<S> {
850
850
/// `UseHostApiSpecificDeviceSpecification` flag.
851
851
pub fn from_c_params ( c_params : ffi:: PaStreamParameters ) -> Option < Self > {
852
852
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 ) ;
854
854
let c_sample_format = SampleFormat :: from_flags ( c_params. sampleFormat . into ( ) ) ;
855
855
if S :: sample_format ( ) != c_sample_format {
856
856
return None ;
@@ -883,7 +883,7 @@ impl<S: Sample> From<Parameters<S>> for ffi::PaStreamParameters {
883
883
let sample_format = S :: sample_format ( ) ;
884
884
let mut sample_format_flags = sample_format. flags ( ) ;
885
885
if !is_interleaved {
886
- sample_format_flags. insert ( sample_format_flags :: NON_INTERLEAVED ) ;
886
+ sample_format_flags. insert ( SampleFormatFlags :: NON_INTERLEAVED ) ;
887
887
}
888
888
ffi:: PaStreamParameters {
889
889
device : device. into ( ) ,
0 commit comments