Made volume slider work

This commit is contained in:
bjorn.olievier 2008-04-07 21:47:18 +00:00
parent b976747024
commit 3eb803a4f3
4 changed files with 33 additions and 22 deletions

View File

@ -60,6 +60,7 @@ public: void Start(const utfstring path);
public: void Stop(size_t idx);
public: void ChangeVolume(float volume);
public: float Volume() const { return currVolume; };
public: size_t NumOfStreams() const;
public: AudioStreamOverview StreamsOverview() const;

View File

@ -62,6 +62,10 @@ void TransportController::OnViewCreated()
this->transportView.stopButton->Pressed.connect(
this, &TransportController::OnStopPressed);
this->transportView.volumeSlider->Repositioned.connect(
this, &TransportController::OnVolumeSliderChange);
this->transportView.volumeSlider->SetPosition(transport.Volume()*100);
}
void TransportController::OnViewResized(Size size)
@ -77,3 +81,8 @@ void TransportController::OnStopPressed()
{
transport.Stop(0);
}
void TransportController::OnVolumeSliderChange()
{
transport.ChangeVolume(transportView.volumeSlider->Position()/100.0f);
}

View File

@ -63,6 +63,7 @@ protected: musik::core::audio::Transport transport;
protected: void OnPlayPressed();
protected: void OnStopPressed();
protected: void OnVolumeSliderChange();
};
//////////////////////////////////////////////////////////////////////////////

View File

@ -92,8 +92,8 @@ void TransportView::OnCreated()
topRowBox->SetChildFill(nowPlayingFrame);
topRowBox->SetFlexibleChild(nowPlayingFrame);
this->playbackSlider = topRowBox->AddChild(new Trackbar());
this->playbackSlider->Resize(100, 28);
this->volumeSlider = topRowBox->AddChild(new Trackbar());
this->volumeSlider->Resize(100, 28);
// bottom row ----------
BoxLayout* playbackBox = new BoxLayout();