Exemple #1
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;
}
Exemple #2
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;
}