FAQ

 
Q: Why is your code so un-optimized? Why don’t you use functions or assembly stubs or more optimized calculations or function pointers, etc…?.”
Q: I get the following compiler error: “Error spawning ‘cl.exe’ as in this screenshot:”.”

Q: I get the following link error: “LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt”.”
Q: I’m running Windows 7 and the compiler can’t be found even though it is installed and I have set it correctly in Preferences. What’s happening?”.”
Q: I’m running Windows 8 64-bit and Visual Studio 2012 and RackAFX won’t start!”.”
Q: When installing a new version of the software, I get a message that says “The feature you are trying to use is on a network resource that in unavailable” and you are not able to access it. When you cancel out, you get a message saying an “older version could not be installed.”
Q: When installing on Windows Vista or Windows 7 you get a message saying “This application has failed to start because its side by side configuration is incorrect.”
Q: I am running Parallels and I get an “Invalid URI: the host name could not be found” messages when debugging or starting the software. What’s happening?.”
Q: Can I copy a project so I don’t have to re-enter all the slider and button information again?
Q: What if I only want to copy the controls (sliders and buttons) into a new project but I don’t want the other files?
Q: Why does it take the compiler so long to start?
Q: My code compiles OK but fails to produce a DLL with the error:LINK : fatal error LNK1104: cannot open file ‘C:\Documents and Settings\…\<Your Plug In>.dll
Q:Why does Visual Studio ask me to save my .sln file?
Q: How do I stop the annoying messages in Visual Studio telling me the files have changed each time I alter my Project?
Q: How do I stop the annoying messages in Visual Studio asking me to save files each time I compile or rebuild?
Q: What is a UINT?
Q: Why do you use those weird variable names like m_fVolume? What’s with the little letters and underscores?
Q: Why does the screen flash every time I add, remove or edit a slider or button, or do a Rebuild?
Q: How can I make the screen stop flashing when I add, remove or edit a slider or button, or do a Rebuild?
Q. If the first string in an enumerated list is always the default, how do I change the default value if my controls are sharing the same enum String List?
Q: When I do a Rebuild from RackAFX, I get a brief message saying that the VS Log File is not found, but then the Rebuild occurs. What’s happening?
Q: When I do a Rebuild from RackAFX, I get a message saying that the VS Log File is not found and the Rebuild doesn’t occur.
Q: RackAFX reports that the build fails every time even though it builds OK.

Q: When I hit the Sound Adapter Input button, I hear feedback, echoes and horrible screeching. What’s happening?
Q: What happens behind the scenes when I click “Make VST Compatible?”
Q: My Plug-In runs fine in a VST client. After I play some data through it, the CPU meter begins creeping up and eventually maxes out the CPU! This doesn’t happen in RackAFX. What is wrong?
Q: The FIR Designer Plug-In has problems with the Optimal Method when the filter order is high (>100 or so); the filters either blow up or produce poor results. Why?

 

Answers

Q: Why is your code so un-optimized? Why don’t you use functions or assembly stubs or more optimized calculations or function pointers, etc…?

A: The book was designed to teach the basics. It is not about trick-code. I try as much as I can to simply populate the existing plug-in functions and not get caught up in creating other functions. However, in some cases (eg the Phaser Project) it is necessary, so I do function-ize repetitive tasks when needed. You will also notice there is little to no basic C++ info in the book (I don’t explain what a pointer is, for example) because that is for a C++ reference of which there are many. If you have great C++ chops, then by all means make the code as streamlined as you wish!
Q: I get the following link error: “LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt”

A: You are using Visual Studio 2010 but you have not installed the Service Pack 1 (SP1)
Q: I get the following compiler error: “Error spawning ‘cl.exe’ as in this screenshot:.”

