#pragma once
#ifndef __has_xm_h
#define __has_xm_h
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xm_context_s;
typedef struct xm_context_s xm_context_t;
int xm_create_context(xm_context_t**, const char* moddata, uint32_t rate);
int xm_create_context_safe(xm_context_t**, const char* moddata, size_t moddata_length, uint32_t rate);
void xm_create_context_from_libxmize(xm_context_t**, char* libxmizeddata, uint32_t rate);
void xm_free_context(xm_context_t*);
void xm_generate_samples(xm_context_t*, float* output, size_t numsamples);
void xm_set_max_loop_count(xm_context_t*, uint8_t loopcnt);
uint8_t xm_get_loop_count(xm_context_t*);
void xm_seek(xm_context_t*, uint8_t pot, uint8_t row, uint16_t tick);
bool xm_mute_channel(xm_context_t*, uint16_t, bool);
bool xm_mute_instrument(xm_context_t*, uint16_t, bool);
const char* xm_get_module_name(xm_context_t*);
const char* xm_get_tracker_name(xm_context_t*);
uint16_t xm_get_number_of_channels(xm_context_t*);
uint16_t xm_get_module_length(xm_context_t*);
uint16_t xm_get_number_of_patterns(xm_context_t*);
uint16_t xm_get_number_of_rows(xm_context_t*, uint16_t);
uint16_t xm_get_number_of_instruments(xm_context_t*);
uint16_t xm_get_number_of_samples(xm_context_t*, uint16_t);
void* xm_get_sample_waveform(xm_context_t*, uint16_t instr, uint16_t sample, size_t* length, uint8_t* bits);
void xm_get_playing_speed(xm_context_t*, uint16_t* bpm, uint16_t* tempo);
void xm_get_position(xm_context_t*, uint8_t* pattern_index, uint8_t* pattern, uint8_t* row, uint64_t* samples);
uint64_t xm_get_latest_trigger_of_instrument(xm_context_t*, uint16_t);
uint64_t xm_get_latest_trigger_of_sample(xm_context_t*, uint16_t instr, uint16_t sample);
uint64_t xm_get_latest_trigger_of_channel(xm_context_t*, uint16_t);
bool xm_is_channel_active(xm_context_t*, uint16_t);
uint16_t xm_get_instrument_of_channel(xm_context_t*, uint16_t);
float xm_get_frequency_of_channel(xm_context_t*, uint16_t);
float xm_get_volume_of_channel(xm_context_t*, uint16_t);
float xm_get_panning_of_channel(xm_context_t*, uint16_t);
#ifdef __cplusplus
}
#endif
#endif