using System; namespace sharpallegro { /// /// driver for playing digital sfx /// public class DIGI_DRIVER : ManagedPointer { public DIGI_DRIVER(IntPtr pointer) : base(pointer) { } /// /// driver ID code /// public int id { get { return ReadInt(0); } } /// /// driver name /// public string name { get { return ReadString(sizeof(Int32)); } } /// /// description string /// public string desc { get { return ReadString(2 * sizeof(Int32)); } } /// /// ASCII format name string /// public string ascii_name { get { return ReadString(3 * sizeof(Int32)); } } /// /// available voices /// public int voices { get { return ReadInt(4 * sizeof(Int32)); } } /// /// voice number offset /// public int basevoices { get { return ReadInt(5 * sizeof(Int32)); } } /// /// maximum voices we can support /// public int max_voices { get { return ReadInt(6 * sizeof(Int32)); } } /// /// default number of voices to use /// public int def_voices { get { return ReadInt(7 * sizeof(Int32)); } } public int rec_cap_bits { get { return ReadInt(38 * sizeof(Int32)); } } public int rec_cap_stereo { get { return ReadInt(39 * sizeof(Int32)); } } public static implicit operator DIGI_DRIVER(IntPtr pointer) { return new DIGI_DRIVER(pointer); } } /// /// driver for playing midi music /// public class MIDI_DRIVER : ManagedPointer { public MIDI_DRIVER(IntPtr pointer) : base(pointer) { } /// /// driver ID code /// public int id { get { return ReadInt(0); } } /// /// driver name /// public string name { get { return ReadString(sizeof(Int32)); } } /// /// description string /// public string desc { get { return ReadString(2 * sizeof(Int32)); } } /// /// ASCII format name string /// public string ascii_name { get { return ReadString(3 * sizeof(Int32)); } } /// /// available voices /// public int voices { get { return ReadInt(4 * sizeof(Int32)); } } /// /// voice number offset /// public int basevoice { get { return ReadInt(5 * sizeof(Int32)); } } /// /// maximum voices we can support /// public int max_voices { get { return ReadInt(6 * sizeof(Int32)); } } /// /// default number of voices to use /// public int def_voices { get { return ReadInt(7 * sizeof(Int32)); } } /// /// reserved voice range /// public int xmin { get { return ReadInt(8 * sizeof(Int32)); } } /// /// reserved voice range /// public int xmax { get { return ReadInt(9 * sizeof(Int32)); } } public static implicit operator MIDI_DRIVER(IntPtr pointer) { return new MIDI_DRIVER(pointer); } } /// /// a sample /// public class SAMPLE : ManagedPointer { SAMPLE(IntPtr pointer) : base(pointer) { } /// /// 8 or 16 /// public int bits { get { return ReadInt(0); } } /// /// sample type flag /// public int stereo { get { return ReadInt(sizeof(Int32)); } } /// /// sample frequency /// public int freq { get { return ReadInt(2 * sizeof(Int32)); } } /// /// 0-255 /// public int priority { get { return ReadInt(3 * sizeof(Int32)); } } /// /// length (in samples) /// public ulong len { get { return (ulong)ReadInt(4 * sizeof(Int32)); } } /// /// loop start position /// public ulong loop_start { get { return (ulong)ReadInt(5 * sizeof(Int32)); } } /// /// loop finish position /// public ulong loop_end { get { return (ulong)ReadInt(6 * sizeof(Int32)); } } /// /// for internal use by the driver /// public ulong param { get { return (ulong)ReadInt(7 * sizeof(Int32)); } } /// /// sample data /// public IntPtr data { get { return ReadPointer(8 * sizeof(Int32)); } } public static implicit operator SAMPLE(IntPtr pointer) { return new SAMPLE(pointer); } } public class MIDI_TRACK : ManagedPointer { public MIDI_TRACK(IntPtr pointer) : base(pointer) { } /// /// MIDI message stream /// public IntPtr data { get { return ReadPointer(0); } } /// /// length of the track data /// public int len { get { return ReadInt(sizeof(Int32)); } } } /// /// a midi file /// public class MIDI : ManagedPointer { /* Theoretical maximums: */ const int MIDI_VOICES = 64; /* actual drivers may not be */ const int MIDI_TRACKS = 32; /* able to handle this many */ public MIDI(IntPtr pointer) : base(pointer) { } /// /// number of ticks per quarter note /// public int divisions { get { return ReadInt(0); } } public MIDI_TRACK this[int index] { get { return new MIDI_TRACK(Offset(pointer, 2 * index * sizeof(Int32))); } } public static implicit operator MIDI(IntPtr pointer) { return new MIDI(pointer); } } public class AUDIOSTREAM : ManagedPointer { public AUDIOSTREAM(IntPtr pointer) : base(pointer) { } /// /// the voice we are playing on /// public int voice { get { return ReadInt(0); } } /// /// the sample we are using /// public IntPtr samp { get { return ReadPointer(sizeof(Int32)); } } /// /// buffer length /// public int len { get { return ReadInt(2 * sizeof(Int32)); } } /// /// number of buffers per sample half /// public int bufcount { get { return ReadInt(3 * sizeof(Int32)); } } /// /// current refill buffer /// public int bufnum { get { return ReadInt(4 * sizeof(Int32)); } } /// /// which half is currently playing /// public int active { get { return ReadInt(5 * sizeof(Int32)); } } /// /// the locked buffer /// public IntPtr locked { get { return ReadPointer(6 * sizeof(Int32)); } } public static implicit operator AUDIOSTREAM(IntPtr pointer) { return new AUDIOSTREAM(pointer); } } }