Make coreaudio Voice Send/Sync.
This commit is contained in:
parent
c841be235c
commit
dbf9ae20da
|
@ -28,7 +28,7 @@ impl Endpoint {
|
||||||
{
|
{
|
||||||
Ok(vec!(Format {
|
Ok(vec!(Format {
|
||||||
channels: vec![ChannelPosition::FrontLeft, ChannelPosition::FrontRight],
|
channels: vec![ChannelPosition::FrontLeft, ChannelPosition::FrontRight],
|
||||||
samples_rate: SamplesRate(512),
|
samples_rate: SamplesRate(64),
|
||||||
data_type: SampleFormat::F32
|
data_type: SampleFormat::F32
|
||||||
}).into_iter())
|
}).into_iter())
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,9 @@ pub struct Voice {
|
||||||
samples_sender: Sender<(Vec<f32>, NumChannels)>,
|
samples_sender: Sender<(Vec<f32>, NumChannels)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl Sync for Voice {}
|
||||||
|
unsafe impl Send for Voice {}
|
||||||
|
|
||||||
impl Voice {
|
impl Voice {
|
||||||
pub fn new(endpoint: &Endpoint, format: &Format) -> Result<Voice, CreationError> {
|
pub fn new(endpoint: &Endpoint, format: &Format) -> Result<Voice, CreationError> {
|
||||||
// A channel for signalling that the audio unit is ready for data.
|
// A channel for signalling that the audio unit is ready for data.
|
||||||
|
@ -133,7 +136,7 @@ impl Voice {
|
||||||
samples: vec![unsafe{ mem::uninitialized() }; buffer_size],
|
samples: vec![unsafe{ mem::uninitialized() }; buffer_size],
|
||||||
num_channels: channels as usize,
|
num_channels: channels as usize,
|
||||||
marker: ::std::marker::PhantomData,
|
marker: ::std::marker::PhantomData,
|
||||||
len: 512
|
len: 64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue