Ejemplo n.º 1
0
void TLevelsSlider::Init()
{
	// We handle our own drawing
	SetViewColor(B_TRANSPARENT_32_BIT);

	// Load slider bitmaps
	LoadSliders();
	
	/*
	// Get output device
	BADCStream adcStream;
	int32 curADCDevice = 0;
	if ( adcStream.ADCInput(&curADCDevice) != B_OK)
		DebugAlert("AudioServer not runnng!");
		
	// Get volume settings
	BDACStream 	dacStream;
	float 		volLeft, volRight;
	
	// Input
	if (m_Type == kAudioInputSlider)
	{
		
		dacStream.GetVolume(B_ADC_IN, &volLeft, &volRight, NULL);
	}
	// Output
	else
	{
		dacStream.GetVolume(B_DAC_OUT, &volLeft, &volRight, NULL); 
	}
	*/
		
	float volLeft 	= 0.0;
	float volRight	= 0.0;
	
	// Set up slider rects
	const BRect bounds 			= Bounds();
	const uint32 sliderWidth 	= m_LeftSlider->Bounds().IntegerWidth();
	const uint32 sliderHeight 	= m_LeftSlider->Bounds().IntegerHeight();
	const uint32 height 		= (bounds.Height()-kTopOffset) - (sliderHeight+kBottomOffset);
	
	// Get pixel location of levels
	int32 sliderLeft	= height * volLeft;
	int32 sliderRight 	= height * volRight;
	
	sliderLeft  += sliderHeight+kBottomOffset;
	sliderRight += sliderHeight+kBottomOffset;

	m_LeftSliderRect.left 	 = (bounds.Width()/2) - sliderWidth;
	m_LeftSliderRect.right 	 = m_LeftSliderRect.left + sliderWidth;	
	m_LeftSliderRect.top 	 = bounds.Height() + (-sliderLeft);
	m_LeftSliderRect.bottom  = m_LeftSliderRect.top - sliderHeight;
	
	m_RightSliderRect.left 	 = (bounds.Width()/2);
	m_RightSliderRect.right	 = m_RightSliderRect.left + sliderWidth;	
	m_RightSliderRect.top 	 = bounds.Height() + (-sliderRight);
	m_RightSliderRect.bottom = m_RightSliderRect.top - sliderHeight;		
}
Ejemplo n.º 2
0
/*
==================
SoundLayer::LoadResources
==================
*/
void SoundLayer::LoadResources() {
	buttonSheet = new Pim::SpriteBatchNode("soundbuttons.png");
	AddChild(buttonSheet);

	font = new Pim::Font("arial.ttf", 15);

	LoadButton();
	LoadSliders();
	LoadMusic();
}