Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyblocker/hekky-osc
An OSC Library for C++
https://github.com/hyblocker/hekky-osc
cpp open-sound-control osc vrchat
Last synced: 9 days ago
JSON representation
An OSC Library for C++
- Host: GitHub
- URL: https://github.com/hyblocker/hekky-osc
- Owner: hyblocker
- License: other
- Created: 2022-11-26T10:57:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T14:18:21.000Z (7 months ago)
- Last Synced: 2024-10-10T21:13:56.835Z (26 days ago)
- Topics: cpp, open-sound-control, osc, vrchat
- Language: C++
- Homepage:
- Size: 108 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hekky OSC
An OSC Library for C++, initially based on [CoreOSC](https://github.com/PaciStardust/CoreOSC-UTF8).
### Motivation
> [XKCD 927](https://xkcd.com/927/)
OSC libraries in C++ suck. The APIs are either extremely verbose, the library has too many dependencies and is a nightmare to get working, or difficult to use without leaking memory.
I'm also using this library as an excuse to learn C++ better and improve my ability to write good C++ code.
### License
This project is licensed under the MIT license. CoreOSC is also licensed under the MIT license.
---
# Example
```cpp
#include#include "hekky-osc.hpp"
int main()
{
// Open a UDP socket, pointing to localhost on port 9000
auto udpSender = hekky::osc::UdpSender("127.0.0.1", 9000, 9001);auto message = hekky::osc::OscMessage("/osc/test/int32");
message.Push(12);
udpSender.Send(message);auto message2 = hekky::osc::OscMessage("/osc/test/double");
message2.Push(3.14159265358979323846264338327950288419716939937510);
udpSender.Send(message2);auto message3 = hekky::osc::OscMessage("/osc/test/int64");
message3.Push(2345678890123456789LL);
message3.Push(80LL);
udpSender.Send(message3);auto message4 = hekky::osc::OscMessage("/osc/test/string");
message4.Push("Hello World!");
udpSender.Send(message4);auto serialPacking = hekky::osc::OscMessage("/osc/vector/float32");
serialPacking.Push(1.4142135624f); // sqrt(2)
serialPacking.Push(3.1415926536f); // pi
serialPacking.Push(2.7182818285f); // e
udpSender.Send(serialPacking);// Alternatively, you can encode the same message like this:
auto chainPacking = hekky::osc::OscMessage("/osc/vector/float32");
chainPacking.Push(1.4142135624f).Push(3.1415926536f).Push(2.7182818285f);
udpSender.Send(chainPacking);// Closing it manually isn't needed, it gets closed via the destructor automatically!
// udpSender.Close();std::cout << "Done!\n";
}
```## Supported platforms
| Platform | Supported |
| -------- | --------- |
| Windows | ✅ |
| MacOS | ❌ |
| Linux | ❌ |## Goal
This library aims to provide a simple and easy to use API for using OSC. It aims to conform to the entire OSC 1.0 specification. (Not yet achieved)
| Feature | Supported |
| ----------------------------------------------- | --------- |
| Sending OSC messages | ✅ |
| Receiving OSC messages | ❌ |
| Sending primitive data types (int, float, etc.) | ✅ |
| 32-bit RGBA color | ❌ |
| OSC Timetag | ❌ |
| MIDI | ❌ |
| Null | ❌ |
| Arrays | ❌ |
| Bundles | ❌ |
| ASCII Character | ❌ |