### Runtime Dynamic Audio File Loading in openFrameworks Source: https://context7.com/npisanti/ofxaudiofile/llms.txt Handles dynamic audio file loading through drag-and-drop or file dialog at runtime. It updates the audiofile object when a new file is selected and logs load status. This snippet is triggered by dragEvent and keyPressed event handlers. ```C++ void ofApp::dragEvent(ofDragInfo dragInfo) {\n // Load dropped file\n audiofile.load(dragInfo.files[0]);\n\n if (audiofile.loaded()) {\n std::cout << \"Loaded: \" << audiofile.path() << std::endl;\n std::cout << \"Duration: \"\n << (float)audiofile.length() / audiofile.samplerate()\n << \" seconds\" << std::endl;\n }\n}\n\nvoid ofApp::keyPressed(int key) {\n if (key == \047l\047 || key == \047L\047) {\n ofFileDialogResult result = ofSystemLoadDialog(\"Select audio file\");\n\n if (result.bSuccess) {\n audiofile.load(result.getPath());\n\n if (!audiofile.loaded()) {\n ofLogError() << \"Failed to load: \" << result.getPath();\n }\n }\n }\n} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.