Skip to content

Commit

Permalink
Initialize struct values to 0 based on docs
Browse files Browse the repository at this point in the history
The docs for AudioComponentDescription say that componentFlags and
componentFlagsMask must be set to 0 unless specific values are
requested.

Different platforms (32 vs 64 bit) initialize data to different starting
values. Ensure the AudioComponentDescription is initialized to prevent
unwanted side effects.
  • Loading branch information
streeter committed Feb 4, 2016
1 parent 5ff1d04 commit 664f788
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions EZAudio/EZMicrophone.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ - (void)setup
#elif TARGET_OS_MAC
inputComponentDescription.componentSubType = kAudioUnitSubType_HALOutput;
#endif
// The following must be set to zero unless a specific value is requested.
inputComponentDescription.componentFlags = 0;
inputComponentDescription.componentFlagsMask = 0;

// get the first matching component
AudioComponent inputComponent = AudioComponentFindNext( NULL , &inputComponentDescription);
Expand Down

0 comments on commit 664f788

Please sign in to comment.