Initial commit.
This commit is contained in:
commit
4135b11764
22
CONTRIBUTER.md
Normal file
22
CONTRIBUTER.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Contributors
|
||||
|
||||
Thanks to the following people who have contributed to this project:
|
||||
|
||||
| Name | Contribution |
|
||||
| ------------- | ----------------------------- |
|
||||
| Rafli (OWNER) | Initial development, design |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## How to Contribute
|
||||
|
||||
We welcome contributions from everyone!
|
||||
If you want to contribute:
|
||||
1. Make sure you are signed in [here](https://git.techlabs.lol/user/login).
|
||||
2. Fork the repository.
|
||||
3. Create a new branch.
|
||||
4. Make your changes.
|
||||
5. Submit a pull request.
|
||||
|
||||
Thanks for helping to make this project better!
|
12
MIT-LICENSE.txt
Normal file
12
MIT-LICENSE.txt
Normal file
@ -0,0 +1,12 @@
|
||||
The MIT License
|
||||
Version N/A
|
||||
SPDX short identifier: MIT
|
||||
Open Source Initiative Approved License
|
||||
|
||||
Copyright 2025 Radiant Code
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
96
README.md
Normal file
96
README.md
Normal file
@ -0,0 +1,96 @@
|
||||
# SoundBoard.AHK
|
||||
|
||||
A lightweight, fully customizable soundboard built with AutoHotkey.
|
||||
Allows users to assign sound files to hotkeys dynamically through an `.ini` configuration file. No recompiling needed to change keys or sounds since it's handled on the seperate file.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
- **Custom Hotkeys**: Bind any key you want with control (`Ctrl`) or alt (`Alt`) modifiers (by default).
|
||||
- **Fully Configurable**: All key and modifier settings are stored in a simple `.ini` file.
|
||||
- **Save and Reload Settings**: Save hotkey and sound assignments anytime without restarting the script.
|
||||
- **Minimal & Fast**: No external libraries required, fully standalone.
|
||||
|
||||
---
|
||||
|
||||
## How It Works
|
||||
|
||||
1. All hotkey mappings are loaded from a `.ini` file (`save.ini` by default).
|
||||
2. Modifier keys (e.g., Control, Alt) can also be customized through the ini.
|
||||
3. Two types of actions:
|
||||
- **Browse**: Press `Control + [Your Key]` to select a sound file (BY DEFAULT).
|
||||
- **Play**: Press `Alt + [Your Key]` to play the assigned sound (BY DEFAULT).
|
||||
|
||||
The script automatically handles key registration at runtime.
|
||||
|
||||
---
|
||||
|
||||
## Default Controls
|
||||
|
||||
| Action | Key Combination | Description |
|
||||
|--------------|-------------------------|--------------------------|
|
||||
| Browse Sound | `Ctrl + [Assigned Key]` | Choose a sound file |
|
||||
| Play Sound | `Alt + [Assigned Key]` | Play assigned sound |
|
||||
| Save Mapping | `Ctrl + Alt + Shift +s` | Save all key mappings |
|
||||
| Exit Script | `Ctrl + Win + Alt + X` | Exit the soundboard |
|
||||
|
||||
All keys are configurable via `save.ini`.
|
||||
|
||||
---
|
||||
|
||||
## Example `save.ini`
|
||||
|
||||
```ini
|
||||
[Settings]
|
||||
ControllerModifier=^
|
||||
SoundModifier=!
|
||||
|
||||
[GeneralHotkeys]
|
||||
SaveKey=^!+s
|
||||
ExitKey=^#!x
|
||||
|
||||
[h1]
|
||||
key=F1
|
||||
path=C:\Sounds\sound1.wav
|
||||
|
||||
[h2]
|
||||
key=F2
|
||||
path=C:\Sounds\sound2.wav
|
||||
|
||||
; Add more sections like [h3], [h4], etc.
|
||||
````
|
||||
|
||||
---
|
||||
|
||||
## How To Use
|
||||
|
||||
1. Install [AutoHotkey v1.1](https://www.autohotkey.com/) (classic) if you don't have it.
|
||||
2. Clone this repository or download the `.ahk` script.
|
||||
3. Edit `save.ini` according to your preferred hotkeys and sound files.
|
||||
4. Run the script (`soundboard.ahk`).
|
||||
5. Enjoy your custom soundboard!
|
||||
|
||||
---
|
||||
|
||||
## ⚙Requirements
|
||||
|
||||
* Windows OS
|
||||
* AutoHotkey v1.1 (or newer)
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [MIT License](MIT-LICENSE.txt).
|
||||
|
||||
## Support This Project
|
||||
|
||||
If you find this project helpful, you can support my work by donating via PayPal:
|
||||
👉 [](https://www.paypal.me/rafli23115)
|
||||
|
||||
Thank you for your support!
|
||||
|
||||
---
|
||||
|
||||
> Crafted with 💡 and code by **TechLabs.**
|
||||
**Leaping over limits, one project at a time. ♾**
|
33
changelog.md
Normal file
33
changelog.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.0] - 2025-05-04
|
||||
### Added
|
||||
- Ability to load settings from `save.ini`.
|
||||
- Support for customizable Save, Exit, and Reload hotkeys.
|
||||
- Dynamic loading of hotkeys for browsing and playing sound files.
|
||||
- Dispatcher system to handle multiple types of hotkey actions.
|
||||
- Save function to persist current keys and paths into `save.ini`.
|
||||
- Reload function to update hotkeys without restarting the application.
|
||||
- Basic file browser dialog to assign new sound files.
|
||||
- Sound player to play assigned sound files.
|
||||
- Global initialization for keys, paths, and hotkey mappings.
|
||||
- New modifiers: Ctrl for browsing sounds and Alt for playing sounds, both configurable through the INI file.
|
||||
|
||||
### Changed
|
||||
- Refactored the entire codebase so that keys are no longer hardcoded.
|
||||
|
||||
### Deprecated
|
||||
- None.
|
||||
|
||||
### Removed
|
||||
- Removed all hardcoded keys like Numpad1, Numpad2 up to Numpad9.
|
||||
|
||||
### Fixed
|
||||
- None.
|
||||
```
|
23
save.ini
Normal file
23
save.ini
Normal file
@ -0,0 +1,23 @@
|
||||
[Settings]
|
||||
ControllerModifier=^
|
||||
; For browsing file, (Default control).
|
||||
SoundModifier=!
|
||||
; For playing sound (default alt).
|
||||
|
||||
[GeneralHotkeys]
|
||||
SaveKey=^!+s
|
||||
ExitKey=^#!x
|
||||
ReloadKey=^!+r
|
||||
|
||||
; Begin the soun dscript.
|
||||
[h1]
|
||||
key=F1
|
||||
path=C:\Sounds\sound1.wav
|
||||
|
||||
[h2]
|
||||
key=F2
|
||||
path=C:\Sounds\sound2.wav
|
||||
|
||||
[h3]
|
||||
key=F3
|
||||
path=C:\Sounds\sound3.wav
|
BIN
soundBoard$.exe
Normal file
BIN
soundBoard$.exe
Normal file
Binary file not shown.
141
soundBoard.ahk
Normal file
141
soundBoard.ahk
Normal file
@ -0,0 +1,141 @@
|
||||
iniFile := "save.ini"
|
||||
|
||||
; --- Load settings ---
|
||||
IniRead, controllerModifier, %iniFile%, Settings, ControllerModifier, ^
|
||||
IniRead, soundModifier, %iniFile%, Settings, SoundModifier, !
|
||||
|
||||
IniRead, SaveKey, %iniFile%, GeneralHotkeys, SaveKey, ^Numpad0
|
||||
IniRead, ExitKey, %iniFile%, GeneralHotkeys, ExitKey, ^#Numpad0
|
||||
IniRead, ReloadKey, %iniFile%, GeneralHotkeys, ReloadKey, ^Numpad1 ; <- Tambah ini!
|
||||
|
||||
; --- Initialize globals ---
|
||||
global Keys := []
|
||||
global Paths := []
|
||||
global HotkeyMap := {}
|
||||
|
||||
LoadHotkeys()
|
||||
|
||||
; --- Bind SaveKey, ExitKey, and ReloadKey ---
|
||||
Hotkey, %SaveKey%, SaveData
|
||||
Hotkey, %ExitKey%, ExitAppHandler
|
||||
Hotkey, %ReloadKey%, ReloadData ; <- Bind reload!
|
||||
|
||||
return
|
||||
|
||||
; --- Load all hotkeys from INI ---
|
||||
LoadHotkeys()
|
||||
{
|
||||
global Keys, Paths, HotkeyMap, iniFile, controllerModifier, soundModifier
|
||||
|
||||
; Clear previous keys
|
||||
Keys := []
|
||||
Paths := []
|
||||
HotkeyMap := {}
|
||||
|
||||
idx := 1
|
||||
Loop
|
||||
{
|
||||
section := "h" idx
|
||||
IniRead, key, %iniFile%, %section%, key, ERROR
|
||||
IniRead, path, %iniFile%, %section%, path, ERROR
|
||||
|
||||
if (key = "ERROR")
|
||||
break
|
||||
|
||||
Keys.Push(key)
|
||||
Paths.Push(path)
|
||||
|
||||
browseHotkey := controllerModifier . key
|
||||
playHotkey := soundModifier . key
|
||||
|
||||
HotkeyMap[browseHotkey] := ["Browse", idx]
|
||||
HotkeyMap[playHotkey] := ["Play", idx]
|
||||
|
||||
Hotkey, %browseHotkey%, HotkeyDispatcher
|
||||
Hotkey, %playHotkey%, HotkeyDispatcher
|
||||
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
; --- Dispatcher for all hotkeys ---
|
||||
HotkeyDispatcher:
|
||||
thisHotkey := A_ThisHotkey
|
||||
actionInfo := HotkeyMap[thisHotkey]
|
||||
if (!actionInfo)
|
||||
return
|
||||
|
||||
action := actionInfo[1]
|
||||
idx := actionInfo[2]
|
||||
|
||||
if (action = "Browse")
|
||||
BrowseFile(idx)
|
||||
else if (action = "Play")
|
||||
PlaySound(idx)
|
||||
return
|
||||
|
||||
; --- Save current keys and paths ---
|
||||
SaveData:
|
||||
IniWrite, %controllerModifier%, %iniFile%, Settings, ControllerModifier
|
||||
IniWrite, %soundModifier%, %iniFile%, Settings, SoundModifier
|
||||
IniWrite, %SaveKey%, %iniFile%, GeneralHotkeys, SaveKey
|
||||
IniWrite, %ExitKey%, %iniFile%, GeneralHotkeys, ExitKey
|
||||
IniWrite, %ReloadKey%, %iniFile%, GeneralHotkeys, ReloadKey
|
||||
|
||||
Loop % Keys.Length()
|
||||
{
|
||||
section := "h" A_Index
|
||||
IniWrite, % Keys[A_Index], %iniFile%, %section%, key
|
||||
IniWrite, % Paths[A_Index], %iniFile%, %section%, path
|
||||
}
|
||||
MsgBox, Saved!
|
||||
return
|
||||
|
||||
; --- Reload keys and hotkeys from INI ---
|
||||
ReloadData:
|
||||
; First unbind all old hotkeys
|
||||
for hkName, _ in HotkeyMap
|
||||
Hotkey, %hkName%, Off
|
||||
|
||||
; Reload modifiers and keys again
|
||||
IniRead, controllerModifier, %iniFile%, Settings, ControllerModifier, ^
|
||||
IniRead, soundModifier, %iniFile%, Settings, SoundModifier, !
|
||||
|
||||
LoadHotkeys()
|
||||
MsgBox, Reloaded hotkeys from INI!
|
||||
return
|
||||
|
||||
; --- Exit application ---
|
||||
ExitAppHandler:
|
||||
MsgBox, Exiting...
|
||||
ExitApp
|
||||
return
|
||||
|
||||
; --- Browse a file and assign it ---
|
||||
BrowseFile(idx)
|
||||
{
|
||||
global Keys, Paths
|
||||
FileSelectFile, SelectedFile, 1, , Select a sound, Audio Files (*.wav; *.mp3)
|
||||
if (!SelectedFile)
|
||||
return
|
||||
Paths[idx] := SelectedFile
|
||||
}
|
||||
|
||||
; --- Play a sound file ---
|
||||
PlaySound(idx)
|
||||
{
|
||||
global Paths
|
||||
FilePath := Paths[idx]
|
||||
if (FilePath = "")
|
||||
{
|
||||
MsgBox, No file selected.
|
||||
}
|
||||
else if !FileExist(FilePath)
|
||||
{
|
||||
MsgBox, File does not exist.
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundPlay, %FilePath%
|
||||
}
|
||||
}
|
BIN
sounds/1.wav
Normal file
BIN
sounds/1.wav
Normal file
Binary file not shown.
BIN
sounds/2.wav
Normal file
BIN
sounds/2.wav
Normal file
Binary file not shown.
BIN
sounds/3.wav
Normal file
BIN
sounds/3.wav
Normal file
Binary file not shown.
BIN
sounds/4.wav
Normal file
BIN
sounds/4.wav
Normal file
Binary file not shown.
BIN
sounds/5.wav
Normal file
BIN
sounds/5.wav
Normal file
Binary file not shown.
BIN
sounds/6.wav
Normal file
BIN
sounds/6.wav
Normal file
Binary file not shown.
BIN
sounds/7.wav
Normal file
BIN
sounds/7.wav
Normal file
Binary file not shown.
BIN
sounds/8.mp3
Normal file
BIN
sounds/8.mp3
Normal file
Binary file not shown.
BIN
sounds/9.mp3
Normal file
BIN
sounds/9.mp3
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user