-
Notifications
You must be signed in to change notification settings - Fork 4
/
vibra.h
94 lines (85 loc) · 3.28 KB
/
vibra.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef INCLUDE_VIBRA_H_
#define INCLUDE_VIBRA_H_
#include <string>
extern "C"
{
/**
* @brief Structure to hold a music fingerprint.
*
* @note The structure is thread-unsafe and does not require manual memory management
* for the returned pointer.
*/
struct Fingerprint
{
std::string uri; /**< The URI associated with the fingerprint. */
unsigned int sample_ms; /**< The sample duration in milliseconds. */
};
/**
* @brief Generate a fingerprint from a music file.
*
* @param music_file_path The path to the music file.
* @return Fingerprint* Pointer to the generated fingerprint.
*
* @note This function is thread-unsafe and the returned pointer should not be freed.
*/
Fingerprint *vibra_get_fingerprint_from_music_file(const char *music_file_path);
/**
* @brief Generate a fingerprint from WAV data.
*
* @param raw_wav The raw WAV data.
* @param wav_data_size The size of the WAV data in bytes.
* @return Fingerprint* Pointer to the generated fingerprint.
*
* @note This function is thread-unsafe and the returned pointer should not be freed.
*/
Fingerprint *vibra_get_fingerprint_from_wav_data(const char *raw_wav, int wav_data_size);
/**
* @brief Generate a fingerprint from signed PCM data.
*
* @param raw_pcm The raw PCM data.
* @param pcm_data_size The size of the PCM data in bytes.
* @param sample_rate The sample rate of the PCM data.
* @param sample_width The sample width (bits per sample) of the PCM data.
* @param channel_count The number of channels in the PCM data.
* @return Fingerprint* Pointer to the generated fingerprint.
*
* @note This function is thread-unsafe and the returned pointer should not be freed.
*/
Fingerprint *vibra_get_fingerprint_from_signed_pcm(const char *raw_pcm, int pcm_data_size,
int sample_rate, int sample_width,
int channel_count);
/**
* @brief Generate a fingerprint from PCM data.
*
* @param raw_pcm The raw PCM data.
* @param pcm_data_size The size of the PCM data in bytes.
* @param sample_rate The sample rate of the PCM data.
* @param sample_width The sample width (bits per sample) of the PCM data.
* @param channel_count The number of channels in the PCM data.
* @return Fingerprint* Pointer to the generated fingerprint.
*
* @note This function is thread-unsafe and the returned pointer should not be freed.
*/
Fingerprint *vibra_get_fingerprint_from_float_pcm(const char *raw_pcm, int pcm_data_size,
int sample_rate, int sample_width,
int channel_count);
/**
* @brief Get the URI associated with a fingerprint.
*
* @param fingerprint Pointer to the fingerprint.
* @return const char* The URI as a C-string.
*
* @note This function is thread-unsafe and the returned pointer should not be freed.
*/
const char *vibra_get_uri_from_fingerprint(Fingerprint *fingerprint);
/**
* @brief Get the sample duration in milliseconds from a fingerprint.
*
* @param fingerprint Pointer to the fingerprint.
* @return unsigned int The sample duration in milliseconds.
*
* @note This function is thread-unsafe.
*/
unsigned int vibra_get_sample_ms_from_fingerprint(Fingerprint *fingerprint);
} // extern "C"
#endif // INCLUDE_VIBRA_H_