Coding - practical 3 Flashcards
1
Q
What are the two opposing principles for dealing with input?
A
- Continuously check if something has changed (known as “polling”)
- Set things up to alert us when something has changed ( callback).
2
Q
What is the difference between ‘void IAP::run()’ and the callback functions?
A
- IAP::run() = process data and text input.
- Callback functions (such as callbackNoteReceived()) = dealing with MIDI input.
3
Q
Describe the 4 parts of ‘void IAP::callbackNoteReceived (int note, int velocity, int channel)’.
A
- void = return datatype
- IAP = ownership
- callbackNoteReceived = the name of our callback function, these must be typed exactly as they appear, other callback functions have similar names (i.e. for mod wheel).
- (int note, int velocity, int channel) = the parameters of our callback function, these are the pieces of data passed to us for processing.
4
Q
What is the formula for converting MIDI note numbers into frequencies?
A
f = 440 × 2 to the power of (n−69)/12
5
Q
What happens when we call aserveOscillator()?
A
We are passing values into a function that deals with communicating with aserve.