void decode_initialize( unsigned p_flags, abort_callback & p_abort ) { loop = cfg_loop; if ( p_flags & input_flag_no_looping) loop = false; bool lowpass = cfg_lowpass; ymMusicSetLoopMode(m_player,loop); ymMusicSetLowpassFiler(m_player,lowpass); ymMusicPlay(m_player); first_block = true; }
void YMPlugin::Play() { ymMusicPlay(m_ymMusic); m_playing = true; m_paused = false; }
int main(int argc, char* argv[]) { //-------------------------------------------------------------------------- // Checks args. //-------------------------------------------------------------------------- printf( "SmallYmPlayer.\n" "Using ST-Sound Library, under GPL license\n" "Copyright (C) 1995-1999 Arnaud Carre ( http://leonard.oxg.free.fr )\n"); if (argc!=2) { printf("Usage: SmallYmPlayer <ym music file>\n\n"); return -1; } //-------------------------------------------------------------------------- // Load YM music and creates WAV file //-------------------------------------------------------------------------- printf("Loading music \"%s\"...\n",argv[1]); YMMUSIC *pMusic = ymMusicCreate(); if (ymMusicLoad(pMusic,argv[1])) { if (soundServer.open(soundServerCallback,500)) { ymMusicInfo_t info; ymMusicGetInfo(pMusic,&info); printf("Name.....: %s\n",info.pSongName); printf("Author...: %s\n",info.pSongAuthor); printf("Comment..: %s\n",info.pSongComment); printf("Duration.: %d:%02d\n",info.musicTimeInSec/60,info.musicTimeInSec%60); printf("\nPlaying music...(press a key to abort)\n"); ymMusicSetLoopMode(pMusic,YMTRUE); ymMusicPlay(pMusic); s_pMusic = pMusic; // global instance for soundserver callback int oldSec = -1; for (;;) { if (_kbhit()) break; int sec = ymMusicGetPos(pMusic) / 1000; if (sec != oldSec) { printf("Time: %d:%02d\r",sec/60,sec%60); oldSec = sec; } Sleep(20); } _getch(); // flush the key pressed printf("\n"); // Switch off replayer s_pMusic = NULL; ymMusicStop(pMusic); soundServer.close(); } else { printf("ERROR: Unable to initialize sound card hardware\n"); } } else { printf("Error in loading file %s:\n%s\n",argv[1],ymMusicGetLastError(pMusic)); } ymMusicDestroy(pMusic); return 0; }