|
| 1 | +Guide to libdjinterop |
| 2 | +===================== |
| 3 | + |
| 4 | +This documentation provides an introductory guide to the public API of |
| 5 | +`libdjinterop`, and provides information on how to get started using it. |
| 6 | + |
| 7 | +High-level vs. Low-level APIs |
| 8 | +----------------------------- |
| 9 | + |
| 10 | +The library offers so-called "high-level" and "low-level" APIs, which serve |
| 11 | +different purposes. |
| 12 | + |
| 13 | +Low-level APIs |
| 14 | +-------------- |
| 15 | + |
| 16 | +The low-level APIs provides a very thin wrapper over a specific DJ database |
| 17 | +library format. A low-level API exposes all the peculiarities, details, and |
| 18 | +expressivity of that format, and does not offer any abstractions beyond |
| 19 | +presenting a C++ library interface. |
| 20 | + |
| 21 | +There are multiple low-level APIs, one for each type of DJ library format. |
| 22 | +There can also be multiple low-level APIs to cover occasions where a library |
| 23 | +undergoes a significant change to its schema (e.g. Engine 1.x and Engine 2.x |
| 24 | +are distinct low-level APIs). |
| 25 | + |
| 26 | +Sometimes, a low-level API (or collection of them) offer utility functions that |
| 27 | +help the end user translate from common concepts into encodings or types that |
| 28 | +are specific to the low-level library format. An example could be calculating |
| 29 | +the preferred size of a waveform for a given format. |
| 30 | + |
| 31 | +The current low-level APIs offered are listed below: |
| 32 | + |
| 33 | +| Low-level API | Include Path | |
| 34 | +|---------------|-----------------------------------------------------| |
| 35 | +| Engine 2.x | `#include <djinterop/engine/v2/engine_library.hpp>` | |
| 36 | +| Engine 3.x | `#include <djinterop/engine/v3/engine_library.hpp>` | |
| 37 | + |
| 38 | +Note that there is no low-level API for Engine 1.x at present. This is because |
| 39 | +when the library was first being written, Engine 1.x support was introduced |
| 40 | +directly into the high-level API without a low-level companion. The low-level |
| 41 | +API was developed with the introduction of Engine 2.x, and because the 1.x |
| 42 | +library was effectively now deprecated, the effort was not undertaken to |
| 43 | +backport the idea to 1.x. If a low-level API for Engine 1.x is important to |
| 44 | +you, please consider contributing! |
| 45 | + |
| 46 | +High-level API |
| 47 | +-------------- |
| 48 | + |
| 49 | +The library offers a high-level API as well, with a very different purpose to |
| 50 | +that of the low-level APIs. Whereas low-level APIs simply expose an underlying |
| 51 | +DJ library format in the form of a C++ API, the high-level API aims to: |
| 52 | + |
| 53 | +* Abstract over all format-specific aspects. |
| 54 | +* Offer a uniform interface, regardless of the underlying DJ library format. |
| 55 | +* Offer meaningful DJ library concepts, in the form of lightweight handles to |
| 56 | + objects in the underlying DJ library, that can be read or updated. |
| 57 | + |
| 58 | +The primary concepts in the high-level API are: |
| 59 | + |
| 60 | +* _Database_, representing the overall DJ library. |
| 61 | +* _Track_, representing a lightweight handle to a track in the library. |
| 62 | +* _Track snapshot_, representing a collection of offline data read from a track |
| 63 | + in the library. |
| 64 | +* _Crate_, representing an unordered list of related tracks. |
| 65 | +* _Playlist_, representing an ordered list of related tracks. |
| 66 | + |
| 67 | +Part of the challenge in developing `libdjinterop` is to ensure that the |
| 68 | +high-level API appropriately abstracts over all the different ways that the |
| 69 | +above concepts might be implemented in a real DJ library format. |
| 70 | + |
| 71 | +In reality, a DJ library that exists on disk is always of a specific format. |
| 72 | +As such, in order to create a new library or load an existing library with the |
| 73 | +intention of operating on it using the high-level API, it is always necessary |
| 74 | +to start with format-specific functions to do so: |
| 75 | + |
| 76 | +| Library Type | Include Path | |
| 77 | +|--------------|------------------------------------------| |
| 78 | +| Engine | `#include <djinterop/engine/engine.hpp>` | |
| 79 | + |
| 80 | + |
| 81 | +Stable API/ABI |
| 82 | +-------------- |
| 83 | + |
| 84 | +The library does not yet commit to offer either a stable API nor ABI. This |
| 85 | +situation may change in the future as the library matures. |
0 commit comments