void ProtoApp::init(){ // setup audio if(usingAudio()){ gam::Sync::master().spu(audioIO().fps()); } // setup GUI mAppLabel.setValue(App::name()); mGUI << mGUITable; mTopBar.arrange(); mParamPanel.arrange(); mGUITable.arrange(); // setup model manager if(!App::name().empty()){ glv::ModelManager& MM = mGUI.modelManager(); // std::string idName = App::name(); toIdentifier(idName); MM.name(idName + "Presets"); MM.fileDir(mResourceDir); mGUI.refreshModels(); MM.add("pose", *new PoseModel(nav())); paramPanel().presetControl() .modelManager(MM) .loadFile() ; } }
void ProtoApp::init( const Window::Dim& dim, const std::string title, double fps, Window::DisplayMode mode, double sampleRate, int blockSize, int chansOut, int chansIn ){ initAudio(sampleRate, blockSize, chansOut, chansIn); // setup audio if(usingAudio()){ gam::Sync::master().spu(audioIO().fps()); } Window * win = initWindow(dim, title, fps, mode); mGUI.parentWindow(*win); // setup GUI mAppLabel.setValue(App::name()); mGUI << mGUITable; mTopBar.arrange(); mParamPanel.arrange(); mGUITable.arrange(); // setup model manager if(!App::name().empty()){ glv::ModelManager& MM = mGUI.modelManager(); // std::string idName = App::name(); toIdentifier(idName); MM.name(idName + "Presets"); MM.fileDir(mResourceDir); mGUI.refreshModels(); MM.add("pose", *new PoseModel(nav())); paramPanel().presetControl() .modelManager(MM) .loadFile() ; } }
int main (int argc, char * const argv[]) { chdir(exepath(argv[0])); script = argv[1]; // char path[1024]; // getcwd(path, 1024); // //printf("cwd %s\n", path); al::Lua L; al::AudioIO audioIO(1024, 44100, audioCB, &L, 2,2); io = &audioIO; L.dostring("print(jit.version)"); L.dostring("print(package.path)"); L.preloadlib("audio", luaopen_audio); // run main script... L.dofile(script); L.push(audioIO.framesPerBuffer()); L.setglobal("blocksize"); L.push(audioIO.framesPerSecond()); L.setglobal("samplerate"); audioIO.start(); active = 1; // wait for input while (active and getchar()) { // sleep or wait on repl //al_sleep(0.01); script = argv[1]; } printf("done\n"); audioIO.stop(); return 0; }