v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
abi/audio.h
1 /* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-
2  *
3  * This file is part of the public interface to the Sifteo SDK.
4  * Copyright <c> 2012 Sifteo, Inc. All rights reserved.
5  */
6 
7 #ifndef _SIFTEO_ABI_AUDIO_H
8 #define _SIFTEO_ABI_AUDIO_H
9 
10 #include <sifteo/abi/types.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 typedef uint8_t _SYSAudioChannelID;
18 
19 #define _SYS_AUDIO_INVALID_CHANNEL_ID ((_SYSAudioChannelID)-1)
20 #define _SYS_AUDIO_MAX_CHANNELS 8
21 
22 #define _SYS_AUDIO_MAX_VOLUME_LOG2 8
23 #define _SYS_AUDIO_MAX_VOLUME (1 << _SYS_AUDIO_MAX_VOLUME_LOG2)
24 #define _SYS_AUDIO_DEFAULT_VOLUME (_SYS_AUDIO_MAX_VOLUME / 2)
25 
26 
27 /*
28  * Types of audio supported by the system
29  */
30 enum _SYSAudioType {
31  _SYS_PCM = 1,
32  _SYS_ADPCM = 2
33 };
34 
35 enum _SYSAudioLoopType {
36  _SYS_LOOP_UNDEF = -1,
37  _SYS_LOOP_ONCE = 0,
38  _SYS_LOOP_REPEAT = 1,
39  _SYS_LOOP_EMULATED_PING_PONG = 2,
40 };
41 
42 struct _SYSAudioModule {
43  uint32_t sampleRate;
44  uint32_t loopStart;
45  uint32_t loopEnd;
46  uint8_t loopType;
47  uint8_t type;
48  uint16_t volume;
49  uint32_t dataSize;
50  uint32_t pData;
51 };
52 
53 struct _SYSXMPattern {
54  uint16_t nRows;
55  uint16_t dataSize;
56  uint32_t pData;
57 };
58 
59 struct _SYSXMInstrument {
60  struct _SYSAudioModule sample;
61  int8_t finetune;
62  int8_t relativeNoteNumber;
63  uint8_t compression;
64 
65  uint32_t volumeEnvelopePoints;
66  uint8_t nVolumeEnvelopePoints;
67  uint8_t volumeSustainPoint;
68  uint8_t volumeLoopStartPoint;
69  uint8_t volumeLoopEndPoint;
70  uint8_t volumeType;
71  uint8_t vibratoType;
72  uint8_t vibratoSweep;
73  uint8_t vibratoDepth;
74  uint8_t vibratoRate;
75  uint16_t volumeFadeout;
76 };
77 
78 struct _SYSXMSong {
79  uint32_t patternOrderTable;
80  uint16_t patternOrderTableSize;
81  uint8_t restartPosition;
82  uint8_t nChannels;
83 
84  uint16_t nPatterns;
85  uint32_t patterns;
86 
87  uint8_t nInstruments;
88  uint32_t instruments;
89 
90  uint8_t frequencyTable;
91  uint16_t tempo;
92  uint16_t bpm;
93 };
94 
95 #ifdef __cplusplus
96 } // extern "C"
97 #endif
98 
99 #endif