From 5a3665a4cc1bc7ccfd323e2127380adc64e6c255 Mon Sep 17 00:00:00 2001 From: Jonas Zeunert Date: Fri, 23 Nov 2018 15:57:15 +0100 Subject: [PATCH] updated sound json --- .../contrib/json_example/Output_Config.json | 4 +- .../json_example/output_item_config.json | 149 +++++++++++++++++- FlippR-Driver/src/output/items/Sound.cpp | 4 +- FlippR-Driver/src/output/items/Sound.h | 7 +- 4 files changed, 155 insertions(+), 9 deletions(-) diff --git a/FlippR-Driver/contrib/json_example/Output_Config.json b/FlippR-Driver/contrib/json_example/Output_Config.json index 05e626b..c205b56 100644 --- a/FlippR-Driver/contrib/json_example/Output_Config.json +++ b/FlippR-Driver/contrib/json_example/Output_Config.json @@ -18,10 +18,10 @@ "latch-select" : { "mux1" : 8, - "mux2" : 9 + "mux2" : 9, "A" : 5, "B" : 6, - "C" : 7, + "C" : 7 } }, diff --git a/FlippR-Driver/contrib/json_example/output_item_config.json b/FlippR-Driver/contrib/json_example/output_item_config.json index 5a37776..d83f5c4 100644 --- a/FlippR-Driver/contrib/json_example/output_item_config.json +++ b/FlippR-Driver/contrib/json_example/output_item_config.json @@ -1,8 +1,153 @@ { "sounds" : - { + [ + { + "id:": 0, + "address" : "22", + "description" : "Sound 1" + }, + { + "id:": 1, + "address" : "23", + "description" : "Sound 2" + }, + { + "id:": 2, + "address" : "24", + "description" : "Sound 3" + }, + { + "id:": 3, + "address" : "25", + "description" : "Sound 4" + }, + { + "id:": 4, + "address" : "26", + "description" : "Sound 5" + }, + { + "id:": 5, + "address" : "27", + "description" : "Sound 6" + }, + { + "id:": 6, + "address" : "28", + "description" : "Sound 7" + }, + { + "id:": 7, + "address" : "29", + "description" : "Sound 8" + }, + { + "id:": 8, + "address" : "30", + "description" : "Sound 9" + }, + { + "id:": 9, + "address" : "31", + "description" : "Sound 10" + }, + { + "id:": 10, + "address" : "32", + "description" : "Sound 11" + }, + { + "id:": 11, + "address" : "33", + "description" : "Sound 12" + }, + { + "id:": 12, + "address" : "34", + "description" : "Sound 13" + }, + { + "id:": 13, + "address" : "35", + "description" : "Sound 14" + }, + { + "id:": 14, + "address" : "36", + "description" : "Sound 15" + }, + { + "id:": 15, + "address" : "37", + "description" : "Sound 16" + }, + { + "id:": 16, + "address" : "38", + "description" : "Sound 17" + }, + { + "id:": 17, + "address" : "39", + "description" : "Sound 18" + }, + { + "id:": 18, + "address" : "40", + "description" : "Sound 19" + }, + { + "id:": 19, + "address" : "41", + "description" : "Sound 20" + }, + { + "id:": 20, + "address" : "42", + "description" : "Sound 21" + }, + { + "id:": 21, + "address" : "43", + "description" : "Sound 22" + }, + { + "id:": 22, + "address" : "44", + "description" : "Sound 23" + }, + { + "id:": 23, + "address" : "45", + "description" : "Sound 24" + }, + { + "id:": 24, + "address" : "46", + "description" : "Sound 25" + }, + { + "id:": 25, + "address" : "47", + "description" : "Sound 26" + }, + { + "id:": 26, + "address" : "48", + "description" : "Sound 27" + }, + { + "id:": 27, + "address" : "49", + "description" : "Sound 28" + }, + { + "id:": 28, + "address" : "50", + "description" : "Speech 1: \"You're good! But I'm still the Champ!\"" + }, - }, + ], "lamps" : { diff --git a/FlippR-Driver/src/output/items/Sound.cpp b/FlippR-Driver/src/output/items/Sound.cpp index 9cd36ef..02ff295 100644 --- a/FlippR-Driver/src/output/items/Sound.cpp +++ b/FlippR-Driver/src/output/items/Sound.cpp @@ -16,8 +16,8 @@ namespace output namespace items { -Sound::Sound(std::shared_ptr output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name, std::chrono::milliseconds deactivation_time) : - Item(output_gpio_interface, address, i2c_address, data_pin, name), +Sound::Sound(std::shared_ptr output_gpio_interface, u_int8_t address, std::string name, std::chrono::milliseconds deactivation_time) : + Item(output_gpio_interface, address, name), deactivation_time(deactivation_time) {} diff --git a/FlippR-Driver/src/output/items/Sound.h b/FlippR-Driver/src/output/items/Sound.h index 598d32c..7884c33 100644 --- a/FlippR-Driver/src/output/items/Sound.h +++ b/FlippR-Driver/src/output/items/Sound.h @@ -27,7 +27,10 @@ namespace items class Sound : public ISound, Item { public: - Sound(std::shared_ptr output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name, std::chrono::milliseconds deactivation_time); + u_int id; + +public: + Sound(std::shared_ptr output_gpio_interface, u_int8_t address, std::string name, std::chrono::milliseconds deactivation_time); virtual ~Sound() = default; virtual void play(); @@ -35,8 +38,6 @@ public: private: std::chrono::milliseconds deactivation_time; - std::future play_task; - private: virtual void playTask(); };