Open jeremyletang opened 10 years ago
Ah - could this be why I'm getting pa_jack prefixed functions not found? Maybe portaudio was compiled with the jack specific extension on my system? Here's a gist of what I see when I try to run my project that depends on rust-portaudio
by way of sound_stream
.
Yeah it looks like that might be the case! I don't think any of these extensions have been implemented yet, but I think it'd be great to make a start.
BTW, I just deprecated sound_stream last night (it's now a full version behind rust-portaudio)! I made some changes to the rust-portaudio API that make it much nicer and more rusty to use, and I realised there's not much more sound_stream
could offer on top that would be worth maintaining. I'd recommend changing to use rust-portaudio directly (see the examples
directory for a demo on how to use it).
Ah ok. I did try just rust-portaudio, same error. I'll have a look into how rust-portaudio works and see if I can contribute something for this issue.
X-Post from #136
I only have OS X available to me at the moment, but I'm hoping to use rust-portaudio w/ ALSA for some embedded audio stuff mid-next month, so I'll have a go at the ALSA one then if someone doesn't beat me to it. It shouldn't be too tricky to run rust-bindgen on the necessary header and set it up.
A while ago I got a VST host working with rust-portaudio with ASIO: For that I added these definitions:
#[allow(dead_code, non_snake_case)]
struct AsioStreamInfo {
size: u32,
hostApiType: pa::HostApiTypeId,
version: u32,
flags: u32,
channelSelectors: *const u32,
}
// const paAsioUseChannelSelectors: u32 = 0x01;
#[allow(dead_code, non_camel_case_types)]
enum PaHostApiTypeId {
paInDevelopment=0, /* use while developing support for a new host API */
paDirectSound=1,
paMME=2,
paASIO=3,
paSoundManager=4,
paCoreAudio=5,
paOSS=7,
paALSA=8,
paAL=9,
paBeOS=10,
paWDMKS=11,
paJACK=12,
paWASAPI=13,
paAudioScienceHPI=14
}
type PaWinWaveFormatChannelMask = c_ulong;
type PaWasapiHostProcessorCallback = *const ();
#[allow(dead_code, non_camel_case_types)]
enum PaWasapiThreadPriority {
eThreadPriorityNone = 0,
eThreadPriorityAudio, // !< Default for Shared mode.
eThreadPriorityCapture,
eThreadPriorityDistribution,
eThreadPriorityGames,
eThreadPriorityPlayback,
eThreadPriorityProAudio, // !< Default for Exclusive mode.
eThreadPriorityWindowManager
}
#[allow(dead_code, non_camel_case_types)]
enum PaWasapiStreamCategory {
eAudioCategoryOther = 0,
eAudioCategoryCommunications = 3,
eAudioCategoryAlerts = 4,
eAudioCategorySoundEffects = 5,
eAudioCategoryGameEffects = 6,
eAudioCategoryGameMedia = 7,
eAudioCategoryGameChat = 8,
eAudioCategorySpeech = 9,
eAudioCategoryMovie = 10,
eAudioCategoryMedia = 11
}
#[allow(dead_code, non_camel_case_types)]
enum PaWasapiStreamOption {
eStreamOptionNone = 0, // !< default
eStreamOptionRaw = 1, // !< bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
eStreamOptionMatchFormat = 2 // !< force WASAPI Audio Engine into a stream format, supported since Windows 10
}
#[allow(dead_code, non_camel_case_types)]
enum PaWasapiFlags {
/* puts WASAPI into exclusive mode */
paWinWasapiExclusive = (1 << 0),
/* allows to skip internal PA processing completely */
paWinWasapiRedirectHostProcessor = (1 << 1),
/* assigns custom channel mask */
paWinWasapiUseChannelMask = (1 << 2),
/* selects non-Event driven method of data read/write
Note: WASAPI Event driven core is capable of 2ms latency!!!, but Polling
method can only provide 15-20ms latency. */
paWinWasapiPolling = (1 << 3),
/* forces custom thread priority setting, must be used if PaWasapiStreamInfo::threadPriority
is set to a custom value */
paWinWasapiThreadPriority = (1 << 4)
}
#[allow(dead_code, non_snake_case)]
struct PaWasapiStreamInfo {
size: c_ulong, /** < sizeof(PaWasapiStreamInfo) */
hostApiType: PaHostApiTypeId, /**< paWASAPI */
version: c_ulong, /** < 1 */
flags: c_ulong, /** < collection of PaWasapiFlags */
/* Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
paWinWasapiUseChannelMask this allows you to specify which speakers
to address in a multichannel stream. Constants for channelMask
are specified in pa_win_waveformat.h. Will be used only if
paWinWasapiUseChannelMask flag is specified.
*/
channelMask: PaWinWaveFormatChannelMask,
/* Delivers raw data to callback obtained from GetBuffer() methods skipping
internal PortAudio processing inventory completely. userData parameter will
be the same that was passed to Pa_OpenStream method. Will be used only if
paWinWasapiRedirectHostProcessor flag is specified.
*/
hostProcessorOutput: PaWasapiHostProcessorCallback,
hostProcessorInput: PaWasapiHostProcessorCallback,
/* Specifies thread priority explicitly. Will be used only if paWinWasapiThreadPriority flag
is specified.
Please note, if Input/Output streams are opened simultaniously (Full-Duplex mode)
you shall specify same value for threadPriority or othervise one of the values will be used
to setup thread priority.
*/
threadPriority: PaWasapiThreadPriority,
/* Stream category. */
streamCategory: PaWasapiStreamCategory,
/* Stream option. */
streamOption: PaWasapiStreamOption,
}
Can they be added to this lib?
Portaudio can be built using some specific extensions depending of the platform, we may should implement them.
Here is a list of these library:
linux & unix
linux & unix & mac os x
mac os x
windows