Main » Emulation » Help wanted: Windows dynamic rate control support » New reply
    Alert
    You are about to bump an old thread. This is usually a very bad idea. Please think about what you are about to do before you press the Post button.
    New reply
    Post help

    Presentation

    [b]…[/b] — bold type
    [i]…[/i] — italic
    [u]…[/u] — underlined
    [s]…[/s] — strikethrough
    [code]…[/code] — code block
    [spoiler]…[/spoiler] — spoiler block
    [spoiler=…]…[/spoiler]
    [source]…[/source] — colorcoded block, assuming C#
    [source=…]…[/source] — colorcoded block, specific language[which?]
    [abbr=…]…[/abbr] — abbreviation
    [color=…]…[/color] — set text color
    [jest]…[/jest] — you're kidding
    [sarcasm]…[/sarcasm] — you're not kidding

    Links

    [img]http://…[/img] — insert image
    [url]http://…[/url]
    [url=http://…]…[/url]
    >>… — link to post by ID
    [user=##] — link to user's profile by ID

    Quotations

    [quote]…[/quote] — untitled quote
    [quote=…]…[/quote] — "Posted by …"
    [quote="…" id="…"]…[/quote] — ""Post by …" with link by post ID

    Embeds

    [youtube]…[/youtube] — video ID only please
    Thread review
    Near I specifically want to maintain Windows 7 support.

    I realize its days are numbered, but a lot of people (including myself) dislike Windows 10.

    If we can offer 2.1 and 2.8 simultaneously, with 2.8 simply not being available on 7, that could work.

    Then again, waveOut, DirectSound, and XAudio2 all use the same backend anyway. There's not really a lot of point to using XAudio when waveOut is perfectly fine.

    Microsoft, like me, just likes to keep reinventing things constantly.
    Nicholas Steel I believe he wants XAudio v2.1 to retain support for Windows 7, Vista and maybe XP. Newer versions are restricted to Windows 8 and newer. Byuu, during your current installation of the O/S have you run the DirectX Web Updater? It installs a bunch of stuff that the June 2010 Redistributable Package doesn't.
    SuperMikeMan
    Posted by byuu
    It turns out I can't test XAudio 2.1
    Does the DirectX SDK for XAudio 2.7 not install on Windows 10 any more?

    If it really doesn't, then maybe my 6 year old patch to xaudio2.hpp and ruby makefile to make it use XAudio 2.8 (the Windows 8 version that your Windows 10 should definitely already have) instead is finally of some use to you, just to let you be able to test it.

    https://helmet.kafuka.org/byuubackup/viewtopic.php@f=3&t=3633.html long post most of the way down that link. Yes, that's the older archive, that's how old that is.
    CaptainJistuce Hooray!
    Near It turns out I can't test XAudio 2.1 because it's just not available on Windows 10.

    But for waveOut, I had to patch the processing code around a bit, and increase the buffer count, but ...... it works!! :D

    Hooray, thank you so much!!
    Near Oh no, my naming choice came back to bite me.

    I should have named the functions available() or remaining() to avoid inverting what they return and not realizing it.

    Thank you so, so much! ^-^ I will test this out and report back.
    BearOso Something like this should work for XAudio2:
      auto level() -> double override {
    XAUDIO2_VOICE_STATE state{};
    self.sourceVoice->GetState(&state);
    uint level = state.BuffersQueued * self.period + self.buffers[self.index].size() - state.SamplesPlayed % self.period;
    uint limit = Buffers * self.period;
    return (double)level / limit;
    }
    and this for WaveOut:
      auto level() -> double override {
    return (double)((blockQueue * frameCount) + frameIndex) / (blockCount * frameCount);
    }
    BearOso I think the level function should just be ((blockQueue * frameCount) + frameIndex) / (blockCount * frameCount)

    You could try filling the buffer halfway with silence when detecting it’s empty (on initialization and underruns).

    *edit*
    It looks like you’ve inverted the level in the xaudio driver. In the OSS level is reporting % filled, but xaudio is reporting % empty.
    hunterk Is it possible you're overthinking it? It shouldn't matter how small the buffer is, AFAIK, just whether it's more than half-full or less than half-empty.

    That is, since you already have your resampler, you just need to specify a "max timing skew" (how much you're going to resample up or down; 0.005 is the default in RetroArch) and then check your buffer on each frame. Is it more than half full? resample down. Is it less than half-empty? resample up.

    Disclaimer: I've never implemented it myself, but I've spoken with themaister about it conceptually many times.
    Near Pretty much the last major feature I've wanted for years but still can't pull off is DRC.

    Thanks to BearOso's code, I was able to manage this for OSS on FreeBSD. But that's a pretty niche OS. I'd really like to get this into bsnes on Windows.

    I attempted the same with XAudio2, but it failed:
    https://gitlab.com/higan/higan/blob/master/ruby/audio/xaudio2.cpp#L55

    Talarubi gave debugging it hir all, but it would appear that the issue is XAudio2 has a minimum buffer size that is too large, and requesting a smaller size just gives you a larger buffer anyway. I don't know how to square that away with Snes9X purportedly supporting DRC with XAudio2, but maybe it's due to emulation core differences.

    I saw that Snes9X recently implemented DRC through waveOut to avoid the limitations of DirectSound and DRC, so I tried the same:
    https://gitlab.com/higan/higan/blob/master/ruby/audio/waveout.cpp

    But unfortunately, I'm at a loss as to how Snes9X is implementing its DRC through their driver. Specifically, I'm not sure how to create the required level() function in the waveOut driver.

    With any luck, it'll only be five or six lines of code. Would anyone with some spare time be up for lending a hand with this?
      Main » Emulation » Help wanted: Windows dynamic rate control support » New reply
      Yes, it's an ad.