From c41de63bcfa0da7e00cc6eacdc87baef207e3ebb Mon Sep 17 00:00:00 2001 From: Julien Rosener Date: Thu, 8 Jun 2017 14:39:08 +0200 Subject: [PATCH] code: fix wrong carriage return characters --- .../include/app/application_settings.h | 506 ++++---- digitalscratch/include/gui/config_dialog.h | 290 ++--- digitalscratch/include/gui/gui.h | 1038 ++++++++--------- .../include/tracks/audio_collection_model.h | 312 ++--- digitalscratch/include/tracks/playlist.h | 130 +-- libdigitalscratch/src/include/coded_vinyl.h | 166 +-- .../src/include/digital_scratch.h | 212 ++-- .../src/include/digital_scratch_api.h | 464 ++++---- .../src/include/final_scratch_vinyl.h | 122 +- .../src/include/mixvibes_vinyl.h | 118 +- libdigitalscratch/src/include/serato_vinyl.h | 118 +- .../test/digital_scratch_api_test.h | 110 +- libdigitalscratch/test/digital_scratch_test.h | 92 +- 13 files changed, 1839 insertions(+), 1839 deletions(-) diff --git a/digitalscratch/include/app/application_settings.h b/digitalscratch/include/app/application_settings.h index ed1a4b1..268f993 100644 --- a/digitalscratch/include/app/application_settings.h +++ b/digitalscratch/include/app/application_settings.h @@ -1,253 +1,253 @@ -/*============================================================================*/ -/* */ -/* */ -/* Digital Scratch Player */ -/* */ -/* */ -/*-------------------------------------------------( application_settings.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Set and get application settings */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include -#include - -#include "audiodev/sound_card_control_rules.h" -#include "app/application_const.h" - -using namespace std; - -// Application and main window. -#ifndef ENABLE_TEST_MODE - #define APPLICATION_NAME "digitalscratch" -#else - #define APPLICATION_NAME "digitalscratch-test" -#endif - -#define MAIN_WIN_SIZE_CFG "player/main_win_size" -#define MAIN_WIN_SIZE_CFG_DEFAULT "1024x640" - -#define MAIN_WIN_POS_CFG "player/main_win_position" -#define MAIN_WIN_POS_CFG_DEFAULT "50,50" - -#define BROWSER_SPLITTER_SIZE_CFG "player/browser_splitter_size" - -#define BASE_DIR_PATH_CFG "player/base_dir_path" - -#define GUI_STYLE_CFG "player/gui_style_select" -#define GUI_STYLE_NATIVE "native" -#define GUI_STYLE_DARK "dark" -#define GUI_STYLE_DARK_CSS SKINS_PATH "dark.css" -#define GUI_STYLE_DEFAULT "dark" -#define SAMPLERS_VISIBLE_CFG "player/samplers_visible" -#define SAMPLERS_VISIBLE_DEFAULT 1 -#define EXTERN_PROG_CFG "player/extern_prog" -#define NB_DECKS_CFG "player/nb_decks" -#define NB_DECKS_DEFAULT 2 -#define NB_SAMPLERS_CFG "player/nb_samplers" -#define NB_SAMPLERS_DEFAULT 4 - -// Sound caracteristics. -#define SAMPLE_RATE_CFG "sound_card/sample_rate" -#define SAMPLE_RATE_DEFAULT 44100 -#define AUTO_JACK_CONNECTIONS_CFG "sound_card/auto_jack_connections" -#define AUTO_JACK_CONNECTIONS_DEFAULT 1 -#define SOUND_DRIVER_CFG "sound_card/driver_select" -#define SOUND_DRIVER_JACK "jack" -#define SOUND_DRIVER_INTERNAL "internal" -#define SOUND_DRIVER_DEFAULT SOUND_DRIVER_JACK -#define SOUND_CARD_CFG "sound_card/sound_card_id" -#define SOUND_CARD_DEFAULT "0" - -// Decks: motion detection. -#define DECK_INDEX "deck_" -#define VINYL_TYPE_CFG "vinyl_type" -#define RPM_CFG "rpm" - -// Playback parameters. -#define MAX_SPEED_DIFF_CFG "playback_parameters/max_speed_diff" -#define SLOW_SPEED_ALGO_USAGE_CFG "playback_parameters/slow_speed_algo_usage" -#define MAX_NB_SPEED_STABIL_CFG "playback_parameters/min_nb_speed_for_stability" -#define NB_CYCLE_CHANGING_DIR_CFG "playback_parameters/nb_cycle_before_changing_direction" - -// Keyboard shortcuts. -#define KB_SWITCH_PLAYBACK "keyboard_shortcuts/kb_switch_playback" -#define KB_SWITCH_PLAYBACK_DEFAULT "SPACE" -#define KB_LOAD_TRACK_ON_DECK "keyboard_shortcuts/kb_load_track_on_deck" -#define KB_LOAD_TRACK_ON_DECK_DEFAULT "F1" -#define KB_PLAY_BEGIN_TRACK_ON_DECK "keyboard_shortcuts/kb_play_begin_track_on_deck" -#define KB_PLAY_BEGIN_TRACK_ON_DECK_DEFAULT "F2" - -#define KB_SET_CUE_POINT1_ON_DECK "keyboard_shortcuts/kb_set_cue_point1_on_deck" -#define KB_SET_CUE_POINT1_ON_DECK_DEFAULT "F5" -#define KB_PLAY_CUE_POINT1_ON_DECK "keyboard_shortcuts/kb_play_cue_point1_on_deck" -#define KB_PLAY_CUE_POINT1_ON_DECK_DEFAULT "F6" -#define KB_SET_CUE_POINT2_ON_DECK "keyboard_shortcuts/kb_set_cue_point2_on_deck" -#define KB_SET_CUE_POINT2_ON_DECK_DEFAULT "F7" -#define KB_PLAY_CUE_POINT2_ON_DECK "keyboard_shortcuts/kb_play_cue_point2_on_deck" -#define KB_PLAY_CUE_POINT2_ON_DECK_DEFAULT "F8" -#define KB_SET_CUE_POINT3_ON_DECK "keyboard_shortcuts/kb_set_cue_point3_on_deck" -#define KB_SET_CUE_POINT3_ON_DECK_DEFAULT "F9" -#define KB_PLAY_CUE_POINT3_ON_DECK "keyboard_shortcuts/kb_play_cue_point3_on_deck" -#define KB_PLAY_CUE_POINT3_ON_DECK_DEFAULT "F10" -#define KB_SET_CUE_POINT4_ON_DECK "keyboard_shortcuts/kb_set_cue_point4_on_deck" -#define KB_SET_CUE_POINT4_ON_DECK_DEFAULT "F11" -#define KB_PLAY_CUE_POINT4_ON_DECK "keyboard_shortcuts/kb_play_cue_point4_on_deck" -#define KB_PLAY_CUE_POINT4_ON_DECK_DEFAULT "F12" -#define KB_COLLAPSE_BROWSER "keyboard_shortcuts/kb_collapse_browse" -#define KB_COLLAPSE_BROWSER_DEFAULT "Ctrl+Up" -#define KB_LOAD_TRACK_ON_SAMPLER1 "keyboard_shortcuts/kb_load_track_on_sampler1" -#define KB_LOAD_TRACK_ON_SAMPLER1_DEFAULT "&" -#define KB_LOAD_TRACK_ON_SAMPLER2 "keyboard_shortcuts/kb_load_track_on_sampler2" -#define KB_LOAD_TRACK_ON_SAMPLER2_DEFAULT "A" -#define KB_LOAD_TRACK_ON_SAMPLER3 "keyboard_shortcuts/kb_load_track_on_sampler3" -#define KB_LOAD_TRACK_ON_SAMPLER3_DEFAULT "Q" -#define KB_LOAD_TRACK_ON_SAMPLER4 "keyboard_shortcuts/kb_load_track_on_sampler4" -#define KB_LOAD_TRACK_ON_SAMPLER4_DEFAULT "W" -#define KB_SHOW_NEXT_KEYS "keyboard_shortcuts/kb_show_next_keys" -#define KB_SHOW_NEXT_KEYS_DEFAULT "K" -#define KB_FULLSCREEN "keyboard_shortcuts/kb_fullscreen" -#define KB_FULLSCREEN_DEFAULT "F" -#define KB_HELP "keyboard_shortcuts/kb_help" -#define KB_HELP_DEFAULT "H" -#define KB_FILE_SEARCH "keyboard_shortcuts/kb_file_search" -#define KB_FILE_SEARCH_DEFAULT "Ctrl+F" - -const QString KB_SET_CUE_POINTS_ON_DECK[] = { KB_SET_CUE_POINT1_ON_DECK, - KB_SET_CUE_POINT2_ON_DECK, - KB_SET_CUE_POINT3_ON_DECK, - KB_SET_CUE_POINT4_ON_DECK }; -const QString KB_SET_CUE_POINTS_ON_DECK_DEFAULT[] = { KB_SET_CUE_POINT1_ON_DECK_DEFAULT, - KB_SET_CUE_POINT2_ON_DECK_DEFAULT, - KB_SET_CUE_POINT3_ON_DECK_DEFAULT, - KB_SET_CUE_POINT4_ON_DECK_DEFAULT }; -const QString KB_PLAY_CUE_POINTS_ON_DECK[] = { KB_PLAY_CUE_POINT1_ON_DECK, - KB_PLAY_CUE_POINT2_ON_DECK, - KB_PLAY_CUE_POINT3_ON_DECK, - KB_PLAY_CUE_POINT4_ON_DECK }; -const QString KB_PLAY_CUE_POINTS_ON_DECK_DEFAULT[] = { KB_PLAY_CUE_POINT1_ON_DECK_DEFAULT, - KB_PLAY_CUE_POINT2_ON_DECK_DEFAULT, - KB_PLAY_CUE_POINT3_ON_DECK_DEFAULT, - KB_PLAY_CUE_POINT4_ON_DECK_DEFAULT }; - -class Application_settings : public QObject -{ - Q_OBJECT - - private: - QSettings settings; - QList available_gui_styles; - QMap available_vinyl_types; - QList available_rpms; - QList available_sample_rates; - QList available_nb_decks; - QList available_sound_cards; - bool audio_collection_full_refresh; - - public: - Application_settings(); - virtual ~Application_settings(); - - public: - void set_main_window_size(const QSize &size); - QSize get_main_window_size(); - QString get_main_window_size_default(); - - void set_browser_splitter_size(const QByteArray &state); - QByteArray get_browser_splitter_size(); - - void set_main_window_position(const QPoint &pos); - QPoint get_main_window_position(); - QString get_main_window_position_default(); - - void set_tracks_base_dir_path(const QString &path); - QString get_tracks_base_dir_path(); - QString get_tracks_base_dir_path_default(); - - void set_extern_prog(QString in_extern_prog_path); - QString get_extern_prog(); - QString get_extern_prog_default(); - - void set_gui_style(const QString &style); - QString get_gui_style(); - QString get_gui_style_default(); - QList get_available_gui_styles(); - - void set_nb_decks(const unsigned short int &nb_decks); - unsigned short int get_nb_decks(); - unsigned short int get_nb_decks_default(); - QList get_available_nb_decks(); - - void set_nb_samplers(const unsigned short int &nb_samplers); - unsigned short int get_nb_samplers(); - unsigned short int get_nb_samplers_default(); - - void set_sample_rate(const unsigned int &sample_rate); - unsigned int get_sample_rate(); - unsigned int get_sample_rate_default(); - QList get_available_sample_rates(); - - void set_sound_driver(const QString &driver); - QString get_sound_driver(); - QString get_sound_driver_default(); - void set_internal_sound_card(const QString &card); - QString get_internal_sound_card(); - QString get_internal_sound_card_default(); - QList get_available_internal_sound_cards(); - - void set_auto_jack_connections(const bool &do_autoconnect); - bool get_auto_jack_connections(); - bool get_auto_jack_connections_default(); - - void set_autostart_motion_detection(const bool &do_autostart); - bool get_autostart_motion_detection(); - bool get_autostart_motion_detection_default(); - - void set_vinyl_type(const unsigned short &deck_index, dscratch_vinyls_t vinyl_type); - dscratch_vinyls_t get_vinyl_type(const unsigned short &deck_index); - dscratch_vinyls_t get_vinyl_type_default(); - QMap get_available_vinyl_types(); - - void set_rpm(const unsigned short &deck_index, const dscratch_vinyl_rpm_t &rpm); - dscratch_vinyl_rpm_t get_rpm(const unsigned short &deck_index); - dscratch_vinyl_rpm_t get_rpm_default(); - QList get_available_rpms(); - - void set_keyboard_shortcut(const QString &kb_shortcut_path, const QString &value); - QString get_keyboard_shortcut(QString in_kb_shortcut_path); - - void set_samplers_visible(const bool &is_visible); - bool get_samplers_visible(); - bool get_samplers_visible_default(); - - // Runtime settings (not stored in preference file). - void set_audio_collection_full_refresh(const bool &full_refresh); - bool get_audio_collection_full_refresh(); - - private: - void init_settings(); -}; +/*============================================================================*/ +/* */ +/* */ +/* Digital Scratch Player */ +/* */ +/* */ +/*-------------------------------------------------( application_settings.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Set and get application settings */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include +#include + +#include "audiodev/sound_card_control_rules.h" +#include "app/application_const.h" + +using namespace std; + +// Application and main window. +#ifndef ENABLE_TEST_MODE + #define APPLICATION_NAME "digitalscratch" +#else + #define APPLICATION_NAME "digitalscratch-test" +#endif + +#define MAIN_WIN_SIZE_CFG "player/main_win_size" +#define MAIN_WIN_SIZE_CFG_DEFAULT "1024x640" + +#define MAIN_WIN_POS_CFG "player/main_win_position" +#define MAIN_WIN_POS_CFG_DEFAULT "50,50" + +#define BROWSER_SPLITTER_SIZE_CFG "player/browser_splitter_size" + +#define BASE_DIR_PATH_CFG "player/base_dir_path" + +#define GUI_STYLE_CFG "player/gui_style_select" +#define GUI_STYLE_NATIVE "native" +#define GUI_STYLE_DARK "dark" +#define GUI_STYLE_DARK_CSS SKINS_PATH "dark.css" +#define GUI_STYLE_DEFAULT "dark" +#define SAMPLERS_VISIBLE_CFG "player/samplers_visible" +#define SAMPLERS_VISIBLE_DEFAULT 1 +#define EXTERN_PROG_CFG "player/extern_prog" +#define NB_DECKS_CFG "player/nb_decks" +#define NB_DECKS_DEFAULT 2 +#define NB_SAMPLERS_CFG "player/nb_samplers" +#define NB_SAMPLERS_DEFAULT 4 + +// Sound caracteristics. +#define SAMPLE_RATE_CFG "sound_card/sample_rate" +#define SAMPLE_RATE_DEFAULT 44100 +#define AUTO_JACK_CONNECTIONS_CFG "sound_card/auto_jack_connections" +#define AUTO_JACK_CONNECTIONS_DEFAULT 1 +#define SOUND_DRIVER_CFG "sound_card/driver_select" +#define SOUND_DRIVER_JACK "jack" +#define SOUND_DRIVER_INTERNAL "internal" +#define SOUND_DRIVER_DEFAULT SOUND_DRIVER_JACK +#define SOUND_CARD_CFG "sound_card/sound_card_id" +#define SOUND_CARD_DEFAULT "0" + +// Decks: motion detection. +#define DECK_INDEX "deck_" +#define VINYL_TYPE_CFG "vinyl_type" +#define RPM_CFG "rpm" + +// Playback parameters. +#define MAX_SPEED_DIFF_CFG "playback_parameters/max_speed_diff" +#define SLOW_SPEED_ALGO_USAGE_CFG "playback_parameters/slow_speed_algo_usage" +#define MAX_NB_SPEED_STABIL_CFG "playback_parameters/min_nb_speed_for_stability" +#define NB_CYCLE_CHANGING_DIR_CFG "playback_parameters/nb_cycle_before_changing_direction" + +// Keyboard shortcuts. +#define KB_SWITCH_PLAYBACK "keyboard_shortcuts/kb_switch_playback" +#define KB_SWITCH_PLAYBACK_DEFAULT "SPACE" +#define KB_LOAD_TRACK_ON_DECK "keyboard_shortcuts/kb_load_track_on_deck" +#define KB_LOAD_TRACK_ON_DECK_DEFAULT "F1" +#define KB_PLAY_BEGIN_TRACK_ON_DECK "keyboard_shortcuts/kb_play_begin_track_on_deck" +#define KB_PLAY_BEGIN_TRACK_ON_DECK_DEFAULT "F2" + +#define KB_SET_CUE_POINT1_ON_DECK "keyboard_shortcuts/kb_set_cue_point1_on_deck" +#define KB_SET_CUE_POINT1_ON_DECK_DEFAULT "F5" +#define KB_PLAY_CUE_POINT1_ON_DECK "keyboard_shortcuts/kb_play_cue_point1_on_deck" +#define KB_PLAY_CUE_POINT1_ON_DECK_DEFAULT "F6" +#define KB_SET_CUE_POINT2_ON_DECK "keyboard_shortcuts/kb_set_cue_point2_on_deck" +#define KB_SET_CUE_POINT2_ON_DECK_DEFAULT "F7" +#define KB_PLAY_CUE_POINT2_ON_DECK "keyboard_shortcuts/kb_play_cue_point2_on_deck" +#define KB_PLAY_CUE_POINT2_ON_DECK_DEFAULT "F8" +#define KB_SET_CUE_POINT3_ON_DECK "keyboard_shortcuts/kb_set_cue_point3_on_deck" +#define KB_SET_CUE_POINT3_ON_DECK_DEFAULT "F9" +#define KB_PLAY_CUE_POINT3_ON_DECK "keyboard_shortcuts/kb_play_cue_point3_on_deck" +#define KB_PLAY_CUE_POINT3_ON_DECK_DEFAULT "F10" +#define KB_SET_CUE_POINT4_ON_DECK "keyboard_shortcuts/kb_set_cue_point4_on_deck" +#define KB_SET_CUE_POINT4_ON_DECK_DEFAULT "F11" +#define KB_PLAY_CUE_POINT4_ON_DECK "keyboard_shortcuts/kb_play_cue_point4_on_deck" +#define KB_PLAY_CUE_POINT4_ON_DECK_DEFAULT "F12" +#define KB_COLLAPSE_BROWSER "keyboard_shortcuts/kb_collapse_browse" +#define KB_COLLAPSE_BROWSER_DEFAULT "Ctrl+Up" +#define KB_LOAD_TRACK_ON_SAMPLER1 "keyboard_shortcuts/kb_load_track_on_sampler1" +#define KB_LOAD_TRACK_ON_SAMPLER1_DEFAULT "&" +#define KB_LOAD_TRACK_ON_SAMPLER2 "keyboard_shortcuts/kb_load_track_on_sampler2" +#define KB_LOAD_TRACK_ON_SAMPLER2_DEFAULT "A" +#define KB_LOAD_TRACK_ON_SAMPLER3 "keyboard_shortcuts/kb_load_track_on_sampler3" +#define KB_LOAD_TRACK_ON_SAMPLER3_DEFAULT "Q" +#define KB_LOAD_TRACK_ON_SAMPLER4 "keyboard_shortcuts/kb_load_track_on_sampler4" +#define KB_LOAD_TRACK_ON_SAMPLER4_DEFAULT "W" +#define KB_SHOW_NEXT_KEYS "keyboard_shortcuts/kb_show_next_keys" +#define KB_SHOW_NEXT_KEYS_DEFAULT "K" +#define KB_FULLSCREEN "keyboard_shortcuts/kb_fullscreen" +#define KB_FULLSCREEN_DEFAULT "F" +#define KB_HELP "keyboard_shortcuts/kb_help" +#define KB_HELP_DEFAULT "H" +#define KB_FILE_SEARCH "keyboard_shortcuts/kb_file_search" +#define KB_FILE_SEARCH_DEFAULT "Ctrl+F" + +const QString KB_SET_CUE_POINTS_ON_DECK[] = { KB_SET_CUE_POINT1_ON_DECK, + KB_SET_CUE_POINT2_ON_DECK, + KB_SET_CUE_POINT3_ON_DECK, + KB_SET_CUE_POINT4_ON_DECK }; +const QString KB_SET_CUE_POINTS_ON_DECK_DEFAULT[] = { KB_SET_CUE_POINT1_ON_DECK_DEFAULT, + KB_SET_CUE_POINT2_ON_DECK_DEFAULT, + KB_SET_CUE_POINT3_ON_DECK_DEFAULT, + KB_SET_CUE_POINT4_ON_DECK_DEFAULT }; +const QString KB_PLAY_CUE_POINTS_ON_DECK[] = { KB_PLAY_CUE_POINT1_ON_DECK, + KB_PLAY_CUE_POINT2_ON_DECK, + KB_PLAY_CUE_POINT3_ON_DECK, + KB_PLAY_CUE_POINT4_ON_DECK }; +const QString KB_PLAY_CUE_POINTS_ON_DECK_DEFAULT[] = { KB_PLAY_CUE_POINT1_ON_DECK_DEFAULT, + KB_PLAY_CUE_POINT2_ON_DECK_DEFAULT, + KB_PLAY_CUE_POINT3_ON_DECK_DEFAULT, + KB_PLAY_CUE_POINT4_ON_DECK_DEFAULT }; + +class Application_settings : public QObject +{ + Q_OBJECT + + private: + QSettings settings; + QList available_gui_styles; + QMap available_vinyl_types; + QList available_rpms; + QList available_sample_rates; + QList available_nb_decks; + QList available_sound_cards; + bool audio_collection_full_refresh; + + public: + Application_settings(); + virtual ~Application_settings(); + + public: + void set_main_window_size(const QSize &size); + QSize get_main_window_size(); + QString get_main_window_size_default(); + + void set_browser_splitter_size(const QByteArray &state); + QByteArray get_browser_splitter_size(); + + void set_main_window_position(const QPoint &pos); + QPoint get_main_window_position(); + QString get_main_window_position_default(); + + void set_tracks_base_dir_path(const QString &path); + QString get_tracks_base_dir_path(); + QString get_tracks_base_dir_path_default(); + + void set_extern_prog(QString in_extern_prog_path); + QString get_extern_prog(); + QString get_extern_prog_default(); + + void set_gui_style(const QString &style); + QString get_gui_style(); + QString get_gui_style_default(); + QList get_available_gui_styles(); + + void set_nb_decks(const unsigned short int &nb_decks); + unsigned short int get_nb_decks(); + unsigned short int get_nb_decks_default(); + QList get_available_nb_decks(); + + void set_nb_samplers(const unsigned short int &nb_samplers); + unsigned short int get_nb_samplers(); + unsigned short int get_nb_samplers_default(); + + void set_sample_rate(const unsigned int &sample_rate); + unsigned int get_sample_rate(); + unsigned int get_sample_rate_default(); + QList get_available_sample_rates(); + + void set_sound_driver(const QString &driver); + QString get_sound_driver(); + QString get_sound_driver_default(); + void set_internal_sound_card(const QString &card); + QString get_internal_sound_card(); + QString get_internal_sound_card_default(); + QList get_available_internal_sound_cards(); + + void set_auto_jack_connections(const bool &do_autoconnect); + bool get_auto_jack_connections(); + bool get_auto_jack_connections_default(); + + void set_autostart_motion_detection(const bool &do_autostart); + bool get_autostart_motion_detection(); + bool get_autostart_motion_detection_default(); + + void set_vinyl_type(const unsigned short &deck_index, dscratch_vinyls_t vinyl_type); + dscratch_vinyls_t get_vinyl_type(const unsigned short &deck_index); + dscratch_vinyls_t get_vinyl_type_default(); + QMap get_available_vinyl_types(); + + void set_rpm(const unsigned short &deck_index, const dscratch_vinyl_rpm_t &rpm); + dscratch_vinyl_rpm_t get_rpm(const unsigned short &deck_index); + dscratch_vinyl_rpm_t get_rpm_default(); + QList get_available_rpms(); + + void set_keyboard_shortcut(const QString &kb_shortcut_path, const QString &value); + QString get_keyboard_shortcut(QString in_kb_shortcut_path); + + void set_samplers_visible(const bool &is_visible); + bool get_samplers_visible(); + bool get_samplers_visible_default(); + + // Runtime settings (not stored in preference file). + void set_audio_collection_full_refresh(const bool &full_refresh); + bool get_audio_collection_full_refresh(); + + private: + void init_settings(); +}; diff --git a/digitalscratch/include/gui/config_dialog.h b/digitalscratch/include/gui/config_dialog.h index cc0a367..14b1fb6 100644 --- a/digitalscratch/include/gui/config_dialog.h +++ b/digitalscratch/include/gui/config_dialog.h @@ -1,145 +1,145 @@ -/*============================================================================*/ -/* */ -/* */ -/* Digital Scratch Player */ -/* */ -/* */ -/*--------------------------------------------------------( config_dialog.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Creates configuration GUI for DigitalScratch player */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "app/application_settings.h" -#include "app/application_const.h" - -#define ICON ":/pixmaps/digitalscratch-icon.png" - -using namespace std; - -class ShortcutQLabel : public QLabel -{ - Q_OBJECT - - public: - explicit ShortcutQLabel(QWidget *parent=0); - virtual ~ShortcutQLabel(); - void set_old_text(); - - private: - bool capturing; - QString old_text; - - private: - void start_capture(); - void cancel_capture(); - void finish_capture(int in_key); - - signals: - void clicked(); - void new_value(QString in_value); - - protected: - void mousePressEvent(QMouseEvent *in_mouse_event); - void keyPressEvent(QKeyEvent *in_key_event); -}; - -class Config_dialog : public QDialog -{ - Q_OBJECT - - public: - - private: - QLineEdit *base_dir_path; - QLineEdit *extern_prog; - QComboBox *gui_style_select; - QComboBox *nb_decks_select; - QComboBox *sample_rate_select; - QCheckBox *device_jack_check; - QCheckBox *auto_jack_connections_check; - QCheckBox *device_internal_check; - QComboBox *device_internal_select; - - QList vinyl_type_select; - QList rpm_select; - ShortcutQLabel *kb_switch_playback; - ShortcutQLabel *kb_load_track_on_deck; - ShortcutQLabel *kb_play_begin_track_on_deck; - ShortcutQLabel *kb_get_next_track_from_deck; - ShortcutQLabel *kb_set_cue_point1_on_deck; - ShortcutQLabel *kb_play_cue_point1_on_deck; - ShortcutQLabel *kb_set_cue_point2_on_deck; - ShortcutQLabel *kb_play_cue_point2_on_deck; - ShortcutQLabel *kb_set_cue_point3_on_deck; - ShortcutQLabel *kb_play_cue_point3_on_deck; - ShortcutQLabel *kb_set_cue_point4_on_deck; - ShortcutQLabel *kb_play_cue_point4_on_deck; - ShortcutQLabel *kb_reset_signal_level_on_deck; - ShortcutQLabel *kb_fullscreen; - ShortcutQLabel *kb_collapse_browse; - ShortcutQLabel *kb_load_track_on_sampler1; - ShortcutQLabel *kb_load_track_on_sampler2; - ShortcutQLabel *kb_load_track_on_sampler3; - ShortcutQLabel *kb_load_track_on_sampler4; - ShortcutQLabel *kb_help; - ShortcutQLabel *kb_file_search; - Application_settings *settings; - - public: - explicit Config_dialog(QWidget *parent); - virtual ~Config_dialog(); - int show(); - - private: - void accept(); - void reject(); - QWidget *init_tab_player(); - QWidget *init_tab_sound_card(); - QWidget *init_tab_motion_detect(const unsigned short int &deck_index); - QWidget *init_tab_shortcuts(); - void fill_tab_player(); - void fill_tab_sound_card(); - void fill_tab_motion_detect(const unsigned short &deck_index); - void fill_tab_shortcuts(); - bool is_duplicate_shortcut(const QString &value); - - private slots: - bool show_browse_window(); - bool show_browse_extern_prog_window(); - void reset_shortcuts(); - void reset_motion_detection_params(const unsigned short int & deck_index); - void validate_and_set_shortcut(const QString &value, ShortcutQLabel *label); -}; +/*============================================================================*/ +/* */ +/* */ +/* Digital Scratch Player */ +/* */ +/* */ +/*--------------------------------------------------------( config_dialog.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Creates configuration GUI for DigitalScratch player */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "app/application_settings.h" +#include "app/application_const.h" + +#define ICON ":/pixmaps/digitalscratch-icon.png" + +using namespace std; + +class ShortcutQLabel : public QLabel +{ + Q_OBJECT + + public: + explicit ShortcutQLabel(QWidget *parent=0); + virtual ~ShortcutQLabel(); + void set_old_text(); + + private: + bool capturing; + QString old_text; + + private: + void start_capture(); + void cancel_capture(); + void finish_capture(int in_key); + + signals: + void clicked(); + void new_value(QString in_value); + + protected: + void mousePressEvent(QMouseEvent *in_mouse_event); + void keyPressEvent(QKeyEvent *in_key_event); +}; + +class Config_dialog : public QDialog +{ + Q_OBJECT + + public: + + private: + QLineEdit *base_dir_path; + QLineEdit *extern_prog; + QComboBox *gui_style_select; + QComboBox *nb_decks_select; + QComboBox *sample_rate_select; + QCheckBox *device_jack_check; + QCheckBox *auto_jack_connections_check; + QCheckBox *device_internal_check; + QComboBox *device_internal_select; + + QList vinyl_type_select; + QList rpm_select; + ShortcutQLabel *kb_switch_playback; + ShortcutQLabel *kb_load_track_on_deck; + ShortcutQLabel *kb_play_begin_track_on_deck; + ShortcutQLabel *kb_get_next_track_from_deck; + ShortcutQLabel *kb_set_cue_point1_on_deck; + ShortcutQLabel *kb_play_cue_point1_on_deck; + ShortcutQLabel *kb_set_cue_point2_on_deck; + ShortcutQLabel *kb_play_cue_point2_on_deck; + ShortcutQLabel *kb_set_cue_point3_on_deck; + ShortcutQLabel *kb_play_cue_point3_on_deck; + ShortcutQLabel *kb_set_cue_point4_on_deck; + ShortcutQLabel *kb_play_cue_point4_on_deck; + ShortcutQLabel *kb_reset_signal_level_on_deck; + ShortcutQLabel *kb_fullscreen; + ShortcutQLabel *kb_collapse_browse; + ShortcutQLabel *kb_load_track_on_sampler1; + ShortcutQLabel *kb_load_track_on_sampler2; + ShortcutQLabel *kb_load_track_on_sampler3; + ShortcutQLabel *kb_load_track_on_sampler4; + ShortcutQLabel *kb_help; + ShortcutQLabel *kb_file_search; + Application_settings *settings; + + public: + explicit Config_dialog(QWidget *parent); + virtual ~Config_dialog(); + int show(); + + private: + void accept(); + void reject(); + QWidget *init_tab_player(); + QWidget *init_tab_sound_card(); + QWidget *init_tab_motion_detect(const unsigned short int &deck_index); + QWidget *init_tab_shortcuts(); + void fill_tab_player(); + void fill_tab_sound_card(); + void fill_tab_motion_detect(const unsigned short &deck_index); + void fill_tab_shortcuts(); + bool is_duplicate_shortcut(const QString &value); + + private slots: + bool show_browse_window(); + bool show_browse_extern_prog_window(); + void reset_shortcuts(); + void reset_motion_detection_params(const unsigned short int & deck_index); + void validate_and_set_shortcut(const QString &value, ShortcutQLabel *label); +}; diff --git a/digitalscratch/include/gui/gui.h b/digitalscratch/include/gui/gui.h index 9d45205..1159d49 100644 --- a/digitalscratch/include/gui/gui.h +++ b/digitalscratch/include/gui/gui.h @@ -1,519 +1,519 @@ -/*============================================================================*/ -/* */ -/* */ -/* Digital Scratch Player */ -/* */ -/* */ -/*------------------------------------------------------------------( gui.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Creates GUI for DigitalScratch player */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "gui/config_dialog.h" -#include "gui/waveform.h" -#include "app/application_settings.h" -#include "app/application_const.h" -#include "player/deck_playback_process.h" -#include "player/playback_parameters.h" -#include "player/control_and_playback_process.h" -#include "audiodev/audio_io_control_rules.h" -#include "tracks/audio_track.h" -#include "tracks/audio_file_decoding_process.h" -#include "tracks/audio_collection_model.h" -#include "tracks/playlist.h" -#include "control/dicer_control_process.h" - -using namespace std; - -#define XSTR(x) #x -#define STR(x) XSTR(x) - -class SpeedQPushButton : public QPushButton -{ - Q_OBJECT - - Q_PROPERTY(bool pressed - READ is_pressed - WRITE set_pressed - STORED true) - private: - bool l_pressed; - void set_pressed(bool is_pressed) { l_pressed = is_pressed; } - - public: - explicit SpeedQPushButton(const QString &title); - virtual ~SpeedQPushButton(); - bool is_pressed() { return l_pressed; } - void redraw(); - - protected: - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - - signals: - void right_clicked(); -}; - -class SpeedQLabel : public QLabel -{ - Q_OBJECT - - protected: - void mouseReleaseEvent(QMouseEvent *event); - - signals: - void right_clicked(); -}; - - -class PlaybackQGroupBox : public QGroupBox -{ - Q_OBJECT - - Q_PROPERTY(bool selected - READ is_selected - WRITE set_selected - STORED true) - private: - bool l_selected; - void set_selected(bool is_selected) { l_selected = is_selected; } - - public: - explicit PlaybackQGroupBox(const QString &title); - virtual ~PlaybackQGroupBox(); - bool is_selected() { return l_selected; } - void redraw(); - - protected: - void mousePressEvent(QMouseEvent *event); - void enterEvent(QEvent *event); - void leaveEvent(QEvent *event); - void dragEnterEvent(QDragEnterEvent *event); - void dropEvent(QDropEvent *event); - - signals: - void selected(); - void hover(); - void unhover(); - void file_dropped(); -}; - -class Deck : public PlaybackQGroupBox -{ - Q_OBJECT - - public: - QSharedPointer at; - QLabel *track_name; - QPushButton *thru_button; - QLabel *key; - Waveform *waveform; - QHBoxLayout *remaining_time_layout; - QLabel *rem_time_minus; - QLabel *rem_time_min; - QLabel *rem_time_sep1; - QLabel *rem_time_sec; - QLabel *rem_time_sep2; - QLabel *rem_time_msec; - QHBoxLayout *buttons_layout; - QPushButton *timecode_button; - QPushButton *manual_button; - SpeedQLabel *speed; - SpeedQPushButton *speed_up_button; - SpeedQPushButton *speed_down_button; - SpeedQPushButton *accel_up_button; - SpeedQPushButton *accel_down_button; - QPushButton *restart_button; - QPushButton **cue_set_buttons; - QPushButton **cue_play_buttons; - QPushButton **cue_del_buttons; - QLabel **cue_point_labels; - - private: - Application_settings *settings; - - public: - Deck(const QString &title, const QSharedPointer &at); - virtual ~Deck(); - void init_display(); - void set_key(const QString &key); - - public slots: - void set_speed_mode_timecode(); - void set_speed_mode_manual(); -}; - -class QSamplerContainerWidget : public QWidget -{ - Q_OBJECT - - protected: - void dragEnterEvent(QDragEnterEvent *event); - void dropEvent(QDropEvent *event); - - public: - QSamplerContainerWidget(); - virtual ~QSamplerContainerWidget(); - - signals: - void file_dropped_in_sampler(); -}; - -class Sampler : public PlaybackQGroupBox -{ - Q_OBJECT - - public: - QList buttons_play; - QList buttons_stop; - QList buttons_del; - QList tracknames; - QList remaining_times; - QList drop_areas; - - private: - unsigned short int nb_samplers; - Application_settings *settings; - - public: - Sampler(const QString &title, - const unsigned short int &nb_samplers); - virtual ~Sampler(); - void init_display(); -}; - -class FileBrowserControlButtons : public QHBoxLayout -{ - Q_OBJECT - - public: - QPushButton *load_track_on_deck_button; - QPushButton *show_next_key_from_deck_button; - QList load_sample_buttons; - - public: - FileBrowserControlButtons(const unsigned short int &deck_index, - const unsigned short int &nb_samplers); - virtual ~FileBrowserControlButtons(); - void init_display(); - void hide_load_sample_buttons(); - void show_load_sample_buttons(); -}; - -class TreeViewIconProvider : public QFileIconProvider -{ - public: - TreeViewIconProvider(); - virtual ~TreeViewIconProvider(); - - private: - QIcon drive; - QIcon folder; - QIcon file; - QIcon other; - - public: - QIcon icon(IconType type) const; - QIcon icon(const QFileInfo &info) const; - QString type(const QFileInfo &info) const; - void set_icons(const QIcon &drive, - const QIcon &folder, - const QIcon &file, - const QIcon &other); - void set_default_icons(); -}; - -class Gui : public QObject -{ - Q_OBJECT - - private: - // Decks area. - QHBoxLayout *decks_layout; - QShortcut *shortcut_go_to_begin; - QShortcut **shortcut_set_cue_points; - QShortcut **shortcut_go_to_cue_points; - QShortcut *shortcut_switch_playback; - QShortcut *shortcut_reset_signal_level; - QList decks; - unsigned short int selected_deck; - - // Samplers area. - QWidget *samplers_container; - QHBoxLayout *samplers_layout; - QList samplers; - - // File control buttons area. - QHBoxLayout *file_control_buttons_layout; - QList file_browser_control_buttons; - - // File and menu (bottom right) area. - QHBoxLayout *file_and_menu_layout; - - // File browser. - QSplitter *browser_splitter; - QGroupBox *file_browser_gbox; - QFutureWatcher *watcher_parse_directory; - - // Folder browser. - TreeViewIconProvider *treeview_icon_provider; - QFileSystemModel *folder_system_model; - QTreeView *folder_browser; - - // Track browser. - Audio_collection_model *file_system_model; - QTreeView *file_browser; - QShortcut *shortcut_collapse_browser; - QShortcut *shortcut_load_audio_file; - QList shortcut_load_samples; - QShortcut *shortcut_show_next_keys; - QShortcut *shortcut_file_search; - QShortcut *shortcut_file_search_press_enter; - QShortcut *shortcut_file_search_press_esc; - - // Track search bar. - QLineEdit *file_search; - bool search_from_begin; - unsigned int file_browser_selected_index; - QString last_search_string; - - // Menu (bottom right). - QPushButton *config_button; - QPushButton *fullscreen_button; - QPushButton *logo; - QPushButton *help_button; - QPushButton *quit_button; - QShortcut *shortcut_fullscreen; - QShortcut *shortcut_help; - - // Action menu. - QPushButton *scan_audio_keys_button; - QPushButton *show_hide_samplers_button; - QPushButton *clear_tracklist_button; - QPushButton *save_tracklist_button; - - // Bottom help area. - QHBoxLayout *bottom_layout; - QGroupBox *help_groupbox; - QLabel *help_fullscreen_value; - QLabel *help_help_value; - QLabel *help_switch_deck_value; - QLabel *help_load_deck_value; - QLabel *help_next_track_value; - QLabel *help_cue_value; - QLabel *help_reset_signal_value; - QLabel *help_sample_value; - QLabel *help_browse_value1; - QLabel *help_browse_value2; - - // Status area (progress bar). - QHBoxLayout *status_layout; - QProgressBar *progress_bar; - QLabel *progress_label; - QPushButton *progress_cancel_button; - QGroupBox *progress_groupbox; - - // Main window. - QWidget *window; - QString window_style; - bool is_window_rendered; - unsigned short int nb_decks; - - // Pop dialogs. - Config_dialog *config_dialog; - QDialog *scan_audio_keys_dialog; - - // Tracklist. - QSharedPointer tracklist; - - // Main processing elements. - QList> ats; - QList>> at_samplers; - unsigned short int nb_samplers; - QList> decs; - QList>> dec_samplers; - QList> params; - QList> tcode_controls; - QList> manual_controls; - QList> playbacks; - QSharedPointer sound_card; - QSharedPointer control_and_play; - Application_settings *settings; - - // External controller. - QSharedPointer dicer_control; - - public: - Gui(QList> &ats, - QList>> &at_samplers, - QList> &decs, - QList>> &dec_samplers, - QList> ¶ms, - QList> &tcode_controls, - QList> &manual_controls, - QSharedPointer &dicer_control, - QList> &playbacks, - QSharedPointer &sound_card, - QSharedPointer &control_and_playback); - virtual ~Gui(); - - private: - bool create_main_window(); - void init_decks_area(); - void clean_decks_area(); - void connect_decks_area(); - void init_samplers_area(); - void clean_samplers_area(); - void connect_samplers_area(); - void connect_decks_and_samplers_selection(); - void init_file_control_area(); - void connect_file_control_area(); - void init_file_browser_area(); - void clean_file_browser_area(); - void connect_file_browser_area(); - void init_menu_area(); - QHBoxLayout *get_menu_area_title(const QString &title); - void connect_menu_area(); - void init_bottom_help(); - void init_bottom_status(); - void display_audio_file_collection(); - bool apply_main_window_style(); - bool set_file_browser_playlist_tracks(const Playlist &playlist); - bool set_file_browser_base_path(const QString &path); - bool set_folder_browser_base_path(const QString &path); - bool set_file_browser_title(const QString &title); - bool apply_application_settings(); - void highlight_deck_sampler_area(const unsigned short int &deck_index); - void highlight_border_deck_sampler_area(const unsigned short int &deck_index, const bool &switch_on); - unsigned short int get_selected_deck_index(); - void resize_file_browser_columns(); - void analyze_audio_collection(const bool &is_all_files); - void set_help_shortcut_value(); - void hide_samplers(); - void show_samplers(); - void add_track_path_to_tracklist(const unsigned short int &deck_index); - void write_tracklist(); - void connect_dicer_actions(); - bool get_dicer_index_from_deck_index(const unsigned short &deck_index, dicer_t &out_dicer_index); - bool get_dicer_button_from_cue_point_index(const unsigned short &cue_point_index, dicer_button_t &out_dicer_button); - bool get_deck_index_from_dicer_index(const dicer_t &dicer_index, unsigned short int &out_deck_index); - bool get_cue_point_index_from_dicer_button(const dicer_button_t &button_index, unsigned short int &out_cue_point_index); - void lit_dicer_button_cue_point(const unsigned short &deck_index, const unsigned short &cue_point_index); - void unlit_dicer_button_cue_point(const unsigned short &deck_index, const unsigned short &cue_point_index); - - public slots: - void force_close(); - - private slots: - bool show_config_window(); - void set_fullscreen(); - void show_help(); - void set_focus_search_bar(); - void press_enter_in_search_bar(); - void press_esc_in_search_bar(); - void file_search_string(const QString &text); - bool show_about_window(); - bool show_scan_audio_keys_dialog(); - void reject_refresh_audio_collection_dialog(); - void close_refresh_audio_collection_dialog(); - void accept_refresh_audio_collection_dialog_all_files(); - void accept_refresh_audio_collection_dialog_new_files(); - bool show_error_window(const QString &error_message); - void select_and_run_audio_file_decoding_process(const unsigned short int &deck_index); - void run_audio_file_decoding_process(); - void show_hide_samplers(); - void select_and_run_sample_decoding_process(const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void run_sampler_decoding_process(const unsigned short int &sampler_index); - void run_sampler_decoding_process(const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void run_sampler_decoding_process_on_deck(const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void set_sampler_text(const QString &text, - const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void sampler_button_play_clicked(const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void sampler_button_stop_clicked(const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void sampler_button_del_clicked(const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void set_remaining_time(const unsigned int &remaining_time, - const unsigned short int &deck_index); - void set_sampler_remaining_time(const unsigned int &remaining_time, - const unsigned short int &deck_index, - const unsigned short int &sampler_index); - void set_sampler_state(const unsigned short int &deck_index, - const unsigned short int &sampler_index, - const bool &state); - void jump_to_position(const float &position, - const unsigned short int &deck_index); // 0.0 < Position < 1.0 - void deck_go_to_begin(); - void go_to_begin(const unsigned short int &deck_index); - bool set_cue_point(const unsigned short int &deck_index, - const unsigned short int &cue_point_index); - void go_to_cue_point(const unsigned short int &deck_index, - const unsigned short int &cue_point_index); - bool del_cue_point(const unsigned short int &deck_index, - const unsigned short int &cue_point_index); - void switch_playback_selection(); - void select_playback(const unsigned short int &deck_index); - void hover_playback(const unsigned short int &deck_index); - void unhover_playback(const unsigned short int &deck_index); - void on_file_browser_expand(QModelIndex); - void on_file_browser_double_click(QModelIndex in_model_index); - void sync_file_browser_to_audio_collection(); - void on_finished_analyze_audio_collection(); - void update_refresh_progress_value(const unsigned int &value); - void select_and_show_next_keys(const unsigned short int &deck_index); - void show_next_keys(); - void on_file_browser_header_click(const int &index); - void on_progress_cancel_button_click(); - void run_concurrent_read_collection_from_db(); - void update_speed_label(const float &speed, const unsigned short &deck_index); - void speed_up_down(const float &speed_inc, const unsigned short int &deck_index); - void speed_accel(const float &speed_inc, const unsigned short &deck_index); - void speed_reset_to_100p(const unsigned short int &deck_index); - void playback_thru(const unsigned short int &deck_index, const bool &on_off); - void can_close(); - void show_save_tracklist_dialog(); - void show_clear_tracklist_dialog(); -}; +/*============================================================================*/ +/* */ +/* */ +/* Digital Scratch Player */ +/* */ +/* */ +/*------------------------------------------------------------------( gui.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Creates GUI for DigitalScratch player */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gui/config_dialog.h" +#include "gui/waveform.h" +#include "app/application_settings.h" +#include "app/application_const.h" +#include "player/deck_playback_process.h" +#include "player/playback_parameters.h" +#include "player/control_and_playback_process.h" +#include "audiodev/audio_io_control_rules.h" +#include "tracks/audio_track.h" +#include "tracks/audio_file_decoding_process.h" +#include "tracks/audio_collection_model.h" +#include "tracks/playlist.h" +#include "control/dicer_control_process.h" + +using namespace std; + +#define XSTR(x) #x +#define STR(x) XSTR(x) + +class SpeedQPushButton : public QPushButton +{ + Q_OBJECT + + Q_PROPERTY(bool pressed + READ is_pressed + WRITE set_pressed + STORED true) + private: + bool l_pressed; + void set_pressed(bool is_pressed) { l_pressed = is_pressed; } + + public: + explicit SpeedQPushButton(const QString &title); + virtual ~SpeedQPushButton(); + bool is_pressed() { return l_pressed; } + void redraw(); + + protected: + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + + signals: + void right_clicked(); +}; + +class SpeedQLabel : public QLabel +{ + Q_OBJECT + + protected: + void mouseReleaseEvent(QMouseEvent *event); + + signals: + void right_clicked(); +}; + + +class PlaybackQGroupBox : public QGroupBox +{ + Q_OBJECT + + Q_PROPERTY(bool selected + READ is_selected + WRITE set_selected + STORED true) + private: + bool l_selected; + void set_selected(bool is_selected) { l_selected = is_selected; } + + public: + explicit PlaybackQGroupBox(const QString &title); + virtual ~PlaybackQGroupBox(); + bool is_selected() { return l_selected; } + void redraw(); + + protected: + void mousePressEvent(QMouseEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + + signals: + void selected(); + void hover(); + void unhover(); + void file_dropped(); +}; + +class Deck : public PlaybackQGroupBox +{ + Q_OBJECT + + public: + QSharedPointer at; + QLabel *track_name; + QPushButton *thru_button; + QLabel *key; + Waveform *waveform; + QHBoxLayout *remaining_time_layout; + QLabel *rem_time_minus; + QLabel *rem_time_min; + QLabel *rem_time_sep1; + QLabel *rem_time_sec; + QLabel *rem_time_sep2; + QLabel *rem_time_msec; + QHBoxLayout *buttons_layout; + QPushButton *timecode_button; + QPushButton *manual_button; + SpeedQLabel *speed; + SpeedQPushButton *speed_up_button; + SpeedQPushButton *speed_down_button; + SpeedQPushButton *accel_up_button; + SpeedQPushButton *accel_down_button; + QPushButton *restart_button; + QPushButton **cue_set_buttons; + QPushButton **cue_play_buttons; + QPushButton **cue_del_buttons; + QLabel **cue_point_labels; + + private: + Application_settings *settings; + + public: + Deck(const QString &title, const QSharedPointer &at); + virtual ~Deck(); + void init_display(); + void set_key(const QString &key); + + public slots: + void set_speed_mode_timecode(); + void set_speed_mode_manual(); +}; + +class QSamplerContainerWidget : public QWidget +{ + Q_OBJECT + + protected: + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + + public: + QSamplerContainerWidget(); + virtual ~QSamplerContainerWidget(); + + signals: + void file_dropped_in_sampler(); +}; + +class Sampler : public PlaybackQGroupBox +{ + Q_OBJECT + + public: + QList buttons_play; + QList buttons_stop; + QList buttons_del; + QList tracknames; + QList remaining_times; + QList drop_areas; + + private: + unsigned short int nb_samplers; + Application_settings *settings; + + public: + Sampler(const QString &title, + const unsigned short int &nb_samplers); + virtual ~Sampler(); + void init_display(); +}; + +class FileBrowserControlButtons : public QHBoxLayout +{ + Q_OBJECT + + public: + QPushButton *load_track_on_deck_button; + QPushButton *show_next_key_from_deck_button; + QList load_sample_buttons; + + public: + FileBrowserControlButtons(const unsigned short int &deck_index, + const unsigned short int &nb_samplers); + virtual ~FileBrowserControlButtons(); + void init_display(); + void hide_load_sample_buttons(); + void show_load_sample_buttons(); +}; + +class TreeViewIconProvider : public QFileIconProvider +{ + public: + TreeViewIconProvider(); + virtual ~TreeViewIconProvider(); + + private: + QIcon drive; + QIcon folder; + QIcon file; + QIcon other; + + public: + QIcon icon(IconType type) const; + QIcon icon(const QFileInfo &info) const; + QString type(const QFileInfo &info) const; + void set_icons(const QIcon &drive, + const QIcon &folder, + const QIcon &file, + const QIcon &other); + void set_default_icons(); +}; + +class Gui : public QObject +{ + Q_OBJECT + + private: + // Decks area. + QHBoxLayout *decks_layout; + QShortcut *shortcut_go_to_begin; + QShortcut **shortcut_set_cue_points; + QShortcut **shortcut_go_to_cue_points; + QShortcut *shortcut_switch_playback; + QShortcut *shortcut_reset_signal_level; + QList decks; + unsigned short int selected_deck; + + // Samplers area. + QWidget *samplers_container; + QHBoxLayout *samplers_layout; + QList samplers; + + // File control buttons area. + QHBoxLayout *file_control_buttons_layout; + QList file_browser_control_buttons; + + // File and menu (bottom right) area. + QHBoxLayout *file_and_menu_layout; + + // File browser. + QSplitter *browser_splitter; + QGroupBox *file_browser_gbox; + QFutureWatcher *watcher_parse_directory; + + // Folder browser. + TreeViewIconProvider *treeview_icon_provider; + QFileSystemModel *folder_system_model; + QTreeView *folder_browser; + + // Track browser. + Audio_collection_model *file_system_model; + QTreeView *file_browser; + QShortcut *shortcut_collapse_browser; + QShortcut *shortcut_load_audio_file; + QList shortcut_load_samples; + QShortcut *shortcut_show_next_keys; + QShortcut *shortcut_file_search; + QShortcut *shortcut_file_search_press_enter; + QShortcut *shortcut_file_search_press_esc; + + // Track search bar. + QLineEdit *file_search; + bool search_from_begin; + unsigned int file_browser_selected_index; + QString last_search_string; + + // Menu (bottom right). + QPushButton *config_button; + QPushButton *fullscreen_button; + QPushButton *logo; + QPushButton *help_button; + QPushButton *quit_button; + QShortcut *shortcut_fullscreen; + QShortcut *shortcut_help; + + // Action menu. + QPushButton *scan_audio_keys_button; + QPushButton *show_hide_samplers_button; + QPushButton *clear_tracklist_button; + QPushButton *save_tracklist_button; + + // Bottom help area. + QHBoxLayout *bottom_layout; + QGroupBox *help_groupbox; + QLabel *help_fullscreen_value; + QLabel *help_help_value; + QLabel *help_switch_deck_value; + QLabel *help_load_deck_value; + QLabel *help_next_track_value; + QLabel *help_cue_value; + QLabel *help_reset_signal_value; + QLabel *help_sample_value; + QLabel *help_browse_value1; + QLabel *help_browse_value2; + + // Status area (progress bar). + QHBoxLayout *status_layout; + QProgressBar *progress_bar; + QLabel *progress_label; + QPushButton *progress_cancel_button; + QGroupBox *progress_groupbox; + + // Main window. + QWidget *window; + QString window_style; + bool is_window_rendered; + unsigned short int nb_decks; + + // Pop dialogs. + Config_dialog *config_dialog; + QDialog *scan_audio_keys_dialog; + + // Tracklist. + QSharedPointer tracklist; + + // Main processing elements. + QList> ats; + QList>> at_samplers; + unsigned short int nb_samplers; + QList> decs; + QList>> dec_samplers; + QList> params; + QList> tcode_controls; + QList> manual_controls; + QList> playbacks; + QSharedPointer sound_card; + QSharedPointer control_and_play; + Application_settings *settings; + + // External controller. + QSharedPointer dicer_control; + + public: + Gui(QList> &ats, + QList>> &at_samplers, + QList> &decs, + QList>> &dec_samplers, + QList> ¶ms, + QList> &tcode_controls, + QList> &manual_controls, + QSharedPointer &dicer_control, + QList> &playbacks, + QSharedPointer &sound_card, + QSharedPointer &control_and_playback); + virtual ~Gui(); + + private: + bool create_main_window(); + void init_decks_area(); + void clean_decks_area(); + void connect_decks_area(); + void init_samplers_area(); + void clean_samplers_area(); + void connect_samplers_area(); + void connect_decks_and_samplers_selection(); + void init_file_control_area(); + void connect_file_control_area(); + void init_file_browser_area(); + void clean_file_browser_area(); + void connect_file_browser_area(); + void init_menu_area(); + QHBoxLayout *get_menu_area_title(const QString &title); + void connect_menu_area(); + void init_bottom_help(); + void init_bottom_status(); + void display_audio_file_collection(); + bool apply_main_window_style(); + bool set_file_browser_playlist_tracks(const Playlist &playlist); + bool set_file_browser_base_path(const QString &path); + bool set_folder_browser_base_path(const QString &path); + bool set_file_browser_title(const QString &title); + bool apply_application_settings(); + void highlight_deck_sampler_area(const unsigned short int &deck_index); + void highlight_border_deck_sampler_area(const unsigned short int &deck_index, const bool &switch_on); + unsigned short int get_selected_deck_index(); + void resize_file_browser_columns(); + void analyze_audio_collection(const bool &is_all_files); + void set_help_shortcut_value(); + void hide_samplers(); + void show_samplers(); + void add_track_path_to_tracklist(const unsigned short int &deck_index); + void write_tracklist(); + void connect_dicer_actions(); + bool get_dicer_index_from_deck_index(const unsigned short &deck_index, dicer_t &out_dicer_index); + bool get_dicer_button_from_cue_point_index(const unsigned short &cue_point_index, dicer_button_t &out_dicer_button); + bool get_deck_index_from_dicer_index(const dicer_t &dicer_index, unsigned short int &out_deck_index); + bool get_cue_point_index_from_dicer_button(const dicer_button_t &button_index, unsigned short int &out_cue_point_index); + void lit_dicer_button_cue_point(const unsigned short &deck_index, const unsigned short &cue_point_index); + void unlit_dicer_button_cue_point(const unsigned short &deck_index, const unsigned short &cue_point_index); + + public slots: + void force_close(); + + private slots: + bool show_config_window(); + void set_fullscreen(); + void show_help(); + void set_focus_search_bar(); + void press_enter_in_search_bar(); + void press_esc_in_search_bar(); + void file_search_string(const QString &text); + bool show_about_window(); + bool show_scan_audio_keys_dialog(); + void reject_refresh_audio_collection_dialog(); + void close_refresh_audio_collection_dialog(); + void accept_refresh_audio_collection_dialog_all_files(); + void accept_refresh_audio_collection_dialog_new_files(); + bool show_error_window(const QString &error_message); + void select_and_run_audio_file_decoding_process(const unsigned short int &deck_index); + void run_audio_file_decoding_process(); + void show_hide_samplers(); + void select_and_run_sample_decoding_process(const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void run_sampler_decoding_process(const unsigned short int &sampler_index); + void run_sampler_decoding_process(const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void run_sampler_decoding_process_on_deck(const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void set_sampler_text(const QString &text, + const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void sampler_button_play_clicked(const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void sampler_button_stop_clicked(const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void sampler_button_del_clicked(const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void set_remaining_time(const unsigned int &remaining_time, + const unsigned short int &deck_index); + void set_sampler_remaining_time(const unsigned int &remaining_time, + const unsigned short int &deck_index, + const unsigned short int &sampler_index); + void set_sampler_state(const unsigned short int &deck_index, + const unsigned short int &sampler_index, + const bool &state); + void jump_to_position(const float &position, + const unsigned short int &deck_index); // 0.0 < Position < 1.0 + void deck_go_to_begin(); + void go_to_begin(const unsigned short int &deck_index); + bool set_cue_point(const unsigned short int &deck_index, + const unsigned short int &cue_point_index); + void go_to_cue_point(const unsigned short int &deck_index, + const unsigned short int &cue_point_index); + bool del_cue_point(const unsigned short int &deck_index, + const unsigned short int &cue_point_index); + void switch_playback_selection(); + void select_playback(const unsigned short int &deck_index); + void hover_playback(const unsigned short int &deck_index); + void unhover_playback(const unsigned short int &deck_index); + void on_file_browser_expand(QModelIndex); + void on_file_browser_double_click(QModelIndex in_model_index); + void sync_file_browser_to_audio_collection(); + void on_finished_analyze_audio_collection(); + void update_refresh_progress_value(const unsigned int &value); + void select_and_show_next_keys(const unsigned short int &deck_index); + void show_next_keys(); + void on_file_browser_header_click(const int &index); + void on_progress_cancel_button_click(); + void run_concurrent_read_collection_from_db(); + void update_speed_label(const float &speed, const unsigned short &deck_index); + void speed_up_down(const float &speed_inc, const unsigned short int &deck_index); + void speed_accel(const float &speed_inc, const unsigned short &deck_index); + void speed_reset_to_100p(const unsigned short int &deck_index); + void playback_thru(const unsigned short int &deck_index, const bool &on_off); + void can_close(); + void show_save_tracklist_dialog(); + void show_clear_tracklist_dialog(); +}; diff --git a/digitalscratch/include/tracks/audio_collection_model.h b/digitalscratch/include/tracks/audio_collection_model.h index 58784fa..8e344ca 100644 --- a/digitalscratch/include/tracks/audio_collection_model.h +++ b/digitalscratch/include/tracks/audio_collection_model.h @@ -1,156 +1,156 @@ -/*============================================================================*/ -/* */ -/* */ -/* Digital Scratch Player */ -/* */ -/* */ -/*-----------------------------------------------( audio_collection_model.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Class defining a data model for audio files */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tracks/playlist.h" - -using namespace std; - -#define COLUMN_FILE_NAME 0 -#define COLUMN_KEY 1 -#define COLUMN_PATH 2 - -class Audio_collection_item -{ - public: - QList childItems; - private: - QList itemData; - Audio_collection_item *parentItem; - QString fullPath; - bool directoryFlag; - QString fileHash; - bool next_key; - bool next_major_key; - - public: - Audio_collection_item(const QList &in_data, - QString in_file_hash = "", - QString in_full_path = "", - bool in_is_directory = false, - Audio_collection_item *in_parent = 0); - ~Audio_collection_item(); - - void append_child(Audio_collection_item *in_item); - Audio_collection_item *get_child(int in_row); - int get_child_count() const; - Audio_collection_item *get_parent(); - - int get_row() const; - int get_column_count() const; - QVariant get_data(int in_column) const; - void set_data(int in_column, QVariant in_data); - QString get_full_path(); - QString get_file_hash(); - - void read_from_db(); - void compute_and_store_to_db(); - - bool is_directory(); - - bool is_a_next_key(); - bool is_a_next_major_key(); - void set_next_key(bool is_a_next_key); - void set_next_major_key(bool is_a_next_major_key); - - private: - void calculate_audio_data(); // Compute music key, bpm, etc... - void store_to_db(); // Persist to DB. -}; - -class Audio_collection_model : public QAbstractItemModel -{ - public: - QSharedPointer> concurrent_watcher_read; - QSharedPointer> concurrent_watcher_store; - - private: - Audio_collection_item *rootItem; - QSharedPointer> concurrent_future; - QPixmap audio_file_icon; - QPixmap directory_icon; - QList audio_item_list; - QString root_path; - - public: - explicit Audio_collection_model(QObject *in_parent = 0); - ~Audio_collection_model(); - - QModelIndex set_root_path(QString in_root_path); - QString get_root_path(); - QModelIndex set_playlist(const Playlist &playlist); - QModelIndex get_root_index(); - - QVariant data(const QModelIndex &in_index, int in_role) const; - Qt::ItemFlags flags(const QModelIndex &in_index) const; - QVariant headerData(int in_section, Qt::Orientation in_orientation, int in_role = Qt::DisplayRole) const; - QModelIndex index(int in_row, int in_column, const QModelIndex &in_parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &in_index) const; - QModelIndex parent_from_item(Audio_collection_item &in_item) const; - int rowCount(const QModelIndex &in_parent = QModelIndex()) const; - int columnCount(const QModelIndex &in_parent = QModelIndex()) const; - void sort(int in_column, Qt::SortOrder in_order); - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &in_indexes) const; - - void concurrent_read_collection_from_db(); // Call Audio_collection_item::read_from_db() on all collection in separate threads. - void stop_concurrent_read_collection_from_db(); // Stop concurrent_read_collection_from_db(). - void concurrent_analyse_audio_collection(); // Call Audio_collection_item::compute_and_store_to_db() on all collection in separate threads. - void stop_concurrent_analyse_audio_collection(); // Stop concurrent_analyse_audio_collection(). - int get_nb_items(); // Get number of files. - int get_nb_new_items(); // Get number of new files (i.e. files with missing data such as music key). - QList set_next_keys(QString in_next_key, // Set flags for previous/next keys (for all items). - QString in_previous_key, - QString in_next_major_key); - - void set_icons(QPixmap in_audio_file_icon, - QPixmap in_directory_icon); - QModelIndexList search(QString in_text); - void clear(); - - private: - void setup_model_data(QString in_path, Audio_collection_item *in_item); - void setup_model_data_from_tracklist(QStringList in_tracklist, Audio_collection_item *in_item); - void create_header(QString in_path, bool in_show_path); -}; +/*============================================================================*/ +/* */ +/* */ +/* Digital Scratch Player */ +/* */ +/* */ +/*-----------------------------------------------( audio_collection_model.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Class defining a data model for audio files */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tracks/playlist.h" + +using namespace std; + +#define COLUMN_FILE_NAME 0 +#define COLUMN_KEY 1 +#define COLUMN_PATH 2 + +class Audio_collection_item +{ + public: + QList childItems; + private: + QList itemData; + Audio_collection_item *parentItem; + QString fullPath; + bool directoryFlag; + QString fileHash; + bool next_key; + bool next_major_key; + + public: + Audio_collection_item(const QList &in_data, + QString in_file_hash = "", + QString in_full_path = "", + bool in_is_directory = false, + Audio_collection_item *in_parent = 0); + ~Audio_collection_item(); + + void append_child(Audio_collection_item *in_item); + Audio_collection_item *get_child(int in_row); + int get_child_count() const; + Audio_collection_item *get_parent(); + + int get_row() const; + int get_column_count() const; + QVariant get_data(int in_column) const; + void set_data(int in_column, QVariant in_data); + QString get_full_path(); + QString get_file_hash(); + + void read_from_db(); + void compute_and_store_to_db(); + + bool is_directory(); + + bool is_a_next_key(); + bool is_a_next_major_key(); + void set_next_key(bool is_a_next_key); + void set_next_major_key(bool is_a_next_major_key); + + private: + void calculate_audio_data(); // Compute music key, bpm, etc... + void store_to_db(); // Persist to DB. +}; + +class Audio_collection_model : public QAbstractItemModel +{ + public: + QSharedPointer> concurrent_watcher_read; + QSharedPointer> concurrent_watcher_store; + + private: + Audio_collection_item *rootItem; + QSharedPointer> concurrent_future; + QPixmap audio_file_icon; + QPixmap directory_icon; + QList audio_item_list; + QString root_path; + + public: + explicit Audio_collection_model(QObject *in_parent = 0); + ~Audio_collection_model(); + + QModelIndex set_root_path(QString in_root_path); + QString get_root_path(); + QModelIndex set_playlist(const Playlist &playlist); + QModelIndex get_root_index(); + + QVariant data(const QModelIndex &in_index, int in_role) const; + Qt::ItemFlags flags(const QModelIndex &in_index) const; + QVariant headerData(int in_section, Qt::Orientation in_orientation, int in_role = Qt::DisplayRole) const; + QModelIndex index(int in_row, int in_column, const QModelIndex &in_parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &in_index) const; + QModelIndex parent_from_item(Audio_collection_item &in_item) const; + int rowCount(const QModelIndex &in_parent = QModelIndex()) const; + int columnCount(const QModelIndex &in_parent = QModelIndex()) const; + void sort(int in_column, Qt::SortOrder in_order); + QStringList mimeTypes() const; + QMimeData *mimeData(const QModelIndexList &in_indexes) const; + + void concurrent_read_collection_from_db(); // Call Audio_collection_item::read_from_db() on all collection in separate threads. + void stop_concurrent_read_collection_from_db(); // Stop concurrent_read_collection_from_db(). + void concurrent_analyse_audio_collection(); // Call Audio_collection_item::compute_and_store_to_db() on all collection in separate threads. + void stop_concurrent_analyse_audio_collection(); // Stop concurrent_analyse_audio_collection(). + int get_nb_items(); // Get number of files. + int get_nb_new_items(); // Get number of new files (i.e. files with missing data such as music key). + QList set_next_keys(QString in_next_key, // Set flags for previous/next keys (for all items). + QString in_previous_key, + QString in_next_major_key); + + void set_icons(QPixmap in_audio_file_icon, + QPixmap in_directory_icon); + QModelIndexList search(QString in_text); + void clear(); + + private: + void setup_model_data(QString in_path, Audio_collection_item *in_item); + void setup_model_data_from_tracklist(QStringList in_tracklist, Audio_collection_item *in_item); + void create_header(QString in_path, bool in_show_path); +}; diff --git a/digitalscratch/include/tracks/playlist.h b/digitalscratch/include/tracks/playlist.h index 0cb1188..7b51123 100644 --- a/digitalscratch/include/tracks/playlist.h +++ b/digitalscratch/include/tracks/playlist.h @@ -1,65 +1,65 @@ -/*============================================================================*/ -/* */ -/* */ -/* Digital Scratch Player */ -/* */ -/* */ -/*-------------------------------------------------------------( playlist.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Class defining a playlist (basically just a list of audio file path) */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include -#include - -#include "app/application_const.h" - -using namespace std; - -class Playlist -{ - private: - QString basepath; - QString name; - QStringList tracklist; - QList tracklist_deck_map; - - public: - Playlist(const QString &basepath, const QString &name); - virtual ~Playlist(); - - public: - QString get_basepath() const; - void set_basepath(const QString &basepath); - QString get_name() const; - void set_name(const QString &name); - QString get_fullpath() const; - QStringList get_tracklist() const; - void add_track_no_duplicate(const QString &filename); - void add_track_from_deck(const QString &filename, const unsigned short int &deck_index); - void clear(); -}; +/*============================================================================*/ +/* */ +/* */ +/* Digital Scratch Player */ +/* */ +/* */ +/*-------------------------------------------------------------( playlist.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Class defining a playlist (basically just a list of audio file path) */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include +#include + +#include "app/application_const.h" + +using namespace std; + +class Playlist +{ + private: + QString basepath; + QString name; + QStringList tracklist; + QList tracklist_deck_map; + + public: + Playlist(const QString &basepath, const QString &name); + virtual ~Playlist(); + + public: + QString get_basepath() const; + void set_basepath(const QString &basepath); + QString get_name() const; + void set_name(const QString &name); + QString get_fullpath() const; + QStringList get_tracklist() const; + void add_track_no_duplicate(const QString &filename); + void add_track_from_deck(const QString &filename, const unsigned short int &deck_index); + void clear(); +}; diff --git a/libdigitalscratch/src/include/coded_vinyl.h b/libdigitalscratch/src/include/coded_vinyl.h index 6797406..44ba727 100644 --- a/libdigitalscratch/src/include/coded_vinyl.h +++ b/libdigitalscratch/src/include/coded_vinyl.h @@ -1,83 +1,83 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch: the Digital Scratch engine. */ -/* */ -/* */ -/*----------------------------------------------------------( coded_vinyl.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Coded_vynil class : define a coded vinyl disk */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include - -#include "dscratch_parameters.h" -#include "digital_scratch_api.h" -#include "iir_filter.h" -#include "inst_freq_extrator.h" - -#define DEFAULT_RPM RPM_33 - -/** - * Define a Coded_vinyl class.\n - * A coded vinyl is the definition of a vinyl disc with a timecoded signal. - * @author Julien Rosener - */ -class Coded_vinyl -{ - protected: - float min_amplitude; - - private: - unsigned int sample_rate; - dscratch_vinyl_rpm_t rpm; - - // Frequency and amplitude analysis. - IIR_filter speed_IIR; - Inst_freq_extractor freq_inst; - double filtered_freq_inst; - - public: - Coded_vinyl(unsigned int sample_rate); - virtual ~Coded_vinyl(); - - public: - void run_recording_data_analysis(const QVector &input_samples_1, - const QVector &input_samples_2); - - bool set_sample_rate(unsigned int sample_rate); - unsigned int get_sample_rate(); - - bool set_rpm(dscratch_vinyl_rpm_t rpm); - dscratch_vinyl_rpm_t get_rpm(); - - virtual float get_speed() = 0; - virtual float get_volume() = 0; - - protected: - float get_signal_freq(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch: the Digital Scratch engine. */ +/* */ +/* */ +/*----------------------------------------------------------( coded_vinyl.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Coded_vynil class : define a coded vinyl disk */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include + +#include "dscratch_parameters.h" +#include "digital_scratch_api.h" +#include "iir_filter.h" +#include "inst_freq_extrator.h" + +#define DEFAULT_RPM RPM_33 + +/** + * Define a Coded_vinyl class.\n + * A coded vinyl is the definition of a vinyl disc with a timecoded signal. + * @author Julien Rosener + */ +class Coded_vinyl +{ + protected: + float min_amplitude; + + private: + unsigned int sample_rate; + dscratch_vinyl_rpm_t rpm; + + // Frequency and amplitude analysis. + IIR_filter speed_IIR; + Inst_freq_extractor freq_inst; + double filtered_freq_inst; + + public: + Coded_vinyl(unsigned int sample_rate); + virtual ~Coded_vinyl(); + + public: + void run_recording_data_analysis(const QVector &input_samples_1, + const QVector &input_samples_2); + + bool set_sample_rate(unsigned int sample_rate); + unsigned int get_sample_rate(); + + bool set_rpm(dscratch_vinyl_rpm_t rpm); + dscratch_vinyl_rpm_t get_rpm(); + + virtual float get_speed() = 0; + virtual float get_volume() = 0; + + protected: + float get_signal_freq(); +}; diff --git a/libdigitalscratch/src/include/digital_scratch.h b/libdigitalscratch/src/include/digital_scratch.h index 068eebd..b76765d 100644 --- a/libdigitalscratch/src/include/digital_scratch.h +++ b/libdigitalscratch/src/include/digital_scratch.h @@ -1,106 +1,106 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch: the Digital Scratch engine. */ -/* */ -/* */ -/*------------------------------------------------------( digital_scratch.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Digital_scratch class : define a Digital_scratch controller */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include - -#include "dscratch_parameters.h" -#include "controller.h" -#include "coded_vinyl.h" -#include "final_scratch_vinyl.h" -#include "serato_vinyl.h" -#include "mixvibes_vinyl.h" - -// Speed states -#define UNSTABLE_SPEED 0 -#define STABLE_SPEED 1 -#define SLOW_SPEED 2 - -// Default values -#define DEFAULT_MAX_SPEED_DIFF 0.05f -#define DEFAULT_MAX_SLOW_SPEED 0.5f -#define DEFAULT_MAX_NB_BUFFER 5 -#define DEFAULT_MAX_NB_SPEED_FOR_STABILITY 3 - -/** - * Define a Digital_scratch class.\n - * Base class : Controller\n - * It implement a Controller class. - * @author Julien Rosener - */ -class Digital_scratch : public Controller // FIXME: rename in Vinyl_controller (and remove Controller) ? -{ - /* Attributes */ - private: - Coded_vinyl *vinyl; - unsigned int sample_rate; - - /* Constructor / Destructor */ - public: - /** - * @param timecoded_vinyl is the Coded_vinyl object used with - * Digital_scratch (e.g. Final_scratch_vinyl) - * @param sample rate is the rate of the timecoded input signal. - */ - Digital_scratch(dscratch_vinyls_t coded_vinyl_type, - unsigned int sample_rate); - - virtual ~Digital_scratch(); - - - /* Methods */ - public: - /** - * Analyze recording datas and update playing parameters.\n - * Define the pure virtual method in base class (Controller). - * @param input_samples_1 are the samples of channel 1. - * @param input_samples_2 are the samples of channel 2. - * @return TRUE if all is OK, otherwise FALSE. - * - * @note input_samples_1 and input_samples_2 must have the same number - * of elements. - */ - bool analyze_captured_timecoded_signal(const QVector &input_samples_1, - const QVector &input_samples_2); - - Coded_vinyl* get_coded_vinyl(); - bool change_coded_vinyl(dscratch_vinyls_t coded_vinyl_type); - - float get_speed(); - float get_volume(); - - private: - bool init(dscratch_vinyls_t coded_vinyl_type); - void clean(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch: the Digital Scratch engine. */ +/* */ +/* */ +/*------------------------------------------------------( digital_scratch.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Digital_scratch class : define a Digital_scratch controller */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include + +#include "dscratch_parameters.h" +#include "controller.h" +#include "coded_vinyl.h" +#include "final_scratch_vinyl.h" +#include "serato_vinyl.h" +#include "mixvibes_vinyl.h" + +// Speed states +#define UNSTABLE_SPEED 0 +#define STABLE_SPEED 1 +#define SLOW_SPEED 2 + +// Default values +#define DEFAULT_MAX_SPEED_DIFF 0.05f +#define DEFAULT_MAX_SLOW_SPEED 0.5f +#define DEFAULT_MAX_NB_BUFFER 5 +#define DEFAULT_MAX_NB_SPEED_FOR_STABILITY 3 + +/** + * Define a Digital_scratch class.\n + * Base class : Controller\n + * It implement a Controller class. + * @author Julien Rosener + */ +class Digital_scratch : public Controller // FIXME: rename in Vinyl_controller (and remove Controller) ? +{ + /* Attributes */ + private: + Coded_vinyl *vinyl; + unsigned int sample_rate; + + /* Constructor / Destructor */ + public: + /** + * @param timecoded_vinyl is the Coded_vinyl object used with + * Digital_scratch (e.g. Final_scratch_vinyl) + * @param sample rate is the rate of the timecoded input signal. + */ + Digital_scratch(dscratch_vinyls_t coded_vinyl_type, + unsigned int sample_rate); + + virtual ~Digital_scratch(); + + + /* Methods */ + public: + /** + * Analyze recording datas and update playing parameters.\n + * Define the pure virtual method in base class (Controller). + * @param input_samples_1 are the samples of channel 1. + * @param input_samples_2 are the samples of channel 2. + * @return TRUE if all is OK, otherwise FALSE. + * + * @note input_samples_1 and input_samples_2 must have the same number + * of elements. + */ + bool analyze_captured_timecoded_signal(const QVector &input_samples_1, + const QVector &input_samples_2); + + Coded_vinyl* get_coded_vinyl(); + bool change_coded_vinyl(dscratch_vinyls_t coded_vinyl_type); + + float get_speed(); + float get_volume(); + + private: + bool init(dscratch_vinyls_t coded_vinyl_type); + void clean(); +}; diff --git a/libdigitalscratch/src/include/digital_scratch_api.h b/libdigitalscratch/src/include/digital_scratch_api.h index 69f859d..127d18d 100644 --- a/libdigitalscratch/src/include/digital_scratch_api.h +++ b/libdigitalscratch/src/include/digital_scratch_api.h @@ -1,232 +1,232 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch: the Digital Scratch engine. */ -/* */ -/* */ -/*--------------------------------------------------( digital_scratch_api.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* API header file for the Digital Scratch lib */ -/* */ -/*============================================================================*/ - -#pragma once - -#ifdef WIN32 - #ifdef DLLIMPORT - #undef DLLIMPORT - #endif - #define DLLIMPORT __declspec (dllexport) -#else - #define DLLIMPORT -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// Error codes. -enum dscratch_status_t -{ - DSCRATCH_SUCCESS = 0, - DSCRATCH_ERROR -}; - -// Supported timecoded vinyl. -enum dscratch_vinyls_t -{ - FINAL_SCRATCH = 0, - SERATO, - MIXVIBES, - NB_DSCRATCH_VINYLS -}; - -// Supported turntable speed. -enum dscratch_vinyl_rpm_t -{ - RPM_33 = 33, - RPM_45 = 45 -}; - -// Handle used by API functions to identify the turntable. -typedef void* dscratch_handle_t; - -/** - * Create a new turntable. - * - * @param coded_vinyl_type is the type of timecoded vinyl you want to use (e.g. FINAL_SCRATCH_VINYL, see above). - * @param sample rate is the rate of the recorded input signal. - * @param out_handle is used to identify the turntable (allocated and returned by this function). - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_create_turntable(dscratch_vinyls_t coded_vinyl_type, - const unsigned int sample_rate, - dscratch_handle_t *out_handle); - -/** - * Delete the turntable created by dscratch_create_turntable() (free the handle). - * - * @param handle is used to identify the turntable. - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_delete_turntable(dscratch_handle_t handle); - -/** - * Analyze the recorded samples (coming from a timecoded vinyl). After this call, you can - * call dscratch_get_playing_parameters() to retrieve the speed, volume,... - * - * @param handle is used to identify the turntable. - * @param left_samples is a table containing samples from the left channel. - * @param right_samples is a table containing samples from the right channel. - * @param samples_table_size is the size (number of elements) of left_samples or right_samples. - * - * @return DSCRATCH_SUCCESS if all is OK. - * - * @note Warning: left_samples and right_samples must have the same number - * of elements (nb_frames elements). - */ -DLLIMPORT dscratch_status_t dscratch_process_captured_timecoded_signal(dscratch_handle_t handle, - const float *left_samples, - const float *right_samples, - int samples_table_size); - -/** - * Returns the calculated speed of the vinyl on turntable - * (only relevant if dscratch_process_captured_timecoded_signal() was called). - * - * @param handle is used to identify the turntable. - * @param speed will be returned, this is the speed of the vinyl disc. - * 1.0 should be mapped to 0.0% of your real turntable. - * If the speed is a negative value, it means that vinyl is playing - * backward. - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_get_speed(dscratch_handle_t handle, - float *speed); - -/** - * Returns the volume of the signal captured from vinyl on turntable - * (only relevant if dscratch_process_captured_timecoded_signal() was called). - * - * @param handle is used to identify the turntable. - * @param volume will be returned, this is the amplitude of the signal given - * to dscratch_process_captured_timecoded_signal() - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_get_volume(dscratch_handle_t handle, - float *volume); - -/** - * Get DigitalScratch version. - * - * @return a const string containing the version number. - * - */ -DLLIMPORT const char *dscratch_get_version(); - -/** - * Display on stdout informations about specified turntable. - * - * @param handle is used to identify the turntable. - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_display_turntable(dscratch_handle_t handle); - -/** - * Get vinyl type used for specified turntable. - * - * @param handle is used to identify the turntable. - * @param vinyl_type is the vinyl type. - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_get_turntable_vinyl_type(dscratch_handle_t handle, - dscratch_vinyls_t *vinyl_type); - -/** - * Transform a vinyl type into an explicit string name. - * - * @param vinyl_type is the vinyl type. - * - * @return A full string name corresponding to the type. - */ -DLLIMPORT const char* dscratch_get_vinyl_name_from_type(dscratch_vinyls_t vinyl_type); - -/** - * Get the default vinyl type. - * - * @return the default vinyl type (=> Serato vinyl). - */ -DLLIMPORT dscratch_vinyls_t dscratch_get_default_vinyl_type(); - - -/** - * Change vinyl type without deleting and recreating engine. - * - * @param handle is used to identify the turntable. - * @param vinyl_type is the type of vinyl (@see dscratch_vinyls_t). - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_change_vinyl_type(dscratch_handle_t handle, - dscratch_vinyls_t vinyl_type); - -/** - * Set the number of RPM used to play the timecoded vinyl on the turntable. - * - * @param handle is used to identify the turntable. - * @param rpm is the number of RPM of the turntable (45 or 33). - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_set_rpm(dscratch_handle_t handle, - dscratch_vinyl_rpm_t rpm); - -/** - * Get the turntable RPM value. - * - * @param handle is used to identify the turntable. - * @param out_rpm is the number of RPM of the turntable (45 or 33) - * (returned by this function).. - * - * @return DSCRATCH_SUCCESS if all is OK. - */ -DLLIMPORT dscratch_status_t dscratch_get_rpm(dscratch_handle_t handle, - dscratch_vinyl_rpm_t *out_rpm); - -/** - * Get the default number of RPM. - * - * @return the default number of rpm (=> 33). - */ -DLLIMPORT dscratch_vinyl_rpm_t dscratch_get_default_rpm(); - -#ifdef __cplusplus -} -#endif - +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch: the Digital Scratch engine. */ +/* */ +/* */ +/*--------------------------------------------------( digital_scratch_api.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* API header file for the Digital Scratch lib */ +/* */ +/*============================================================================*/ + +#pragma once + +#ifdef WIN32 + #ifdef DLLIMPORT + #undef DLLIMPORT + #endif + #define DLLIMPORT __declspec (dllexport) +#else + #define DLLIMPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Error codes. +enum dscratch_status_t +{ + DSCRATCH_SUCCESS = 0, + DSCRATCH_ERROR +}; + +// Supported timecoded vinyl. +enum dscratch_vinyls_t +{ + FINAL_SCRATCH = 0, + SERATO, + MIXVIBES, + NB_DSCRATCH_VINYLS +}; + +// Supported turntable speed. +enum dscratch_vinyl_rpm_t +{ + RPM_33 = 33, + RPM_45 = 45 +}; + +// Handle used by API functions to identify the turntable. +typedef void* dscratch_handle_t; + +/** + * Create a new turntable. + * + * @param coded_vinyl_type is the type of timecoded vinyl you want to use (e.g. FINAL_SCRATCH_VINYL, see above). + * @param sample rate is the rate of the recorded input signal. + * @param out_handle is used to identify the turntable (allocated and returned by this function). + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_create_turntable(dscratch_vinyls_t coded_vinyl_type, + const unsigned int sample_rate, + dscratch_handle_t *out_handle); + +/** + * Delete the turntable created by dscratch_create_turntable() (free the handle). + * + * @param handle is used to identify the turntable. + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_delete_turntable(dscratch_handle_t handle); + +/** + * Analyze the recorded samples (coming from a timecoded vinyl). After this call, you can + * call dscratch_get_playing_parameters() to retrieve the speed, volume,... + * + * @param handle is used to identify the turntable. + * @param left_samples is a table containing samples from the left channel. + * @param right_samples is a table containing samples from the right channel. + * @param samples_table_size is the size (number of elements) of left_samples or right_samples. + * + * @return DSCRATCH_SUCCESS if all is OK. + * + * @note Warning: left_samples and right_samples must have the same number + * of elements (nb_frames elements). + */ +DLLIMPORT dscratch_status_t dscratch_process_captured_timecoded_signal(dscratch_handle_t handle, + const float *left_samples, + const float *right_samples, + int samples_table_size); + +/** + * Returns the calculated speed of the vinyl on turntable + * (only relevant if dscratch_process_captured_timecoded_signal() was called). + * + * @param handle is used to identify the turntable. + * @param speed will be returned, this is the speed of the vinyl disc. + * 1.0 should be mapped to 0.0% of your real turntable. + * If the speed is a negative value, it means that vinyl is playing + * backward. + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_get_speed(dscratch_handle_t handle, + float *speed); + +/** + * Returns the volume of the signal captured from vinyl on turntable + * (only relevant if dscratch_process_captured_timecoded_signal() was called). + * + * @param handle is used to identify the turntable. + * @param volume will be returned, this is the amplitude of the signal given + * to dscratch_process_captured_timecoded_signal() + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_get_volume(dscratch_handle_t handle, + float *volume); + +/** + * Get DigitalScratch version. + * + * @return a const string containing the version number. + * + */ +DLLIMPORT const char *dscratch_get_version(); + +/** + * Display on stdout informations about specified turntable. + * + * @param handle is used to identify the turntable. + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_display_turntable(dscratch_handle_t handle); + +/** + * Get vinyl type used for specified turntable. + * + * @param handle is used to identify the turntable. + * @param vinyl_type is the vinyl type. + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_get_turntable_vinyl_type(dscratch_handle_t handle, + dscratch_vinyls_t *vinyl_type); + +/** + * Transform a vinyl type into an explicit string name. + * + * @param vinyl_type is the vinyl type. + * + * @return A full string name corresponding to the type. + */ +DLLIMPORT const char* dscratch_get_vinyl_name_from_type(dscratch_vinyls_t vinyl_type); + +/** + * Get the default vinyl type. + * + * @return the default vinyl type (=> Serato vinyl). + */ +DLLIMPORT dscratch_vinyls_t dscratch_get_default_vinyl_type(); + + +/** + * Change vinyl type without deleting and recreating engine. + * + * @param handle is used to identify the turntable. + * @param vinyl_type is the type of vinyl (@see dscratch_vinyls_t). + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_change_vinyl_type(dscratch_handle_t handle, + dscratch_vinyls_t vinyl_type); + +/** + * Set the number of RPM used to play the timecoded vinyl on the turntable. + * + * @param handle is used to identify the turntable. + * @param rpm is the number of RPM of the turntable (45 or 33). + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_set_rpm(dscratch_handle_t handle, + dscratch_vinyl_rpm_t rpm); + +/** + * Get the turntable RPM value. + * + * @param handle is used to identify the turntable. + * @param out_rpm is the number of RPM of the turntable (45 or 33) + * (returned by this function).. + * + * @return DSCRATCH_SUCCESS if all is OK. + */ +DLLIMPORT dscratch_status_t dscratch_get_rpm(dscratch_handle_t handle, + dscratch_vinyl_rpm_t *out_rpm); + +/** + * Get the default number of RPM. + * + * @return the default number of rpm (=> 33). + */ +DLLIMPORT dscratch_vinyl_rpm_t dscratch_get_default_rpm(); + +#ifdef __cplusplus +} +#endif + diff --git a/libdigitalscratch/src/include/final_scratch_vinyl.h b/libdigitalscratch/src/include/final_scratch_vinyl.h index f51f904..5b26e17 100644 --- a/libdigitalscratch/src/include/final_scratch_vinyl.h +++ b/libdigitalscratch/src/include/final_scratch_vinyl.h @@ -1,61 +1,61 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch: the Digital Scratch engine. */ -/* */ -/* */ -/*--------------------------------------------------( final_scratch_vinyl.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Final_scratch_vinyl class : define a Stanton Final Scratch timecode vinyl */ -/* */ -/*============================================================================*/ - -#pragma once - -#include - -#include "dscratch_parameters.h" -#include "coded_vinyl.h" -#include "digital_scratch_api.h" - -// Stanton Final Scratch vinyl sinusoidal frequency (Hz) (@33 rpm) -#define FINAL_SCRATCH_SINUSOIDAL_FREQ 1200.0f - -// Stanton Final Scratch vinyl sinusoidal frequency (Hz) (@45 rpm). -// Same value than 33rpm because there is a specific vinyl side for 45 rpm. -#define FINAL_SCRATCH_SINUSOIDAL_FREQ_45RPM 1200.0f - -/** - * Define a Stanton Final Scratch timecode vinyl class.\n - * @author Julien Rosener - */ -class Final_scratch_vinyl : public Coded_vinyl -{ - public: - Final_scratch_vinyl(unsigned int sample_rate); - virtual ~Final_scratch_vinyl(); - - public: - float get_speed(); - float get_volume(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch: the Digital Scratch engine. */ +/* */ +/* */ +/*--------------------------------------------------( final_scratch_vinyl.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Final_scratch_vinyl class : define a Stanton Final Scratch timecode vinyl */ +/* */ +/*============================================================================*/ + +#pragma once + +#include + +#include "dscratch_parameters.h" +#include "coded_vinyl.h" +#include "digital_scratch_api.h" + +// Stanton Final Scratch vinyl sinusoidal frequency (Hz) (@33 rpm) +#define FINAL_SCRATCH_SINUSOIDAL_FREQ 1200.0f + +// Stanton Final Scratch vinyl sinusoidal frequency (Hz) (@45 rpm). +// Same value than 33rpm because there is a specific vinyl side for 45 rpm. +#define FINAL_SCRATCH_SINUSOIDAL_FREQ_45RPM 1200.0f + +/** + * Define a Stanton Final Scratch timecode vinyl class.\n + * @author Julien Rosener + */ +class Final_scratch_vinyl : public Coded_vinyl +{ + public: + Final_scratch_vinyl(unsigned int sample_rate); + virtual ~Final_scratch_vinyl(); + + public: + float get_speed(); + float get_volume(); +}; diff --git a/libdigitalscratch/src/include/mixvibes_vinyl.h b/libdigitalscratch/src/include/mixvibes_vinyl.h index e92002c..1ebd114 100644 --- a/libdigitalscratch/src/include/mixvibes_vinyl.h +++ b/libdigitalscratch/src/include/mixvibes_vinyl.h @@ -1,59 +1,59 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch: the Digital Scratch engine. */ -/* */ -/* */ -/*-------------------------------------------------------( mixvibes_vinyl.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Mixvibes_vinyl class : define a Mixvibes DVS timecode vinyl */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include "dscratch_parameters.h" -#include "coded_vinyl.h" -#include "digital_scratch_api.h" - -// Mixvibes vinyl sinusoidal frequency (Hz) (@33 rpm) -#define MIXVIBES_SINUSOIDAL_FREQ 1300.0f - -// Mixvibes vinyl sinusoidal frequency (Hz) (@45 rpm) -#define MIXVIBES_SINUSOIDAL_FREQ_45RPM 1755.0f - -/** - * Define a Mixvibes DVS timecode vinyl class.\n - * @author Julien Rosener - */ -class Mixvibes_vinyl : public Coded_vinyl -{ - public: - Mixvibes_vinyl(unsigned int sample_rate); - virtual ~Mixvibes_vinyl(); - - public: - float get_speed(); - float get_volume(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch: the Digital Scratch engine. */ +/* */ +/* */ +/*-------------------------------------------------------( mixvibes_vinyl.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Mixvibes_vinyl class : define a Mixvibes DVS timecode vinyl */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include "dscratch_parameters.h" +#include "coded_vinyl.h" +#include "digital_scratch_api.h" + +// Mixvibes vinyl sinusoidal frequency (Hz) (@33 rpm) +#define MIXVIBES_SINUSOIDAL_FREQ 1300.0f + +// Mixvibes vinyl sinusoidal frequency (Hz) (@45 rpm) +#define MIXVIBES_SINUSOIDAL_FREQ_45RPM 1755.0f + +/** + * Define a Mixvibes DVS timecode vinyl class.\n + * @author Julien Rosener + */ +class Mixvibes_vinyl : public Coded_vinyl +{ + public: + Mixvibes_vinyl(unsigned int sample_rate); + virtual ~Mixvibes_vinyl(); + + public: + float get_speed(); + float get_volume(); +}; diff --git a/libdigitalscratch/src/include/serato_vinyl.h b/libdigitalscratch/src/include/serato_vinyl.h index 59accc5..cbe32e2 100644 --- a/libdigitalscratch/src/include/serato_vinyl.h +++ b/libdigitalscratch/src/include/serato_vinyl.h @@ -1,59 +1,59 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch: the Digital Scratch engine. */ -/* */ -/* */ -/*---------------------------------------------------------( serato_vinyl.h )-*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*------------------------------------------------------------( Description )-*/ -/* */ -/* Final_scratch_vinyl class : define a Serato Scratch Live timecode vinyl */ -/* */ -/*============================================================================*/ - -#pragma once - -#include -#include "dscratch_parameters.h" -#include "coded_vinyl.h" -#include "digital_scratch_api.h" - -// Serato vinyl sinusoidal frequency (Hz) (@33 rpm) -#define SERATO_VINYL_SINUSOIDAL_FREQ 996.0f - -// Serato vinyl sinusoidal frequency (Hz) (@45 rpm) -#define SERATO_VINYL_SINUSOIDAL_FREQ_45RPM 1350.0f - -/** - * Define a Serato Scratch Live timecode vinyl class.\n - * @author Julien Rosener - */ -class Serato_vinyl : public Coded_vinyl -{ - public: - Serato_vinyl(unsigned int sample_rate); - virtual ~Serato_vinyl(); - - public: - float get_speed(); - float get_volume(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch: the Digital Scratch engine. */ +/* */ +/* */ +/*---------------------------------------------------------( serato_vinyl.h )-*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*------------------------------------------------------------( Description )-*/ +/* */ +/* Final_scratch_vinyl class : define a Serato Scratch Live timecode vinyl */ +/* */ +/*============================================================================*/ + +#pragma once + +#include +#include "dscratch_parameters.h" +#include "coded_vinyl.h" +#include "digital_scratch_api.h" + +// Serato vinyl sinusoidal frequency (Hz) (@33 rpm) +#define SERATO_VINYL_SINUSOIDAL_FREQ 996.0f + +// Serato vinyl sinusoidal frequency (Hz) (@45 rpm) +#define SERATO_VINYL_SINUSOIDAL_FREQ_45RPM 1350.0f + +/** + * Define a Serato Scratch Live timecode vinyl class.\n + * @author Julien Rosener + */ +class Serato_vinyl : public Coded_vinyl +{ + public: + Serato_vinyl(unsigned int sample_rate); + virtual ~Serato_vinyl(); + + public: + float get_speed(); + float get_volume(); +}; diff --git a/libdigitalscratch/test/digital_scratch_api_test.h b/libdigitalscratch/test/digital_scratch_api_test.h index 861b250..10db5fb 100644 --- a/libdigitalscratch/test/digital_scratch_api_test.h +++ b/libdigitalscratch/test/digital_scratch_api_test.h @@ -1,55 +1,55 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch tests */ -/* */ -/* */ -/*----------------------------------------------------------------------------*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*============================================================================*/ - -#include -#include -#include -#include - -using namespace std; - -class DigitalScratchApi_Test : public QObject -{ - Q_OBJECT - -private: - void l_dscratch_analyze_timecode(dscratch_vinyls_t vinyl_type, const char *txt_timecode_file); - -public: - DigitalScratchApi_Test(); - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - - void testCase_dscratch_create_turntable(); - void testCase_dscratch_analyze_timecode_serato_stop_fast(); - void testCase_dscratch_analyze_timecode_serato_noises(); - void testCase_dscratch_display_turntable(); - void testCase_dscratch_get_vinyl_type(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch tests */ +/* */ +/* */ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*============================================================================*/ + +#include +#include +#include +#include + +using namespace std; + +class DigitalScratchApi_Test : public QObject +{ + Q_OBJECT + +private: + void l_dscratch_analyze_timecode(dscratch_vinyls_t vinyl_type, const char *txt_timecode_file); + +public: + DigitalScratchApi_Test(); + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + + void testCase_dscratch_create_turntable(); + void testCase_dscratch_analyze_timecode_serato_stop_fast(); + void testCase_dscratch_analyze_timecode_serato_noises(); + void testCase_dscratch_display_turntable(); + void testCase_dscratch_get_vinyl_type(); +}; diff --git a/libdigitalscratch/test/digital_scratch_test.h b/libdigitalscratch/test/digital_scratch_test.h index 928f452..5498d89 100644 --- a/libdigitalscratch/test/digital_scratch_test.h +++ b/libdigitalscratch/test/digital_scratch_test.h @@ -1,46 +1,46 @@ -/*============================================================================*/ -/* */ -/* */ -/* libdigitalscratch tests */ -/* */ -/* */ -/*----------------------------------------------------------------------------*/ -/* */ -/* Copyright (C) 2003-2017 */ -/* Julien Rosener */ -/* */ -/*----------------------------------------------------------------( License )-*/ -/* */ -/* This program is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ -/* */ -/* This package is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ -/* */ -/*============================================================================*/ - -#include -#include -#include -using namespace std; - -class DigitalScratch_Test : public QObject -{ - Q_OBJECT - -public: - DigitalScratch_Test(); - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - - void testCase_analyze_recording_data(); -}; +/*============================================================================*/ +/* */ +/* */ +/* libdigitalscratch tests */ +/* */ +/* */ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (C) 2003-2017 */ +/* Julien Rosener */ +/* */ +/*----------------------------------------------------------------( License )-*/ +/* */ +/* This program is free software: you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This package is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program. If not, see . */ +/* */ +/*============================================================================*/ + +#include +#include +#include +using namespace std; + +class DigitalScratch_Test : public QObject +{ + Q_OBJECT + +public: + DigitalScratch_Test(); + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + + void testCase_analyze_recording_data(); +};