A: A RackAFX user reported this problem when using VS2008 without the C# module installed. The details are found at this Microsoft Support Center link.
Q: I’m running Windows 7 and the compiler can’t be found even though it is installed and I have set it correctly in Preferences. What’s happening?”
A: You must login as Administrator in Win7 to allow RackAFX to spawn the compiler’s executable.
Q: I’m running Windows 8 64-bit and Visual Studio 2012 and RackAFX won’t start!”

A: You need to download and install the 2008 C++ (X86) redistributable from Microsoft; this will be fixed in the next version of the Installer (it is an installer issue, not a RackAFX issue). Get it here: http://www.microsoft.com/en-us/download/details.aspx?id=15336
Q: When installing a new version of the software, I get a message that says “The feature you are trying to use is on a network resource that in unavailable” and you are not able to access it. When you cancel out, you get a message saying an “older version could not be installed.”

A: This is a Windows Installer Engine issue. Run the Fix-It utility that Microsoft provides at this address:

http://support.microsoft.com/mats/Program_Install_and_Uninstall

 

Q: When installing on Windows Vista or Windows 7 you get a message saying “This application has failed to start because its side by side configuration is incorrect.”

A: First, make sure you have a legal version of Visual Studio 2008 or 2010 Express or Pro installed first. If you already do, then use the fix Microsoft provides at this address:
http://www.ehow.com/how_7535388_repair-sidebyside-configuration-error.html
Q: I am running Parallels and I get an “Invalid URI: the host name could not be found” messages when debugging or starting the software. What’s happening?

A: You will get this error if you are using a Parallels Shared Folder for either RackAFX or your Projects folder. The shared folders are .psf which is invalid to Visual Studio. To fix this:

1. Inside of XP/Win7/Vista in Parallels, Map a Network Drive ‘X’ to the ‘Home’ folder.
2. Open the RackAFX .prj file in the Networked Drive when you open your project; you will have to browse to the computer, then the mapped drive, etc…

Bottom line: .psf paths won’t work properly with Visual Studio integration.
Q: Can I copy a project so I don’t have to re-enter all the slider and button information again?

A: Yes, you can make backups, clones or derivative projects using the File->Save Project As… menu item. It will copy your files and create new Visual Studio project files that include the source files. You can then open that project up and continue working from there.
Q: What if I only want to copy the controls (sliders and buttons) into a new project but I don’t want the other files?

A: You can use File->Import controls from another project to import only the GUI controls and variables.
Q: Why does it take the compiler so long to start?

A: Visual Studio 2010 is known for having a very long startup time. VS2008 is much faster. See also:
http://social.msdn.microsoft.com/Forums/nb-NO/vssetup/thread/1f182752-e776-4656-9eb6-227f448c8e48
http://social.msdn.microsoft.com/Forums/en-US/vseditor/thread/da99b290-93c2-4ef0-a51a-1c117c549ff1
Q: My code compiles OK but fails to produce a DLL with the error:

LINK : fatal error LNK1104: cannot open file ‘C:\Documents and Settings\…\<Your Plug In>.dll’

A: This is most likely because you still have it loaded in the software. Unload it first. NOTE: If you use the <Rebuild> button in the software, RackAFX will automatically unload the DLL for you.
Q: Why does Visual Studio ask me to save my .sln file?

A: If you setup your environment correctly (see next two questions) then you should only see this when RackAFX changes your .sln file. This can happen:

– the very first time you create a new project and try to build it
– if you alter some of the project settings in Edit Project such as adding libraries, compiling for VST, etc… If changes are made to the .sln file, Visual Studio is going to prompt you to save them.
– if you change versions of Visual Studio
Q: How do I stop the annoying messages in Visual Studio telling me the files have changed each time I alter my Project?

A: Go to Tools->Options->Environment->Documents and check (enable) the following options:

“Detect when file is changed outside the environment”
“Auto-load changes, if saved.”
“Allow editing of Read Only files;warn when attempt to save”
Q: How do I stop the annoying messages in Visual Studio asking me to save files each time I compile or rebuild?

A: Go to Tools->Options->Projects and Solutions->Build and Run and select the following options:

Before Building: “Save all changes”
On Run, when projects are out of date: “Always build.”
Q: What is a UINT?

A: A UINT is an unsinged integer. UINT is a typedef for “unsigned long” which is an unsigned, 32-bit integer value. UINT is simpler that writing “unsigned long” and this datatype is often typedef’ed in other OS/languages too. For example, Apple typedef’s this type as “UInt32.”
Q: Why do you use those weird variable names like m_fVolume? What’s with the little letters and underscores?

A: “Long, long ago in the early days of DOS, Microsoft’s Chief Architect Dr. Charles Simonyi introduced an identifier naming convention that adds a prefix to the identifier name to indicate the functional type of the identifier.

This system became widely used inside Microsoft. It came to be known as “Hungarian notation” because the prefixes make the variable names look a bit as though they’re written in some non-English language and because Simonyi is originally from Hungary.

As it turns out, the Hungarian naming convention is quite useful – it’s one technique among many that helps programmers produce better code faster. Since most of the headers and documentation Microsoft has published over the last 15 years have used Hungarian notation names for identifiers, many programmers outside of Microsoft have adopted one variation or another of this scheme for naming their identifiers.

Perhaps the most important publication that encouraged the use of Hungarian notation was the first book read by almost every Windows programmer: Charles Petzold’s Programming Windows. It used a dialect of Hungarian notation throughout and briefly described the notation in its first chapter.” – MSDN Website http://msdn.microsoft.com/en-us/library/aa260976(v=vs.60).aspx

Hungarian Notation is also found in Apple documentation and templates such as the Audio Units (AU) template.

The m_ denotes that the variable is a member of an object.

The little letter after the m_ (if there is an m_) denotes the type of variable:

n = int
f = float
d = double
u = UINT
p = pointer

Why do this? First, it is a convention that most programmers understand. If you don’t like it you are free to name your variables however you wish. But, when the code becomes very complex, it is often helpful to have a hint as to what kind of variable you are dealing with. For example, suppose you have a variable named “volume” that is declared as an int. During your debugging, you can’t figure out why the value doesn’t change properly when you multiply or divide it by other numbers. If you had named it nVolume, you would realize you have an integer type and it won’t produce fractional values when multiplied or divided. Hungarian notation is especially useful for pointers – having the “p” before the name will prevent you from trying to use it as a normal variable. Using pointers incorrectly usually results in failed code.

Variables that are member variables of objects will persist after a function call ends. Knowing that a variable is a member variable rather than a local function variable is important. Local function variables don’t persist after the function ends.
Q: Why does the screen flash everytime I add, remove or edit a slider or button, or do a Rebuild?

A: Your compiler must momentarily be brought to the front while RackAFX modifies the code; this actually has to do with how RackAFX automatically saves your work before modifying it.
Q: How can I make the screen stop flashing when I add, remove or edit a slider or button, or do a Rebuild?

A: Keep your compiler minimized. In the minimized state, it does not need to be brought to the front in order to receive commands from RackAFX. You can always restore the compiler window and bring it to the front by using the “->C++” button in the button control bank on the right.
Q. If the first string in an enumerated list is always the default, how do I change the default value if my controls are sharing the same enum String List?

A: Fill in the initialize() method. This function is called after construction and after the parent window handle has been set. You can initialized any control variables here then call sendUpdateGUI() to have the GUI update itself. See Appendix B in the book for more details on sendUpdateGUI.

Suppose you have 4 enumerated UINT control variables that share the same list (these happen to be from the Joystick Dropdown boxes):

UINT m_uMyComboVariable1;
enum{LPF,BPF,HPF,BSF};
UINT m_uMyComboVariable2;
UINT m_uMyComboVariable3;
UINT m_uMyComboVariable4;

In the initalize() method you would set them, then call the update function:

bool <YourPlugIn>::initialize()
{
// initialize the UINTs
m_uMyComboVariable1 = LPF;
m_uMyComboVariable2 = BPF;
m_uMyComboVariable3 = HPF;
m_uMyComboVariable4 = BSF;

// call the update method
sendUpdateGUI();

// success
return true;
}

