
Windows CoreAudio API in C# - sverrirs
http://hardkjarni.blogspot.com/2016/02/windows-coreaudio-api-in-c.html
======
Someone1234
The code is well structured and easy to read. Thanks for the example.

Random aside: Why do so many C# coders use #region/#endregion? It really seems
like a bad habit that discourages otherwise good coders from splitting their
code into logical OOP silos and instead they dump too much code into a single
file, and then use regions to regain some kind of order...

Regions are like goto in that they don't within their own right do anything
"bad" they just encourage really bad habits, and people start to think about
things in terms of regions. Plus finding things in a project which contains
tons of really long code files with regions is immensely harder than finding
them in a project with a lot of isolated classes and decent inheritance.

~~~
asveikau
> discourages ... from splitting their code into logical OOP silos

What you fail to see is those silos can be a prison. One of the worst
experiences I consistently have with heavily "OOP-person" code is you come to
a new source tree and there are so many little tiny do-nothing classes and
interfaces in individually tiny insignificant files that you can't come fresh
to the project and tell "where the meat is" by browsing the filesystem.
Putting those smaller interfaces and glue in a few mid-sized thematically
oriented source files can be a breath of fresh air relative to this.

~~~
sverrirs
Exactly this. There is a fine line with regions and they have their uses.

As an example, I was working on a project a while back that had StyleCop rules
set up so stringently that nothing could live in the same file, no enums,
structs, extension methods, nada. The amount of files you had to create when
adding new functionality (even a minor one) was mind boggling...

------
Someone
From the title, I wondered how to call Mac OS X's _" Core Audio"_
([https://en.m.wikipedia.org/wiki/Core_Audio](https://en.m.wikipedia.org/wiki/Core_Audio),
[https://developer.apple.com/library/mac/documentation/MusicA...](https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/CoreAudioOverview/WhatisCoreAudio/WhatisCoreAudio.html))
from Windows. My best guess was that QuickTime, or iTunes ship with DLLs
implementing it for Windows.

Turns out a bit of a disappointment for the hacker in me. Windows has an API
with the same name ([https://msdn.microsoft.com/en-
us/library/windows/desktop/dd3...](https://msdn.microsoft.com/en-
us/library/windows/desktop/dd370802\(v=vs.85\).aspx))

~~~
sverrirs
Hahaha, indeed. I didn't realize myself until I started looking into this that
MS named the system in Vista the same as the Apple team did in Panther. :)
Guess it is the nerd in us all wanting to be working on the "Core" stuff

------
ultramancool
Holy shit, thank you. I wrote a tool to mute a game automatically when I
backgrounded the window and was extremely annoyed when I found out that I had
to work with COM in C++. I knew absolutely 0 COM and had to clobber together
example code until I got something that barely worked and crashed randomly. I
figured C# had good COM integration and could do it but just couldn't quite
figure out how.

~~~
sverrirs
You're more than welcome, glad that you might find this useful. Hope this
HELPS "stabilise" things ;)

------
pjmlp
For those targeting WinRT, Windows 10 introduced AudioGraph for low latency
audio and it is supported for all languages able to use WinRT.

[https://msdn.microsoft.com/en-
us/library/windows/hardware/mt...](https://msdn.microsoft.com/en-
us/library/windows/hardware/mt298187%28v=vs.85%29.aspx)

