Example #1
0
void
VolumeControl::DetachedFromWindow()
{
	_DisconnectVolume();

	be_roster->StopWatching(this);
}
Example #2
0
void
VolumeControl::_ConnectVolume()
{
	_DisconnectVolume();

	const char* errorString = NULL;
	float volume = 0.0;
	fMixerControl->Connect(fMixerControl->VolumeWhich(), &volume, &errorString);

	if (errorString != NULL) {
		SetLabel(errorString);
		SetLimits(-60, 18);
	} else {
		SetLabel(B_TRANSLATE("Volume"));
		SetLimits((int32)floorf(fMixerControl->Minimum()),
			(int32)ceilf(fMixerControl->Maximum()));

		BMediaRoster* roster = BMediaRoster::CurrentRoster();
		if (roster != NULL && fMixerControl->GainNode() != media_node::null) {
			roster->StartWatching(this, fMixerControl->GainNode(),
				B_MEDIA_NEW_PARAMETER_VALUE);
		}
	}

	SetEnabled(errorString == NULL);

	fOriginalValue = (int32)volume;
	SetValue((int32)volume);
}
Example #3
0
void
VolumeControl::DetachedFromWindow()
{
	_DisconnectVolume();

	BMediaRoster* roster = BMediaRoster::CurrentRoster();
	roster->StopWatching(BMessenger(this), B_MEDIA_SERVER_STARTED);
	roster->StopWatching(BMessenger(this), B_MEDIA_SERVER_QUIT);
}