use std::mem::transmute;
#[derive(Debug, PartialEq)]
pub enum AudioChannel {
ctype,
}
#[derive(Debug, PartialEq)]
pub enum ControlChannel {
ctype,
}
#[derive(Debug, PartialEq)]
pub enum StrChannel {
ctype,
}
#[derive(Debug, PartialEq)]
pub enum MessageType {
CSOUNDMSG_DEFAULT,
CSOUNDMSG_ERROR,
CSOUNDMSG_ORCH,
CSOUNDMSG_REALTIME,
CSOUNDMSG_WARNING,
CSOUNDMSG_STDOUT,
}
impl From<u32> for MessageType {
fn from(value: u32) -> Self {
match value {
0x0000 => MessageType::CSOUNDMSG_DEFAULT,
0x1000 => MessageType::CSOUNDMSG_ERROR,
0x2000 => MessageType::CSOUNDMSG_ORCH,
0x3000 => MessageType::CSOUNDMSG_REALTIME,
0x4000 => MessageType::CSOUNDMSG_WARNING,
0x5000 => MessageType::CSOUNDMSG_STDOUT,
_ => MessageType::CSOUNDMSG_ERROR,
}
}
}
#[derive(Debug, PartialEq, PartialOrd)]
pub enum Status {
CS_SIGNAL,
CS_MEMORY,
CS_PERFORMANCE,
CS_INITIALIZATION,
CS_ERROR,
CS_SUCCESS,
CS_OK(i32),
}
impl From<i32> for Status {
fn from(value: i32) -> Self {
match value {
-5 => Status::CS_SIGNAL,
-4 => Status::CS_MEMORY,
-3 => Status::CS_PERFORMANCE,
-2 => Status::CS_INITIALIZATION,
-1 => Status::CS_ERROR,
0 => Status::CS_SUCCESS,
value => Status::CS_OK(value),
}
}
}
impl Status {
pub fn to_i32(&self) -> i32 {
match self {
Status::CS_SIGNAL => -5,
Status::CS_MEMORY => -4,
Status::CS_PERFORMANCE => -3,
Status::CS_INITIALIZATION => -2,
Status::CS_ERROR => -1,
Status::CS_SUCCESS => 0,
Status::CS_OK(value) => *value,
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ChannelData {
CS_CONTROL_CHANNEL(f64),
CS_STRING_CHANNEL(String),
CS_UNKNOWN_CHANNEL,
}
bitflags! {
pub struct ControlChannelType: u32 {
const CSOUND_UNKNOWN_CHANNEL = 0;
const CSOUND_CONTROL_CHANNEL = 1;
const CSOUND_AUDIO_CHANNEL = 2;
const CSOUND_STRING_CHANNEL = 3;
const CSOUND_PVS_CHANNEL = 4;
const CSOUND_VAR_CHANNEL = 5;
const CSOUND_CHANNEL_TYPE_MASK = 15;
const CSOUND_INPUT_CHANNEL = 16;
const CSOUND_OUTPUT_CHANNEL = 32;
}
}
bitflags! {
pub struct KeyCallbackType: u8 {
const CSOUND_CALLBACK_KBD_EVENT = 1;
const CSOUND_CALLBACK_KBD_TEXT = 2;
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Language {
CSLANGUAGE_DEFAULT = 0,
CSLANGUAGE_AFRIKAANS,
CSLANGUAGE_ALBANIAN,
CSLANGUAGE_ARABIC,
CSLANGUAGE_ARMENIAN,
CSLANGUAGE_ASSAMESE,
CSLANGUAGE_AZERI,
CSLANGUAGE_BASQUE,
CSLANGUAGE_BELARUSIAN,
CSLANGUAGE_BENGALI,
CSLANGUAGE_BULGARIAN,
CSLANGUAGE_CATALAN,
CSLANGUAGE_CHINESE,
CSLANGUAGE_CROATIAN,
CSLANGUAGE_CZECH,
CSLANGUAGE_DANISH,
CSLANGUAGE_DUTCH,
CSLANGUAGE_ENGLISH_UK,
CSLANGUAGE_ENGLISH_US,
CSLANGUAGE_ESTONIAN,
CSLANGUAGE_FAEROESE,
CSLANGUAGE_FARSI,
CSLANGUAGE_FINNISH,
CSLANGUAGE_FRENCH,
CSLANGUAGE_GEORGIAN,
CSLANGUAGE_GERMAN,
CSLANGUAGE_GREEK,
CSLANGUAGE_GUJARATI,
CSLANGUAGE_HEBREW,
CSLANGUAGE_HINDI,
CSLANGUAGE_HUNGARIAN,
CSLANGUAGE_ICELANDIC,
CSLANGUAGE_INDONESIAN,
CSLANGUAGE_ITALIAN,
CSLANGUAGE_JAPANESE,
CSLANGUAGE_KANNADA,
CSLANGUAGE_KASHMIRI,
CSLANGUAGE_KONKANI,
CSLANGUAGE_KOREAN,
CSLANGUAGE_LATVIAN,
CSLANGUAGE_LITHUANIAN,
CSLANGUAGE_MACEDONIAN,
CSLANGUAGE_MALAY,
CSLANGUAGE_MALAYALAM,
CSLANGUAGE_MANIPURI,
CSLANGUAGE_MARATHI,
CSLANGUAGE_NEPALI,
CSLANGUAGE_NORWEGIAN,
CSLANGUAGE_ORIYA,
CSLANGUAGE_POLISH,
CSLANGUAGE_PORTUGUESE,
CSLANGUAGE_PUNJABI,
CSLANGUAGE_ROMANIAN,
CSLANGUAGE_RUSSIAN,
CSLANGUAGE_SANSKRIT,
CSLANGUAGE_SERBIAN,
CSLANGUAGE_SINDHI,
CSLANGUAGE_SLOVAK,
CSLANGUAGE_SLOVENIAN,
CSLANGUAGE_SPANISH,
CSLANGUAGE_SWAHILI,
CSLANGUAGE_SWEDISH,
CSLANGUAGE_TAMIL,
CSLANGUAGE_TATAR,
CSLANGUAGE_TELUGU,
CSLANGUAGE_THAI,
CSLANGUAGE_TURKISH,
CSLANGUAGE_UKRAINIAN,
CSLANGUAGE_URDU,
CSLANGUAGE_UZBEK,
CSLANGUAGE_VIETNAMESE,
CSLANGUAGE_COLUMBIAN,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum FileTypes {
CSFTYPE_UNKNOWN = 0,
CSFTYPE_UNIFIED_CSD = 1,
CSFTYPE_ORCHESTRA,
CSFTYPE_SCORE,
CSFTYPE_ORC_INCLUDE,
CSFTYPE_SCO_INCLUDE,
CSFTYPE_SCORE_OUT,
CSFTYPE_SCOT,
CSFTYPE_OPTIONS,
CSFTYPE_EXTRACT_PARMS,
CSFTYPE_RAW_AUDIO,
CSFTYPE_IRCAM,
CSFTYPE_AIFF,
CSFTYPE_AIFC,
CSFTYPE_WAVE,
CSFTYPE_AU,
CSFTYPE_SD2,
CSFTYPE_W64,
CSFTYPE_WAVEX,
CSFTYPE_FLAC,
CSFTYPE_CAF,
CSFTYPE_WVE,
CSFTYPE_OGG,
CSFTYPE_MPC2K,
CSFTYPE_RF64,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