-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
3,429 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# CMakeList.txt: plik projektu CMake najwyższego poziomu, wykonaj konfigurację globalną | ||
# i uwzględnij podprojekty w tym miejscu. | ||
# | ||
cmake_minimum_required (VERSION 3.8) | ||
|
||
# Enable Hot Reload for MSVC compilers if supported. | ||
if (POLICY CMP0141) | ||
cmake_policy(SET CMP0141 NEW) | ||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>") | ||
endif() | ||
|
||
project ("beep_engine") | ||
|
||
# Uwzględnij podprojekty. | ||
add_subdirectory ("beep_engine") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"version": 3, | ||
"configurePresets": [ | ||
{ | ||
"name": "windows-base", | ||
"hidden": true, | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/out/build/${presetName}", | ||
"installDir": "${sourceDir}/out/install/${presetName}", | ||
"cacheVariables": { | ||
"CMAKE_C_COMPILER": "cl.exe", | ||
"CMAKE_CXX_COMPILER": "cl.exe" | ||
}, | ||
"condition": { | ||
"type": "equals", | ||
"lhs": "${hostSystemName}", | ||
"rhs": "Windows" | ||
} | ||
}, | ||
{ | ||
"name": "x64-debug", | ||
"displayName": "x64 Debug", | ||
"inherits": "windows-base", | ||
"architecture": { | ||
"value": "x64", | ||
"strategy": "external" | ||
}, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
} | ||
}, | ||
{ | ||
"name": "x64-release", | ||
"displayName": "x64 Release", | ||
"inherits": "x64-debug", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release" | ||
} | ||
}, | ||
{ | ||
"name": "x86-debug", | ||
"displayName": "x86 Debug", | ||
"inherits": "windows-base", | ||
"architecture": { | ||
"value": "x86", | ||
"strategy": "external" | ||
}, | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
} | ||
}, | ||
{ | ||
"name": "x86-release", | ||
"displayName": "x86 Release", | ||
"inherits": "x86-debug", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Release" | ||
} | ||
}, | ||
{ | ||
"name": "linux-debug", | ||
"displayName": "Linux Debug", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/out/build/${presetName}", | ||
"installDir": "${sourceDir}/out/install/${presetName}", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
}, | ||
"condition": { | ||
"type": "equals", | ||
"lhs": "${hostSystemName}", | ||
"rhs": "Linux" | ||
}, | ||
"vendor": { | ||
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { | ||
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "macos-debug", | ||
"displayName": "macOS Debug", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/out/build/${presetName}", | ||
"installDir": "${sourceDir}/out/install/${presetName}", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": "Debug" | ||
}, | ||
"condition": { | ||
"type": "equals", | ||
"lhs": "${hostSystemName}", | ||
"rhs": "Darwin" | ||
}, | ||
"vendor": { | ||
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { | ||
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# CMakeList.txt: projekt CMake dla elementu beep_engine, dołącz źródło i zdefiniuj | ||
# tutaj logikę specyficzną dla projektu. | ||
# | ||
|
||
# Dodaj źródło do pliku wykonywalnego tego projektu. | ||
add_executable (beep_engine "beep_engine.cpp" "Headers/beep_libs.h" "Headers/beep_variables.h" "Headers/beep.h") | ||
|
||
if (CMAKE_VERSION VERSION_GREATER 3.12) | ||
set_property(TARGET beep_engine PROPERTY CXX_STANDARD 20) | ||
endif() | ||
|
||
# TODO: Dodaj testy i zainstaluj elementy docelowe w razie potrzeby. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "beep_libs.h" | ||
|
||
// VERSION v1.1.1 | ||
const std::string beep_engie1 = "made by dazaizer0"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "beep_libs.h" | ||
|
||
|
||
void PRINT(const std::string& message) | ||
{ | ||
std::cout << message; | ||
} | ||
|
||
void PLAY(const double frequency, int duration) | ||
{ | ||
const double period = 1.0 / frequency * 1000000; // T = 1 / f | ||
|
||
#ifdef _WIN32 | ||
Beep(static_cast<int>(frequency), duration); | ||
#else | ||
for (int i = 0; i < duration * 1000; i += period) | ||
{ | ||
std::cout << "\a"; // play sound | ||
std::this_thread::sleep_for(std::chrono::microseconds(static_cast<int>(period))); | ||
} | ||
#endif | ||
} | ||
|
||
class SOUND | ||
{ | ||
public: | ||
SOUND() : frequency(0.0), duration(0) {} // default sound constructor | ||
SOUND(const double f, const int d) : frequency(f), duration(d) {} | ||
|
||
double getFrequency() const | ||
{ | ||
return frequency; | ||
} | ||
|
||
int getDuration() const | ||
{ | ||
return duration; | ||
} | ||
|
||
private: | ||
double frequency; | ||
int duration; | ||
}; | ||
|
||
void PLAY_SOUNDS(const std::map<int, SOUND> SOUNDS, int base_sleep_time) | ||
{ | ||
for (const auto& sound : SOUNDS) | ||
{ | ||
PLAY(sound.second.getFrequency(), sound.second.getDuration()); | ||
std::cout << std::flush; | ||
|
||
Sleep(base_sleep_time); | ||
} | ||
} | ||
|
||
void CLEAR_TERMINAL() | ||
{ | ||
#ifdef _WIN32 | ||
system("cls"); | ||
#else | ||
system("clear"); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include <iostream> | ||
#include <map> | ||
#include <chrono> | ||
#include <thread> | ||
#include <conio.h> | ||
#include <cstdlib> | ||
#include <fstream> | ||
|
||
#ifdef _WIN32 | ||
#include <Windows.h> | ||
#include <windows.h> | ||
#else | ||
#include <unistd.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "beep_libs.h" | ||
|
||
|
||
const std::string beepboard_hello_message = " <- base_frequency, This is beepboard[play = [f, g, h, j, k], tone_controls[+, -], quit[/]: "; | ||
const std::string hello_message = "[1 - beep_map], [2 - beepboard], [3 - beeplist], [4 - quit], [5 - clear], [6 - change base values]: "; | ||
const std::string program_message = "Welcome to beep_engine2023! The universal engine, created to generate beeps whatever platform you use: "; | ||
const std::string beepmap_hello_message = "This is beepmap please type the length of your beep map: "; | ||
const std::string beeplist_hello_message = "This is beeplist, [f, g, h, j, k], tone_controls[+, -], quit[/], [enter] to play:"; | ||
|
||
int base_frequency = 300; | ||
int frequency_change = 100; | ||
int beeps_frequency_change = 100; | ||
int base_duration = 720; | ||
int base_sleep_time = 0; |
Oops, something went wrong.