Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VLC audio distortion #3

Open
tsmithf opened this issue Mar 21, 2018 · 2 comments
Open

VLC audio distortion #3

tsmithf opened this issue Mar 21, 2018 · 2 comments

Comments

@tsmithf
Copy link

tsmithf commented Mar 21, 2018

We have an application that starts by playing a corporate video using a new instance of VlcBitmap, there is also a skip button which disposes of the video.

Within the application there is also a button to replay the intro video at any time.

However when the video plays again the audio is badly distorted.

I'm not sure if it's simply double playing the audio, or the levels are incorrectly set.

Any ideas?

@tsmithf
Copy link
Author

tsmithf commented Mar 21, 2018

Looking into the audio issue further I implemented the getVolume() function in the VlcBitmap.hx file...

public function getVolume():Float
{
	#if (cpp && !mobile)
	if (libvlc!=null && initComplete)
		return libvlc.getVolume();
	else
		return 0;
	#else 
		return 0;
	#end
}

Then querying the volume of the media during progress I noticed it would start at volume 100, but when replaying again it would jump to 255, the maximum it should be is 100, hence the distortion.

Looking at the LibVLC.cpp file I noticed the setVolume function was setting it to 255, I changed the following...

void LibVLC::setVolume(float volume)
{
	if (volume>100)
		volume = 100.0;

	vol = volume;
	if (libVlcMediaPlayer!=NULL && libVlcMediaPlayer!=nullptr)
	{
		try
		{
			//libvlc_audio_set_volume(libVlcMediaPlayer, volume);
			libvlc_audio_set_volume(libVlcMediaPlayer, 100.0);
		}
		catch(int e)
		{
		}
	}
}

And no distortion and the volume correctly reporting as 100.

@datee
Copy link
Owner

datee commented Mar 26, 2018

Hey, nice catch! Make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants