-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
IEActions is a open-source extension library designed for Linux, Windows and macOS applications. It provides an abstracted action class that enables programmatic execution of various actions such as volume control, muting, console commands, and file opening. This library serves as a versatile interface for managing different computer actions in applications.
The C/C++ development environments for Windows and macOS come with all necessary dependencies for compiling IEActions, but on Linux you will need the ALSA library development kit.
Important
For Linux users, IEActions depends on IEAudio4Linux. Ensure you run the following command to initialize the submodule:
git submodule update --init --recusive .
Additionally, follow the prerequisites outlined below
For more in depth, visit the IEAudio4Linux Wiki
On Red Hat and derivatives like Fedora, run:
sudo dnf install alsa-lib-develOn Debian and derivatives like Ubuntu, run:
sudo apt install libasound2-devLaunch your preferred terminal and navigate to a empty working directory.
Clone IEActions to the working directory.
git clone https://github.com/Interactive-Echoes/IEActions.git
cd IEActionsIEActions uses CMake as its build system. To get started, ensure you have CMake installed and follow these steps:
-
Make sure IEActions and all of its submodules are synced:
git submodule update --init --recursive . git pull --recurse -
Generate Build Files:
cmake -S . -B ./buildThis command creates a
./builddirectory where all the CMake-generated files will be placed. -
Build IEActions:
cmake --build ./build
After building, you can find the library in the
./build/bindirectory namedIEActions. -
Run the Example:
Locate and double-clickIEActionsExamplein the./build/bin/or./build/bin/<config>directory or run./build/bin/IEActionsExample # ./build/bin/Debug/IEActionsExample # ./build/bin/Release/IEActionsExample
To integrate the built IEActions library into your application:
-
Include IEActions in Your Project:
Add the IEActions directory to your application's project directory or if your application is using Git simply call:git submodule add https://github.com/Interactive-Echoes/IEActions.git ThirdParty/IEActions git submodule update --init --recursive
-
Update
CMakeLists.txt:
In your application'sCMakeLists.txt, include IEActions by adding:add_subdirectory(<path_to_IEActions>) # Example: add_subdirectory(ThirdParty/IEActions) target_link_libraries(<your-target> PUBLIC IEActions) target_include_directories(<your-target> PUBLIC <path_to_IEActions>)
-
Verify Integration:
Include theIEActions.hfile in your application and verify the integration by compiling with:#include "IEActions.h" #include <iostream> int main() { if (const std::unique_ptr<IEAction_Volume> VolumeAction = IEAction::GetVolumeAction()) { float Volume = 1.0f; std::cout << "Set system volume 0 to 1: "; std::cin >> Volume; VolumeAction->SetVolume(Volume); std::cout << "You have set your master audio output volume to " << VolumeAction->GetVolume() << ".\n"; } return 0; };
You can find this same example file here IEActionsExample
In a simple demo app, you can instantiate any of the IEActions provided by the IEAction namespace. In this example, we instantiate a Volume action and a Mute action.
#include "IEActions.h"
#include <iostream>
int main()
{
if (const std::unique_ptr<IEAction_Volume> VolumeAction = IEAction::GetVolumeAction())
{
float Volume = 1.0f;
std::cout << "Set system volume 0 to 1: ";
std::cin >> Volume;
VolumeAction->SetVolume(Volume);
std::cout << "You have set your master audio output volume to " << VolumeAction->GetVolume() << ".\n";
}
if (const std::unique_ptr<IEAction_Mute> MuteAction = IEAction::GetMuteAction())
{
int bMute = 0;
std::cout << "Set system mute 0 or 1: ";
std::cin >> bMute;
MuteAction->SetMute(bMute ? true : false);
if (MuteAction->GetMute())
{
std::cout << "You have muted your master audio output. \n";
}
else
{
std::cout << "You have un-muted your master audio output. \n";
}
}
std::cout << "IEActions Example finished view the github Wiki for more.";
return 0;
}Note
While this example uses user input to set the volume, the program could set the volume programmatically based on other conditions or inputs.
-
Volume Action: This part of the code demonstrates how to use the
IEAction_Volumeaction to set the system volume. The user is prompted to enter a volume level between 0 and 1, which is then set using theSetVolumemethod. The current volume level is retrieved and displayed using theGetVolumemethod. -
Mute Action: This part of the code demonstrates how to use the
IEAction_Muteaction to mute or unmute the system audio. The user is prompted to enter 0 (unmute) or 1 (mute). The mute state is set using theSetMutemethod, and the current mute state is checked using theGetMutemethod to provide appropriate feedback to the user.
This work is licensed under SPDX-License-Identifier: GPL-2.0-only
Copyright © Interactive Echoes. All rights reserved.