Beispiel #1
0
/*
   VMenu2:Call() (т.е. функция обработки меню)
   должна возвращать true если она обработала событие и дальше ничего делать не надо
   (вне зависимости что говорит енц. о кодах возврата различных DN_*).
*/
int VMenu2::Call(int Msg, void *param)
{
	if(!mfn)
		return 0;

	SendMessage(DM_ENABLEREDRAW, 0, nullptr);
	int r=mfn(Msg, param);

	bool Visible;
	DWORD Size;
	SHORT X, Y;
	GetCursorType(Visible, Size);
	GetCursorPos(X, Y);

	if(SendMessage(DM_ENABLEREDRAW, -1, nullptr)<0)
		SendMessage(DM_ENABLEREDRAW, 1, nullptr);

	if(NeedResize)
		Resize();

	SetCursorType(Visible, Size);
	MoveCursor(X, Y);

	if(closing)
	{
		closing=false;
		if(Msg==DN_CLOSE)
			return false;
		SendMessage(DM_CLOSE, -1, nullptr);
	}

	return r;
}
Beispiel #2
0
bool ReadTag(const musik::Core::String& fn, musik::Core::SongInfo& target)
{
    bool ret = true;

    musik::Core::Filename mfn(fn);

    target.SetFilename(fn);
    target.SetFormat("Ogg Vorbis");

    try
    {
#if defined (WIN32)
        TagLib::FileRef tag_file(fn.c_str());
#else    
        TagLib::FileRef tag_file(utf16to8(fn, true).c_str());
#endif
        if (!tag_file.isNull())
        {
            if (tag_file.tag())
            {
                TagLib::Tag *tag = tag_file.tag();        

                target.SetArtist(musik::Core::utf8to16(tag->artist().to8Bit(true)));
                target.SetAlbum(musik::Core::utf8to16(tag->album().to8Bit(true)));
                target.SetTitle(musik::Core::utf8to16(tag->title().to8Bit(true)));
                target.SetGenre(musik::Core::utf8to16(tag->genre().to8Bit(true)));
                target.SetNotes(musik::Core::utf8to16(tag->comment().to8Bit(true)));

                target.SetYear(musik::Core::IntToString(tag->year()));
                target.SetTrackNum(musik::Core::IntToString(tag->track()));
            }

            if (tag_file.audioProperties())
            {
                TagLib::AudioProperties *properties = tag_file.audioProperties();
                int duration = properties->length() * 1000;
                target.SetBitrate(musik::Core::IntToString(properties->bitrate()));
                target.SetDuration(musik::Core::IntToString(duration));
            }
        }

        // if the title is empty, then use the
        // filename...
        if (target.GetTitle().IsEmpty())
        {
            musik::Core::Filename MFN(fn);
            target.SetTitle(MFN.GetJustFilename());
        }
    }
    catch (...)
    {
        ret = false;
        cout << "taglib crashed reading: " << fn.c_str() << endl;
    }

    return ret;
}
Beispiel #3
0
bool CanPlay(const musik::Core::String& filename)
{
    musik::Core::Filename mfn(filename);

    if (mfn.GetExtension() == _T("wma"))
    {
        return true;
    }

    return false;
}