Skip to content

Commit

Permalink
Don’t initialize the AUGraph until after setting AudioUnit parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sbooth committed Aug 14, 2013
1 parent 0d502ce commit 63c40be
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Player/AudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2226,20 +2226,7 @@ bool AudioPlayer::OpenOutput()
mAUGraph = nullptr;
return false;
}

// Initialize the graph
result = AUGraphInitialize(mAUGraph);
if(noErr != result) {
LOGGER_ERR("org.sbooth.AudioEngine.AudioPlayer", "AUGraphInitialize failed: " << result);

result = DisposeAUGraph(mAUGraph);
if(noErr != result)
LOGGER_ERR("org.sbooth.AudioEngine.AudioPlayer", "DisposeAUGraph failed: " << result);

mAUGraph = nullptr;
return false;
}

// Set the mixer's volume on the input and output
AudioUnit au = nullptr;
result = AUGraphNodeInfo(mAUGraph, mMixerNode, nullptr, &au);
Expand Down Expand Up @@ -2330,6 +2317,19 @@ bool AudioPlayer::OpenOutput()
}
#endif

// Initialize the graph
result = AUGraphInitialize(mAUGraph);
if(noErr != result) {
LOGGER_ERR("org.sbooth.AudioEngine.AudioPlayer", "AUGraphInitialize failed: " << result);

result = DisposeAUGraph(mAUGraph);
if(noErr != result)
LOGGER_ERR("org.sbooth.AudioEngine.AudioPlayer", "DisposeAUGraph failed: " << result);

mAUGraph = nullptr;
return false;
}

return true;
}

Expand Down

0 comments on commit 63c40be

Please sign in to comment.