Hual / foo_mediacontrol

Adds the ability for foobar2000 to interact with the Windows 10 media control overlay.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Album art is not removed when switching to songs that have no images avilable.

subanz opened this issue · comments

When the next or previous song is played the previous thumbnail image is not removed if the song has no album art.

Here is a bit of code I used to fix it. Sorry if its bad code I'm not much of a programmer, but here it is.

media_control.ccp

media_controls& media_controls::set_thumbnail(album_art_data::ptr data) {
	if (data != nullptr)
	{
		if (m_art_stream = SHCreateMemStream(reinterpret_cast<const BYTE*>(data->get_ptr()), data->get_size())) {
			Windows::Storage::Streams::IRandomAccessStream^ stream;

			if (CreateRandomAccessStreamOverStream(m_art_stream, BSOS_DEFAULT, ABI::Windows::Storage::Streams::IID_IRandomAccessStream, reinterpret_cast<void**>(&stream)) == S_OK)
				m_updater->Thumbnail = Windows::Storage::Streams::RandomAccessStreamReference::CreateFromStream(stream);
			else {
				m_updater->Thumbnail = nullptr;
				console::error("Failed to create random access stream over stream.");
			}
				

		}
		else
		{
			m_updater->Thumbnail = nullptr;
			console::error("Could not create stream.");
		}
			
	}
	else 
	{
		m_updater->Thumbnail = nullptr;
	}

	return *this;
}
commented

If you've fixed it why not make a pull request directly?

No idea how to do that sort of stuff, sorry hope I didn't waste your time.

Edit: Just clicked on the pull request tab, pretty self explanatory. I'll keep it in mind next time. Sorry I don't use github very much.

commented

No need to apologise, thanks for taking the time :)