mainform: playback: Add volume control

This commit is contained in:
Farex-GH
2022-09-11 00:24:38 -07:00
parent a7f1d6ca48
commit c59d034f48
2 changed files with 236 additions and 281 deletions
+219 -280
View File
File diff suppressed because it is too large Load Diff
+17 -1
View File
@@ -1095,6 +1095,9 @@ namespace BAKKA_Editor
songFilePath = openSongDialog.FileName;
songFileLabel.Text = songFilePath;
currentSong = soundEngine.Play2D(songFilePath, true, true);
/* Volume is represented as a float from 0-1. */
currentSong.Volume = (float)trackBarVolume.Value / (float)trackBarVolume.Maximum;
songTrackBar.Value = 0;
songTrackBar.Maximum = (int)currentSong.PlayLength;
}
@@ -1883,7 +1886,20 @@ namespace BAKKA_Editor
opManager.Redo();
}
private void MainForm_Resize(object sender, EventArgs e)
private void trackBarVolume_ValueChanged(object sender, EventArgs e)
{
/* No song, nothing to do. */
if (currentSong == null)
{
return;
}
/* Volume is represented as a float from 0-1. */
currentSong.Volume = (float) trackBarVolume.Value / (float) trackBarVolume.Maximum;
circlePanel.Invalidate();
}
private void MainForm_Resize(object sender, EventArgs e)
{
var zoneWidth = noteViewGroupBox.Left - gimmickTypeGroupBox.Right - 12;
var zoneHeight = playbackGroupBox.Top - gimmickTypeGroupBox.Top - 6;