mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +00:00
SoundPlayer: Add samplerate variable to visualizations
also fix conflict
This commit is contained in:
parent
2e28b8ebcc
commit
fd126578d9
12 changed files with 51 additions and 311 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "NoVisualizationWidget.h"
|
||||
#include "Player.h"
|
||||
#include "SoundPlayerWidget.h"
|
||||
#include "SampleWidget.h"
|
||||
#include "SoundPlayerWidgetAdvancedView.h"
|
||||
#include <LibAudio/ClientConnection.h>
|
||||
#include <LibGUI/Action.h>
|
||||
|
@ -54,21 +54,24 @@ int main(int argc, char** argv)
|
|||
|
||||
auto audio_client = Audio::ClientConnection::construct();
|
||||
audio_client->handshake();
|
||||
PlaybackManager playback_manager(audio_client);
|
||||
PlayerState initial_player_state { true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
1.0,
|
||||
audio_client,
|
||||
playback_manager,
|
||||
"" };
|
||||
|
||||
if (pledge("stdio recvfd sendfd accept rpath thread", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PlaybackManager playback_manager(audio_client);
|
||||
PlayerState initial_player_state { true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
44100,
|
||||
1.0,
|
||||
audio_client,
|
||||
playback_manager,
|
||||
"" };
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-sound-player");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
|
@ -78,12 +81,14 @@ int main(int argc, char** argv)
|
|||
auto menubar = GUI::MenuBar::construct();
|
||||
|
||||
auto& app_menu = menubar->add_menu("File");
|
||||
// start in simple view by default
|
||||
Player* player = &window->set_main_widget<SoundPlayerWidget>(window, initial_player_state);
|
||||
|
||||
auto& playlist_menu = menubar->add_menu("Playlist");
|
||||
|
||||
String path = argv[1];
|
||||
// start in advanced view by default
|
||||
Player* player = &window->set_main_widget<SoundPlayerWidgetAdvancedView>(window, initial_player_state);
|
||||
if (argc > 1) {
|
||||
String path = argv[1];
|
||||
player->open_file(path);
|
||||
player->play();
|
||||
}
|
||||
|
||||
app_menu.add_action(GUI::CommonActions::make_open_action([&](auto&) {
|
||||
|
@ -119,7 +124,7 @@ int main(int argc, char** argv)
|
|||
auto& playback_menu = menubar->add_menu("Playback");
|
||||
|
||||
auto loop = GUI::Action::create_checkable("Loop", { Mod_Ctrl, Key_R }, [&](auto& action) {
|
||||
player->set_looping(action.is_checked());
|
||||
player->set_looping_file(action.is_checked());
|
||||
});
|
||||
|
||||
playback_menu.add_action(move(loop));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue