Ejemplo n.º 1
0
MPTWrap::MPTWrap(QIODevice *device)
{
  mod = openmpt_module_create(callbacks, device, openmpt_log_func_silent, nullptr, nullptr);
  if(mod == nullptr) throw InvalidFile();

  openmpt_module_select_subsong(mod, -1);

  duration_ = openmpt_module_get_duration_seconds(mod) * 1000;
  title_ = copystr(openmpt_module_get_metadata(mod, "title"));
  format_ = copystr(openmpt_module_get_metadata(mod, "type_long"));
  pattern_count_ = openmpt_module_get_num_patterns(mod);
  instrument_count_ = openmpt_module_get_num_instruments(mod);
  sample_count_ = openmpt_module_get_num_samples(mod);
  channel_count_ = openmpt_module_get_num_channels(mod);

  for(int i = 0; i < openmpt_module_get_num_instruments(mod); i++)
  {
    instruments_.push_back(copystr(openmpt_module_get_instrument_name(mod, i)));
  }

  for(int i = 0; i < openmpt_module_get_num_samples(mod); i++)
  {
    samples_.push_back(copystr(openmpt_module_get_sample_name(mod, i)));
  }

  comment_ = copystr(openmpt_module_get_metadata(mod, "message_raw"));
}
Ejemplo n.º 2
0
JNIEXPORT jlong JNICALL Java_com_ssb_droidsound_plugins_OpenMPTPlugin_N_1load(JNIEnv *env, jobject obj, jstring fname, jboolean loopmode)
{
	openmpt_module* mod = 0;
	FILE* file = NULL;
	
	const char *filename = env->GetStringUTFChars(fname, NULL);
	file = fopen(filename,"rb");
	mod = openmpt_module_create(openmpt_stream_get_file_callbacks(), file, NULL, NULL, NULL);
	if (loopmode)
		openmpt_module_set_repeat_count(mod, -1);
	fclose(file);
	return (long)mod;
}