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; }
HivelyPlayer(const string &fileName) { tune = hvl_LoadTune(fileName.c_str(), 44100, 0); if(!tune) throw player_exception(); string msg; for(int i=1; i<tune->ht_InstrumentNr; i++) { char *name = tune->ht_Instruments[i].ins_Name; msg = msg + utils::utf8_encode(name) + " "; } setMeta( "title", tune->ht_Name, "message", msg, "channels", tune->ht_Channels, "length", tune->ht_PlayingTime, "format", tune->ht_Version == 0xAA ? "AHX" : "Hively" ); }
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; }
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; }