{"id":15047824,"url":"https://github.com/zac-dot/pianotoy","last_synced_at":"2026-04-02T01:37:54.409Z","repository":{"id":237841769,"uuid":"573668427","full_name":"Zac-dot/Pianotoy","owner":"Zac-dot","description":"A small application called Piano Toy that plays notes and uses GTK for the UI","archived":false,"fork":false,"pushed_at":"2023-02-20T05:57:43.000Z","size":21549,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T17:17:23.552Z","etag":null,"topics":["cplusplus-11","gtk","gui"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zac-dot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-03T03:30:48.000Z","updated_at":"2022-12-19T12:57:20.000Z","dependencies_parsed_at":"2024-05-03T10:40:38.658Z","dependency_job_id":null,"html_url":"https://github.com/Zac-dot/Pianotoy","commit_stats":null,"previous_names":["zac-dot/pianotoy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-dot%2FPianotoy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-dot%2FPianotoy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-dot%2FPianotoy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zac-dot%2FPianotoy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zac-dot","download_url":"https://codeload.github.com/Zac-dot/Pianotoy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489778,"owners_count":20298997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cplusplus-11","gtk","gui"],"created_at":"2024-09-24T21:05:00.106Z","updated_at":"2025-12-30T03:22:05.968Z","avatar_url":"https://github.com/Zac-dot.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pianotoy in C++ using GTK\r\n![Pianotoy Example](pianotoyexample.gif)\r\n---\r\n# Prerequisites\r\n1. About the Program\r\n2. Running the Application\r\n   1. via building the source files\r\n   2. via running the .exe file\r\n3. Parts of the application\r\n4. Oddities\r\n\r\n---\r\n## 1. About the Program\r\n\r\nThis is meant to be a simple program to demonstrate my abilities to use\r\nC++ and the GTK UI framework to display a UI. It is a simple small keyboard that displays 7 buttons,\r\neach of which plays a *.wav audio file when pressed. Each key has a letter on it corresponding to the note to play.\r\nThe pitch of the notes that are played can be altered through the ```Note``` button in the menubar.\r\n\r\nThe program was also used as a final project for my C++ class, specifically CS 361. \r\nAs such, some additional features were added in order to hit what was required, such as the ```Shapes``` button in the menubar.\r\nWhile these do not have much to do with a keyboard, they were added for that reason, and can be removed if desired.\r\n\r\n---\r\n## 2. Running the Application\r\n\r\nIn order to run the application, it requires a Windows installation with\r\n```MSYS2 MINGW64```installed. For either 2.1 or 2.2, the following\r\nmust be downloaded and prepped in the ```MSYS2 MINGW64``` environment.\r\n\r\nTo prep you must open the ```MSYS2 MINGW64```terminal and run the following commands:\r\n\r\n```bash\r\npacman -S mingw-w64-x86_64-gtk4\r\npacman -S mingw-w64-x86_64-toolchain base-devel\r\n``````\r\n### 2.1 via building the source files\r\n- Download the source files from where ever you got them from\r\n- Unzip the source files\r\n  - The files must be set as follows\r\n  ```\r\n    src\r\n    ├── main.cpp\r\n    ├── shapes.h\r\n    ├── audio.h\r\n    └── pianokeys\r\n        └── *Holds audio files in .wav*\r\n    ```\r\n- Then the main.cpp file can be ran from IDE of choice\r\n  - **You must set up the environment to use the ```MSYS2 MINGW64``` environment**\r\n    - In CLion you can do this by\r\n      - Changing the environment in the settings by going to\r\n      ```File \u003e Settings \u003e Build, Execution, Deployment \u003e Toolchains```\r\n      - Then you can add a new toolchain by clicking the ```+``` button\r\n      - Then you can select the ```MSYS2 MINGW64``` by changing Toolset to point to ```C:\\msys64\\mingw64```\r\n      - CLion will automatically detect the build tool, C compiler, and C++ compiler at this point\r\n      - Then you can click ```OK``` and then ```Apply```\r\n      - Make sure the toolchain is at the top of the list!\r\n### 2.2 via running the .exe file\r\n- Download the files and extract them to a folder.\r\n- Open the ```MSYS2 MINGW64``` terminal and navigate to the folder.\r\n  - ex: ```cd C:\\Users\\user\\MyCppProgram```\r\n- Run the program from the directory by doing:\r\n ```bash\r\n    {path to the folder}/cppproject.exe\r\n `````` \r\n---\r\n\r\n## 3. Parts of the application\r\nThe main application uses GTK4 to create the GUI. The GUI is made up of 3 main parts.\r\n- The main window\r\n- The piano keys\r\n  - A series of buttons that play a note when clicked\r\n- The menubar\r\n  - A menu bar that has a few options\r\n    - ```Note``` - Displays a menu that lets you change note pitches\r\n    - ```Note \u003e * Pitch``` - Changes the note pitch to the number (*) selected\r\n    - ```Shapes``` - Displays a menu that will draw a shape in console\r\n    - ```Shapes \u003e Diamond``` - Draws a Diamond in console using * as the character\r\n    - ```Shapes \u003e Triangle``` - Draws a right triangle using a recursive function, using * as the character\r\n---\r\n\r\n## 4. Oddities\r\n#### Why shapes in console?\r\n- This is mainly to hit a pre-requisite for the class, as it requires shapes in console drawn, using recursive\r\nor nested functions.\r\n\r\n#### Why is the audio not working?\r\n- Make sure the audio files are in the structure as shown in 2.1. **It is also required that you are running\r\nWindows**, if you do not, then there is a chance audio will not play without changing the source code.\r\n\r\n#### Why does ```Gtk-CRITICAL **: xx:xx:xx.xxx: gtk_main_quit: assertion 'main_loops != NULL' failed``` show up in the console?\r\n- This is because clicking the ```X``` button is undefined in the program. GTK will try to insinuate its to close\r\nthe program, and thus will throw the error. This is not a problem, and can be ignored.\r\n\r\n#### Must the program be ran in the ```MSYS2 MINGW64``` environment?\r\n- At this point in time, the program must be ran in the environment. While it is possible to generate a exe file \r\nthat will not require the environment, it is not currently set up to do so. This would require alot more time\r\nout of my schedule that I do not have at this time. This can, however, be done later or by a user if wanted.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzac-dot%2Fpianotoy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzac-dot%2Fpianotoy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzac-dot%2Fpianotoy/lists"}