Now, whem your Plug-In is loaded, the controls will initialize to the above values.
Q: When I do a Rebuild from RackAFX, I get a brief message saying that the VS Log File is not found, but then the Rebuild occurs. What’s happening?

A: The Log File is deleted prior to the build. Sometimes, the compiler lags behind and RackAFX thinks momentarily that the log file is not there. This is not a big error and usually the compiler “catches up” and Rebuilds more quickly after the first time.
Q: When I do a Rebuild from RackAFX, I get a message saying that the VS Log File is not found and the Rebuild doesn’t occur.

A: You have to enable build logging in Visual Studio.

VS 2008 & 2010: Use Tools->Options->Projects and Solutions and make sure Build Logging says YES.
Q: RackAFX reports that the build fails every time even though it builds OK.

A: This is probably because either Build Logging is turned off or the Build Logging Verbosity is set to “Quiet.” See the previous answer to turn Logging on. The second issue will only happen in VS2010 as the Log Verbosity option doesn’t exist in VS2008.

VS2010: Use Tools->Options->Build and Run and make sure “MSBuild project build log file Verbosity” is set to anything other than Quiet; I recommend Minimal for this setting.

A future version of RackAFX will let you turn on and off the “Follow the Build” so you don’t see erroneous messages.
Q: When I hit the Sound Adapter Input button, I hear feedback, echoes and horrible screeching. What’s happening?

A: This will occur if the Windows audio system is confused. This usually happens if you have a Plug-In crash while debugging or if you crash RackAFX as a result of a bad Plug-In DLL. There may be other ways to do this but the way to restore your audio system is to reboot Windows.
Q: What happens behind the scenes when I click “Make VST Compatible?”

A: First, a bunch of files are copied into your Project folder including the libraries I wrote to wrap the RackAFX Plug-Ins and provide VST Host Communications. Next, 3 lines are altered in your Visual Studio Projects files and all of them involve linking. If you look at the Link settings you can see the addition of the new .lib files, one Ignore file, and vstplug.def being set as the definition file.
Q: My Plug-In runs fine in a VST client. After I play some data through it, the CPU meter begins creeping up and eventually maxes out the CPU! This doesn’t happen in RackAFX. What is wrong?

A: The answer is underflow. In many VST clients, when audio data is not streaming the system is still running but sending a constant stream of zeros. Ableton Live is like this; even with no play buttons pressed a constant stream of zeros is being fed to your Plug-In. This is a problem if your plug-in has any kind of feedback path (any IIR filter, delay line, etc…). The last few samples get stuck in the feedback loop and loop forever, multiplied by your coefficients. Eventually, the numbers become too small to represent with a floating point number (see chapter 1) and you will see …#DEN in the debugger – this is a “DENormalized” number and is very brutal on the CPU when trying to do mathematical operations on it. If you look at the CBiQuad object in pluginconstants.h you will see the protection mechanism I built into it during doBiQuad()

// underflow check
if(yn > 0.0 && yn < FLT_MIN_PLUS) yn = 0;
if(yn < 0.0 && yn > FLT_MIN_MINUS) yn = 0;

FLT_MIN_PLUS and FLT_MIN_MINUS are defined at the top of the file; you can lift them and place in your own objects. The reason it doesn’t happen in RackAFX is that no audio streams if you are in the stopped state. You could simulate this by creating a wave file full of zeros for minutes, then load and “play” the blank file and wait for the CPU to begin moving up; at that point, start the debugger and put a breakpoint in your processAudioFrame() function – check your variables and those of your member objects to find the #DEN offenders.
Q: The FIR Designer Plug-In has problems with the Optimal Method when the filter order is high (>100 or so); the filters either blow up or produce poor results. Why?

A: The problem goes all the way back to the original Parks-McClellan design. The full story is available here: Remez Exchange Problems