Windows CoreAudio API in C#
hardkjarni.blogspot.com
Windows CoreAudio API in C#
1–10 of 30 posts
Re: Windows CoreAudio API in C#
#2Turns 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...)
Re: Windows CoreAudio API in C#
#3From the title, I wondered how to call Mac OS X's "Core Audio" ( https://en.m.wikipedia.org/wiki/Core_Audio , https://developer.apple.com/library/mac/documentation/MusicA... ) 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/win…
Re: Windows CoreAudio API in C#
#4Random 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.
Re: Windows CoreAudio API in C#
#5The 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…
Re: Windows CoreAudio API in C#
#6The 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…
The region paradigm is very often misused and is one of those things that starts off nice and then degrades as time goes on (meaning new functions get added in the wrong region, refactorings end up all over the place, etc). I prefer them though over partial classes (shudder) and when properly used they can be a huge timesaver when dealing with those annoying UBER-Forms that tend to happen when dealing with legacy WinForms code :)
Re: Windows CoreAudio API in C#
#7The 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…
I don't get C# regions, either. At least Visual Studio makes it easy to auto-expand them and effectively ignore them while jumping around with incremental search and goto definition. Admittedly, this would be a problem if the rest of the team cared about maintaining the regions.
But they indeed depend on the team's total commitment on keeping them organized and up-to-date.
Re: Windows CoreAudio API in C#
#8The 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…
This is similar to my experience.
I use regions pretty often when I'm refactoring overgrown legacy code, especially older MVC apps (where the controllers get insane)
Basically what you said, but reversed. I use regions as a first step to regaining some kind of order, then continue to pull things apart into more properly factored classes, methods, etc. It helps me mentally map things out. Of course there're a bunch of ways you could do that, but Visual Studio has good support for folding regions, so I prefer it.
That folding is the second reason I'll use them sometimes. If I have a really awkward part of code that I'd like to fold for whatever reason, I'll occasionally use them if I think it'll make things more readable.
I agree with the idea, though. Every time I use a region I have to stop and think "am I just hiding bad design?"
Re: Windows CoreAudio API in C#
#9The 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…
From sibling post: > when dealing with those annoying UBER-Forms that tend to happen when dealing with legacy WinForms code :) This is similar to my experience. I use regions pretty often when I'm refactoring overgrown legacy code, especially older MVC apps (where the controllers get insane) Basically what you said, but reversed. I use regions as a first step to regaining some kind of order, then continue to pull thi…
Oh dear lord the MVC madness I've seen... thousand yard stare
Re: Windows CoreAudio API in C#
#10Earlier quoted context omitted.
From sibling post: > when dealing with those annoying UBER-Forms that tend to happen when dealing with legacy WinForms code :) This is similar to my experience. I use regions pretty often when I'm refactoring overgrown legacy code, especially older MVC apps (where the controllers get insane) Basically what you said, but reversed. I use regions as a first step to regaining some kind of order, then continue to pull thi…
>older MVC apps (where the controllers get insane). Oh dear lord the MVC madness I've seen... thousand yard stare