libww libww
WWitch compatibility library for the Wonderful toolchain
Loading...
Searching...
No Matches
sound.h
Go to the documentation of this file.
1#include <sys/types.h>
2
3#ifndef __LIBWW_SYS_SOUND_H__
4#define __LIBWW_SYS_SOUND_H__
5
6/* Begin auto-generated section */
7
11static inline void sound_init(void) {
12 uint16_t result;
13 __asm volatile (
14 "int $0x15"
15 : "=a" (result)
16 : "Rah" ((uint8_t) 0x00)
17 : "cc", "memory"
18 );
19}
20
21static inline void sound_set_channel(uint16_t value) {
22 uint16_t result;
23 __asm volatile (
24 "int $0x15"
25 : "=a" (result)
26 : "b" (value), "Rah" ((uint8_t) 0x01)
27 : "cc", "memory"
28 );
29}
30
31static inline uint16_t sound_get_channel(void) {
32 uint16_t result;
33 __asm volatile (
34 "int $0x15"
35 : "=a" (result)
36 : "Rah" ((uint8_t) 0x02)
37 : "cc", "memory"
38 );
39 return result;
40}
41
42static inline void sound_set_output(uint16_t value) {
43 uint16_t result;
44 __asm volatile (
45 "int $0x15"
46 : "=a" (result)
47 : "b" (value), "Rah" ((uint8_t) 0x03)
48 : "cc", "memory"
49 );
50}
51
52static inline uint16_t sound_get_output(void) {
53 uint16_t result;
54 __asm volatile (
55 "int $0x15"
56 : "=a" (result)
57 : "Rah" ((uint8_t) 0x04)
58 : "cc", "memory"
59 );
60 return result;
61}
62
63void sound_set_wave(uint8_t channel, const void __far* data);
64
65static inline void sound_set_pitch(uint16_t channel, uint16_t value) {
66 uint16_t result;
67 __asm volatile (
68 "int $0x15"
69 : "=a" (result)
70 : "a" ((uint16_t) (((0x06) << 8) | (channel & 0xFF))), "b" (value)
71 : "cc", "memory"
72 );
73}
74
75static inline uint16_t sound_get_pitch(uint16_t channel) {
76 uint16_t result;
77 __asm volatile (
78 "int $0x15"
79 : "=a" (result)
80 : "a" ((uint16_t) (((0x07) << 8) | (channel & 0xFF)))
81 : "cc", "memory"
82 );
83 return result;
84}
85
86static inline void sound_set_volume(uint16_t channel, uint16_t value) {
87 uint16_t result;
88 __asm volatile (
89 "int $0x15"
90 : "=a" (result)
91 : "a" ((uint16_t) (((0x08) << 8) | (channel & 0xFF))), "b" (value)
92 : "cc", "memory"
93 );
94}
95
96static inline uint16_t sound_get_volume(uint16_t channel) {
97 uint16_t result;
98 __asm volatile (
99 "int $0x15"
100 : "=a" (result)
101 : "a" ((uint16_t) (((0x09) << 8) | (channel & 0xFF)))
102 : "cc", "memory"
103 );
104 return result;
105}
106
107static inline void sound_set_sweep(uint8_t sweep, uint8_t step_time) {
108 uint16_t result;
109 __asm volatile (
110 "int $0x15"
111 : "=a" (result)
112 : "b" (sweep), "c" (step_time), "Rah" ((uint8_t) 0x0A)
113 : "cc", "memory"
114 );
115}
116
117static inline uint16_t sound_get_sweep(void) {
118 uint16_t result;
119 __asm volatile (
120 "int $0x15"
121 : "=a" (result)
122 : "Rah" ((uint8_t) 0x0B)
123 : "cc", "memory"
124 );
125 return result;
126}
127
128static inline void sound_set_noise(uint16_t value) {
129 uint16_t result;
130 __asm volatile (
131 "int $0x15"
132 : "=a" (result)
133 : "b" (value), "Rah" ((uint8_t) 0x0C)
134 : "cc", "memory"
135 );
136}
137
138static inline uint16_t sound_get_noise(void) {
139 uint16_t result;
140 __asm volatile (
141 "int $0x15"
142 : "=a" (result)
143 : "Rah" ((uint8_t) 0x0D)
144 : "cc", "memory"
145 );
146 return result;
147}
148
149static inline uint16_t sound_get_random(void) {
150 uint16_t result;
151 __asm volatile (
152 "int $0x15"
153 : "=a" (result)
154 : "Rah" ((uint8_t) 0x0E)
155 : "cc", "memory"
156 );
157 return result;
158}
159
160
161/* 0% volume (muted) */
162#define SOUND_VOICE_MUTE 0
163/* 50% volume */
164#define SOUND_VOICE_HALF 2
165/* 100% volume */
166#define SOUND_VOICE_FULL 3
167
173void sound_set_voice_volume(uint8_t left, uint8_t right);
174
180
181/* End auto-generated section */
182
183
184#endif /* __LIBWW_SYS_SOUND_H__ */
static uint16_t sound_get_volume(uint16_t channel)
Definition sound.h:96
static uint16_t sound_get_output(void)
Definition sound.h:52
static void sound_set_volume(uint16_t channel, uint16_t value)
Definition sound.h:86
static void sound_set_noise(uint16_t value)
Definition sound.h:128
static uint16_t sound_get_random(void)
Definition sound.h:149
static void sound_set_sweep(uint8_t sweep, uint8_t step_time)
Definition sound.h:107
void sound_set_wave(uint8_t channel, const void __far *data)
static uint16_t sound_get_channel(void)
Definition sound.h:31
static uint16_t sound_get_sweep(void)
Definition sound.h:117
static void sound_init(void)
Definition sound.h:11
uint8_t sound_get_voice_volume(void)
static uint16_t sound_get_noise(void)
Definition sound.h:138
static uint16_t sound_get_pitch(uint16_t channel)
Definition sound.h:75
static void sound_set_channel(uint16_t value)
Definition sound.h:21
static void sound_set_pitch(uint16_t channel, uint16_t value)
Definition sound.h:65
static void sound_set_output(uint16_t value)
Definition sound.h:42
void sound_set_voice_volume(uint8_t left, uint8_t right)