Ejemplo n.º 1
0
JNIEXPORT jlong JNICALL Java_com_ssb_droidsound_plugins_HivelyPlugin_N_1load(JNIEnv *env, jobject obj, jstring fname)
{
    if(!inited) {
        hvl_InitReplayer();
        inited = true;
    }

    const char *filename = env->GetStringUTFChars(fname, NULL);

    char temp[260];
    strcpy(temp, filename);

    struct hvl_tune *tune = hvl_LoadTune(temp, 44100, 0);
    if (!tune)
    {
        return -1;
    }

    return (jlong)tune;
}
Ejemplo n.º 2
0
int main( int argc, char *argv[] )
{
  int i;
	hivelyIndex = HIVELY_LEN;
  if( argc < 2 )
  {
    printf( "Usage: play_hvl <tune>\n" );
    return 0;
  }

  if( init() )
  {
    hvl_InitReplayer();
    tune = hvl_LoadTune( argv[1], FREQ, 4 );
    if( tune )
    {
      BOOL done;
      uint32 gotsigs;

      hvl_InitSubsong( tune, 0 );

      printf( "Songname: %s\nChannels: %i\n", tune->ht_Name, tune->ht_Channels );
      printf( "Instruments:\n" );
      for( i=1; i <= tune->ht_InstrumentNr; i++ )
        printf( "%02ld: %s\n", i, tune->ht_Instruments[i].ins_Name );
     printf( "\n\nHit Enter to quit..\n" );

      SDL_PauseAudio(0);

      // Uncomment to disable looping:
      /*while(!tune->ht_SongEndReached)
          sleep(1);*/
      getchar();
      SDL_PauseAudio(1);
      hvl_FreeTune( tune );
    }
  }
  SDL_Quit();
  return 0;
}
Ejemplo n.º 3
0
int main( int argc, char *argv[] )
{
  struct hvl_tune *tune;

  if( argc < 2 )
  {
    printf( "Usage: play_hvl <tune>\n" );
    return 0;
  }

  if( init() )
  {
    hvl_InitReplayer();
    tune = hvl_LoadTune( argv[1], FREQ, 2 );
    if( tune )
    {
      BOOL done;
      uint32 gotsigs;
      
      hvl_InitSubsong( tune, 0 );

      nextbuf = 0;
      mix_and_play( tune );

      done = FALSE;
      
      while( !done )
      {
        gotsigs = IExec->Wait( ahisig | SIGBREAKF_CTRL_C );
      
        if( gotsigs & ahisig ) mix_and_play( tune );
        if( gotsigs & SIGBREAKF_CTRL_C ) done = TRUE;
      }
      hvl_FreeTune( tune );
    }
  }
  shut();
  return 0;
}
Ejemplo n.º 4
0
JNIEXPORT jlong JNICALL Java_com_ssb_droidsound_plugins_HivelyPlugin_N_1load(JNIEnv *env, jobject obj, jbyteArray bArray, int size)
{
	if(!inited) {
		hvl_InitReplayer();
		inited = true;
	}


	jbyte *ptr = env->GetByteArrayElements(bArray, NULL);

	__android_log_print(ANDROID_LOG_VERBOSE, "HivelyPlugin", "open %p %d", ptr, size);

	struct hvl_tune *tune = hvl_LoadTuneMemory((uint8*)ptr, size, 44100, 0);

	if(tune) {

		__android_log_print(ANDROID_LOG_VERBOSE, "HivelyPlugin", "CHAN %d NAME '%s' TIME %d", tune->ht_Channels, tune->ht_Name, tune->ht_PlayingTime);
	}


	env->ReleaseByteArrayElements(bArray, ptr, 0);
	return (jlong)tune;
}
Ejemplo n.º 5
0
HivelyPlugin::HivelyPlugin() {
	hvl_InitReplayer();
}