2020-01-30 19:02:45 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
* Copyright (c) 2019-2020, William McPherson <willmcpherson2@gmail.com>
|
2021-07-11 05:58:17 +03:00
|
|
|
* Copyright (c) 2021, JJ Roberts-White <computerfido@gmail.com>
|
2020-01-30 19:02:45 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-30 19:02:45 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-02 14:34:39 +03:00
|
|
|
#include "Music.h"
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/Widget.h>
|
2020-01-30 19:02:45 +03:00
|
|
|
|
2021-07-11 05:58:17 +03:00
|
|
|
class AudioPlayerLoop;
|
2020-06-15 08:33:53 +03:00
|
|
|
class TrackManager;
|
2020-01-30 19:02:45 +03:00
|
|
|
class WaveWidget;
|
|
|
|
class RollWidget;
|
2020-02-08 09:04:05 +03:00
|
|
|
class SamplerWidget;
|
2020-01-30 19:02:45 +03:00
|
|
|
class KeysWidget;
|
|
|
|
class KnobsWidget;
|
2021-07-11 05:58:17 +03:00
|
|
|
class PlayerWidget;
|
2020-01-30 19:02:45 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
class MainWidget final : public GUI::Widget {
|
2020-01-30 19:02:45 +03:00
|
|
|
C_OBJECT(MainWidget)
|
|
|
|
public:
|
|
|
|
virtual ~MainWidget() override;
|
|
|
|
|
2020-06-17 12:34:25 +03:00
|
|
|
void add_actions(GUI::Menu&);
|
|
|
|
|
2020-01-30 19:02:45 +03:00
|
|
|
void set_octave_and_ensure_note_change(Direction);
|
2020-07-06 23:52:29 +03:00
|
|
|
void set_octave_and_ensure_note_change(int);
|
2020-01-30 19:02:45 +03:00
|
|
|
|
|
|
|
private:
|
2021-07-11 05:58:17 +03:00
|
|
|
explicit MainWidget(TrackManager&, AudioPlayerLoop&);
|
2020-01-30 19:02:45 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual void keydown_event(GUI::KeyEvent&) override;
|
|
|
|
virtual void keyup_event(GUI::KeyEvent&) override;
|
2020-02-02 14:34:39 +03:00
|
|
|
virtual void custom_event(Core::CustomEvent&) override;
|
2020-01-30 19:02:45 +03:00
|
|
|
|
|
|
|
void note_key_action(int key_code, Switch);
|
|
|
|
void special_key_action(int key_code);
|
|
|
|
|
2020-06-17 12:34:25 +03:00
|
|
|
void turn_off_pressed_keys();
|
|
|
|
void turn_on_pressed_keys();
|
|
|
|
|
2020-06-15 08:33:53 +03:00
|
|
|
TrackManager& m_track_manager;
|
2021-07-11 05:58:17 +03:00
|
|
|
AudioPlayerLoop& m_audio_loop;
|
2020-01-30 19:02:45 +03:00
|
|
|
|
|
|
|
RefPtr<WaveWidget> m_wave_widget;
|
|
|
|
RefPtr<RollWidget> m_roll_widget;
|
2020-02-08 09:04:05 +03:00
|
|
|
RefPtr<SamplerWidget> m_sampler_widget;
|
|
|
|
RefPtr<GUI::TabWidget> m_tab_widget;
|
2020-02-02 17:07:41 +03:00
|
|
|
RefPtr<GUI::Widget> m_keys_and_knobs_container;
|
2020-01-30 19:02:45 +03:00
|
|
|
RefPtr<KeysWidget> m_keys_widget;
|
|
|
|
RefPtr<KnobsWidget> m_knobs_widget;
|
2021-07-11 05:58:17 +03:00
|
|
|
RefPtr<PlayerWidget> m_player_widget;
|
2020-01-30 19:02:45 +03:00
|
|
|
|
|
|
|
bool m_keys_pressed[key_code_count] { false };
|
|
|
|
};
|