JNIEXPORT jint JNICALL Java_org_helllabs_android_xmp_Xmp_init(JNIEnv *env, jobject obj) { xmp_drv_register(&drv_smix); ctx = xmp_create_context(); xmp_init(ctx, 0, NULL); opt = xmp_get_options(ctx); opt->verbosity = 0; xmp_register_event_callback(ctx, process_echoback, NULL); _playing = 0; opt->freq = 44100; opt->resol = 16; opt->outfmt &= ~XMP_FMT_MONO; opt->flags |= XMP_CTL_ITPT | XMP_CTL_FILTER; if (xmp_open_audio(ctx) < 0) { xmp_deinit(ctx); xmp_free_context(ctx); return -1; } return 0; }
void xmp_init_callback(xmp_context ctx, void (*callback) (void *, int)) { struct xmp_options *o = &((struct xmp_context *)ctx)->o; xmp_drv_register(&drv_callback); xmp_init_formats(ctx); pw_init(); xmp_register_driver_callback(ctx, callback); o->drv_id = "callback"; }