thestk / rtaudio

A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO, and WASAPI) operating systems.
Other
1.49k stars 318 forks source link

WASAPI backend doesn't support exclusive mode? #181

Open laiyonghao opened 5 years ago

laiyonghao commented 5 years ago

Hello,

I added RTAUDIO_HOG_DEVICE to StreamOptions object, but my application doesn't worked on EXCLUSIVE MODE.

    RtAudio::StreamOptions so;
    so.flags =  RTAUDIO_MINIMIZE_LATENCY | RTAUDIO_SCHEDULE_REALTIME | RTAUDIO_HOG_DEVICE;

I read the RtAudio.cpp file and found AUDCLNT_SHAREMODE_SHARED is passed to renderAudioClient->Initialize(),

renderAudioClient->Initialize( AUDCLNT_SHAREMODE_SHARED,
                                          AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
                                          desiredBufferPeriod,
                                          desiredBufferPeriod,
                                          renderFormat,
                                          NULL );

Should be use AUDCLNT_SHAREMODE_EXCLUSIVE here, and do other changes accordingly, when RTAUDIO_HOG_DEVICE is set to so.flags?

compiler: VC2013 OS: Windows 7 SP1 RtAudio: 5.0.0

MarcusTomlinson commented 5 years ago

The WASAPI backend does not currently support exclusive mode. No promises, but I'll see if I can get to it over the weekend.

garyscavone commented 5 years ago

To be honest, I don’t think the HOG_DEVICE flag has ever been fully supported in RtAudio. The flag was created during design stages but actual implementation turned out to be difficult or impossible in many cases. I vaguely recall testing it (10 years ago or more) in OS-X, where it seemed like the API would support it, and found that it didn’t work.

On Jan 17, 2019, at 4:45 AM, Marcus Tomlinson notifications@github.com wrote:

The WASAPI backend does not currently support exclusive mode. No promises, but I'll see if I can get to it over the weekend.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thestk/rtaudio/issues/181#issuecomment-455108193, or mute the thread https://github.com/notifications/unsubscribe-auth/AFOBpUJ9Pl7_Sd8gFy57ewPZXeztfoc1ks5vEEZVgaJpZM4aEwWt.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/thestk/rtaudio","title":"thestk/rtaudio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/thestk/rtaudio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@MarcusTomlinson in #181: The WASAPI backend does not currently support exclusive mode. No promises, but I'll see if I can get to it over the weekend."}],"action":{"name":"View Issue","url":"https://github.com/thestk/rtaudio/issues/181#issuecomment-455108193"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/thestk/rtaudio/issues/181#issuecomment-455108193", "url": "https://github.com/thestk/rtaudio/issues/181#issuecomment-455108193", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

angryoctopus commented 4 years ago

Is there any progress on this? I would really like to get to get the audio latency down and it seems this is the only way to get anything below 10ms. Apparently for pro audio you need to use the IAudioClient3::Initialize to set the actual OS buffer size.

MarcusTomlinson commented 4 years ago

No progress, no. It’s not even been on my radar to be honest. I’ll add it to my todo then. Of course, if you’d like to give it a go @angryoctopus, I’d be happy to review.

angryoctopus commented 4 years ago

I might take a look and see if I can figure it out.

sonoro1234 commented 4 years ago

smallest latency in windows happens with ASIO.

angryoctopus commented 4 years ago

I'm aware you can get low latency with ASIO but it does put a burden on the end user to install/configure ASIO drivers.

Abhishek0815 commented 2 years ago

@MarcusTomlinson pls update if it is fixed? in desperate need of help. I am using rtAudio for my project.I needed MicRaw signal(without any APO effects) ,"WASAPI exclusive mode" capture seems only option.

thanks