// init mididriver jboolean Java_org_billthefarmer_accordion_MidiDriver_init(JNIEnv *env, jobject obj) { EAS_RESULT result; if (result = initEAS() != EAS_SUCCESS) { shutdownEAS(); LOG_E(LOG_TAG, "Init EAS failed: %ld", result); return JNI_FALSE; } // LOG_D(LOG_TAG, "Init EAS success, buffer: %ld", bufferSize); // allocate buffer in bytes buffer = (EAS_PCM *)malloc(bufferSize * sizeof(EAS_PCM)); if (buffer == NULL) { shutdownEAS(); LOG_E(LOG_TAG, "Allocate buffer failed"); return JNI_FALSE; } // create the engine and output mix objects if (result = createEngine() != SL_RESULT_SUCCESS) { shutdownEAS(); shutdownAudio(); free(buffer); buffer = NULL; LOG_E(LOG_TAG, "Create engine failed: %ld", result); return JNI_FALSE; } // create buffer queue audio player if (result = createBufferQueueAudioPlayer() != SL_RESULT_SUCCESS) { shutdownEAS(); shutdownAudio(); free(buffer); buffer = NULL; LOG_E(LOG_TAG, "Create buffer queue audio player failed: %ld", result); return JNI_FALSE; } // call the callback to start playing bqPlayerCallback(bqPlayerBufferQueue, NULL); return JNI_TRUE; }
HelmStandaloneEditor::~HelmStandaloneEditor() { midi_manager_ = nullptr; computer_keyboard_ = nullptr; gui_ = nullptr; keyboard_state_ = nullptr; shutdownAudio(); }
MainContentComponent::~MainContentComponent() { // fix denied access at close when sound playing, // see https://forum.juce.com/t/tutorial-playing-sound-files-raises-an-exception-on-2nd-load/15738/2 audioIOComponent.transportSource.setSource(nullptr); shutdownAudio(); }
// shutdown EAS midi jboolean Java_org_billthefarmer_accordion_MidiDriver_shutdown(JNIEnv *env, jobject obj) { shutdownAudio(); if (buffer != NULL) free(buffer); buffer = NULL; shutdownEAS(); return JNI_TRUE; }
// shutdown EAS midi jboolean Java_org_billthefarmer_mididriver_MidiDriver_shutdown(JNIEnv *env, jobject obj) { EAS_RESULT result; shutdownAudio(); if (buffer != NULL) free(buffer); buffer = NULL; shutdownEAS(); return JNI_TRUE; }
MainContentComponent::~MainContentComponent() { //[Destructor_pre]. You can add your own custom destruction code here.. inputFileListComponent->removeChangeListener(this); //[/Destructor_pre] waveformGroupBox = nullptr; waveformComponent = nullptr; inputGroupBox = nullptr; convGroupBox = nullptr; qSlider = nullptr; qLabel = nullptr; convButton = nullptr; authorLabel = nullptr; settingsButton = nullptr; gainSlider = nullptr; gainLabel = nullptr; prBehaviorLabel = nullptr; prBehaviorComboBox = nullptr; playButton = nullptr; loopButton = nullptr; stopButton = nullptr; qDefaultButton = nullptr; sSlider = nullptr; sDefaultButton = nullptr; nfftSlider = nullptr; nfftLabel = nullptr; saveButton = nullptr; sLabel = nullptr; inputRemoveButton = nullptr; inputAddButton = nullptr; inputFileListComponent = nullptr; //[Destructor]. You can add your own custom destruction code here.. shutdownAudio(); //[/Destructor] }
~MainContentComponent() { shutdownAudio(); loadButton = nullptr; root = nullptr; }
//----------------------------------------------------------------------------- // \brief tests the AIC3106 CODEC // // \param none. // // \return uint32_t //----------------------------------------------------------------------------- uint32_t TEST_audio(void) { uint32_t rtn = ERR_NO_ERROR; printf("--------------------------------------------------------------------\r\n"); printf(" Audio CODEC test\r\n\r\n"); printf("Additional Equipment\r\n"); printf("--------------------\r\n"); printf("- 3.5mm pass through cable\r\n\r\n"); printf("- 3.5mm headphones\r\n\r\n"); printf("Test Description\r\n"); printf("----------------\r\n"); printf("The test will begin by playing a 5 second tone though the line\r\n"); printf("out port. The 3.5mm pass through cable will not be needed for\r\n"); printf("this portion of the test. After playing the tone, audio from the\n\r"); printf("line in port will be played through the line out port for 15 seconds.\r\n"); printf("--------------------------------------------------------------------\r\n\r\n"); //------------------------------------ // initialize the required bsl modules //------------------------------------ printf("Initialize the Required BSL Modules\r\n"); printf("-----------------------------------\r\n\r\n"); rtn = MCASP_init(); if (rtn != ERR_NO_ERROR) { printf("error initializing mcasp!\r\n"); return (rtn); } rtn = AIC3106_init(); if (rtn != ERR_NO_ERROR) { printf("error initializing aic3106!\r\n"); return (rtn); } //----------------------- // execute line out test. //----------------------- printf("\r\nExecute Test\r\n"); printf("------------\r\n\r\n"); printf("--- test audio line out (put on your headphones...) ---\r\n"); rtn = testAudioLineOut(); if (rtn != ERR_NO_ERROR) { printf("\tline out test failed\r\n\r\n"); return (rtn); } else { printf("\tline out test passed\r\n\r\n"); } //------------------------------------ // initialize the required bsl modules //------------------------------------ rtn = MCASP_init(); if (rtn != ERR_NO_ERROR) { printf("error initializing mcasp!\r\n"); return (rtn); } rtn = AIC3106_init(); if (rtn != ERR_NO_ERROR) { printf("error initializing aic3106!\r\n"); return (rtn); } //----------------------- // execute line in test. //----------------------- printf("--- test audio line in (put on your headphones and plug in source to line in...) ---\r\n"); rtn = testAudioLineIn(); if (rtn != ERR_NO_ERROR) { printf("\tline in test failed\r\n\r\n"); return (rtn); } else { printf("\tline in test passed\r\n\r\n"); } // kill codec and mcasp. shutdownAudio(); return (rtn); }
LAudioAppComponent::~LAudioAppComponent() { shutdownAudio(); }
int LAudioAppComponent::close(lua_State*) { shutdownAudio(); return 0; }
~MainContentComponent() { shutdownAudio(); }
/** * This is the main entry point of a native application that is using * android_native_app_glue. It runs in its own thread, with its own * event loop for receiving input events and doing other things. */ void android_main(struct android_app* state) { //struct engine engine; const int FRAMES_PER_SECOND = 60; const int SKIP_TICKS = 1000 / FRAMES_PER_SECOND; // Make sure glue isn't stripped. app_dummy(); memset(&engine, 0, sizeof(engine)); state->userData = &engine; state->onAppCmd = engine_handle_cmd; state->onInputEvent = engine_handle_input; engine.app = state; createSoundEngine(); createBufferQueueAudioPlayer(); // Prepare to monitor accelerometer /*engine.sensorManager = ASensorManager_getInstance(); engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager, ASENSOR_TYPE_ACCELEROMETER); engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager, state->looper, LOOPER_ID_USER, NULL, NULL);*/ if (state->savedState != NULL) { // We are starting with a previous saved state; restore from it. // engine.state = *(struct saved_state*)state->savedState; } int32_t next_game_tick = getTickCount(); int sleep_time = 0; //http://www.koonsolo.com/news/dewitters-gameloop/ // loop waiting for stuff to do. while (1) { // Read all pending events. int ident; int events; struct android_poll_source* source; // If not animating, we will block forever waiting for events. // If animating, we loop until all events are read, then continue // to draw the next frame of animation. if ((ident = ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0) { // Process this event. if (source != NULL) { source->process(state, source); } } engine_draw_frame(&engine); next_game_tick += SKIP_TICKS; sleep_time = next_game_tick - now_ms(); if( sleep_time >= 0 ) { sleep( sleep_time ); } } shutdownAudio(); }
HelmStandaloneEditor::~HelmStandaloneEditor() { shutdownAudio(); }