void CAPlayThrough::Cleanup() { //clean up Stop(); delete mBuffer; mBuffer = 0; if(mInputBuffer){ for(UInt32 i = 0; i<mInputBuffer->mNumberBuffers; i++) free(mInputBuffer->mBuffers[i].mData); free(mInputBuffer); mInputBuffer = 0; } AudioUnitUninitialize(mInputUnit); AUGraphClose(mGraph); DisposeAUGraph(mGraph); AudioComponentInstanceDispose(mInputUnit); }
void STACK_ARGS I_ShutdownMusic(void) { if(!music_initialized) return; #ifdef OSX DisposeMusicPlayer(player); AUGraphClose(graph); #else Mix_HaltMusic(); #endif I_UnRegisterSong(0); music_initialized = false; }
int main(int argc, const char *argv[]) { MyAUGraphPlayer player = {0}; // build a basic speech->speakers graph CreateMyAUGraph(&player); // configure the speech synthesizer PrepareSpeechAU(&player); // start playing CheckError(AUGraphStart(player.graph), "AUGraphStart failed"); // sleep a while so the speech can play out usleep ((int)(10 * 1000. * 1000.)); cleanup: AUGraphStop (player.graph); AUGraphUninitialize (player.graph); AUGraphClose(player.graph); DisposeAUGraph(player.graph); return 0; }
bool CCoreAudioGraph::Close() { if (!m_audioGraph) return false; OSStatus ret; Stop(); SetInputSource(NULL); while (!m_auUnitList.empty()) { CAUOutputDevice *d = m_auUnitList.front(); m_auUnitList.pop_front(); ReleaseBus(d->GetBus()); d->Close(); delete d; } if (m_inputUnit) { ReleaseBus(m_inputUnit->GetBus()); m_inputUnit->Close(); delete m_inputUnit; m_inputUnit = NULL; } if (m_mixerUnit) { m_mixerUnit->Close(); delete m_mixerUnit; m_mixerUnit = NULL; } if (m_audioUnit) { m_audioUnit->Close(); delete m_audioUnit; m_audioUnit = NULL; } ret = AUGraphUninitialize(m_audioGraph); if (ret) { CLog::Log(LOGERROR, "CCoreAudioGraph::Close: Error unitialize. Error = %s", GetError(ret).c_str()); } ret = AUGraphClose(m_audioGraph); if (ret) { CLog::Log(LOGERROR, "CCoreAudioGraph::Close: Error close. Error = %s", GetError(ret).c_str()); } ret = DisposeAUGraph(m_audioGraph); if (ret) { CLog::Log(LOGERROR, "CCoreAudioGraph::Close: Error dispose. Error = %s", GetError(ret).c_str()); } return true; }
JNIEXPORT jint JNICALL Java_com_apple_audio_toolbox_AUGraph_AUGraphClose (JNIEnv *, jclass, jint inGraph) { return (jint)AUGraphClose((AUGraph)inGraph); }