Esempio n. 1
0
	void get_info( file_info & p_info, abort_callback & p_abort )
	{
		YMMUSIC *  m_info = ymMusicCreate();
		ymMusicLoadMemory(m_info,file_buffer.get_ptr(), file_buffer.get_size());
		ymMusicInfo_t info;
		ymMusicGetInfo(m_info,&info);

		p_info.info_set( "encoding", "synthesized" );
		p_info.info_set( "codec", "YM" );
		p_info.info_set_int( "channels", 1 );
		p_info.meta_set( "title", pfc::stringcvt::string_utf8_from_ansi( info.pSongName) );
		p_info.meta_set( "artist", pfc::stringcvt::string_utf8_from_ansi( info.pSongAuthor) );
		p_info.meta_set( "comment", pfc::stringcvt::string_utf8_from_ansi( info.pSongComment) );
		p_info.set_length( info.musicTimeInSec );

		ymMusicDestroy(m_info);
	}
Esempio n. 2
0
void YMPlugin::Unload()
{
    ymMusicDestroy(m_ymMusic);
    m_ymMusic = NULL;
}
Esempio n. 3
0
	~input_ym()
	{
		ymMusicDestroy(m_player);
	}
Esempio n. 4
0
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;
}