a68g-sound.h
1 //! @file a68g-sound.h
2 //! @author J. Marcel van der Veer
3
4 //! @section Copyright
5 //!
6 //! This file is part of Algol68G - an Algol 68 interpreter.
7 //! Copyright 2001-2026 J. Marcel van der Veer [algol68g@algol68genie.nl].
8
9 //! @section License
10 //!
11 //! This program is free software; you can redistribute it and/or modify it
12 //! under the terms of the GNU General Public License as published by the
13 //! Free Software Foundation; either version 3 of the License, or
14 //! (at your option) any later version.
15 //!
16 //! This program is distributed in the hope that it will be useful, but
17 //! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 //! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 //! more details. You should have received a copy of the GNU General Public
20 //! License along with this program. If not, see [http://www.gnu.org/licenses/].
21
22 //! @section Synopsis
23 //!
24 //! Definitions for sound support.
25
26 #if !defined (__A68G_SOUND_H__)
27 #define __A68G_SOUND_H__
28
29 #define MAX_BYTES 4
30
31 #undef A68G_LITTLE_ENDIAN
32 #undef A68G_BIG_ENDIAN
33 #if defined (__BYTE_ORDER__)
34 #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
35 #define A68G_LITTLE_ENDIAN A68G_TRUE
36 #define A68G_BIG_ENDIAN A68G_FALSE
37 #elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
38 #define A68G_LITTLE_ENDIAN A68G_FALSE
39 #define A68G_BIG_ENDIAN A68G_TRUE
40 #else
41 #error "undefined endianness"
42 #endif
43 #else
44 #error "undefined endianness"
45 #endif
46
47 // From public Microsoft RIFF documentation.
48
49 #define WAVE_FORMAT_UNKNOWN (0x0000)
50 #define WAVE_FORMAT_PCM (0x0001)
51 #define WAVE_FORMAT_ADPCM (0x0002)
52 #define WAVE_FORMAT_IEEE_FLOAT (0x0003)
53 #define WAVE_FORMAT_IBM_FORMAT_CVSD (0x0005)
54 #define WAVE_FORMAT_ALAW (0x0006)
55 #define WAVE_FORMAT_MULAW (0x0007)
56 #define WAVE_FORMAT_OKI_ADPCM (0x0010)
57 #define WAVE_FORMAT_DVI_ADPCM (0x0011)
58 #define WAVE_FORMAT_MEDIASPACE_ADPCM (0x0012)
59 #define WAVE_FORMAT_SIERRA_ADPCM (0x0013)
60 #define WAVE_FORMAT_G723_ADPCM (0X0014)
61 #define WAVE_FORMAT_DIGISTD (0x0015)
62 #define WAVE_FORMAT_DIGIFIX (0x0016)
63 #define WAVE_FORMAT_YAMAHA_ADPCM (0x0020)
64 #define WAVE_FORMAT_SONARC (0x0021)
65 #define WAVE_FORMAT_DSPGROUP_TRUESPEECH (0x0022)
66 #define WAVE_FORMAT_ECHOSCI1 (0x0023)
67 #define WAVE_FORMAT_AUDIOFILE_AF36 (0x0024)
68 #define WAVE_FORMAT_APTX (0x0025)
69 #define WAVE_FORMAT_AUDIOFILE_AF10 (0x0026)
70 #define WAVE_FORMAT_DOLBY_AC2 (0x0030)
71 #define WAVE_FORMAT_GSM610 (0x0031)
72 #define WAVE_FORMAT_ANTEX_ADPCME (0x0033)
73 #define WAVE_FORMAT_CONTROL_RES_VQLPC (0x0034)
74 #define WAVE_FORMAT_DIGIREAL (0x0035)
75 #define WAVE_FORMAT_DIGIADPCM (0x0036)
76 #define WAVE_FORMAT_CONTROL_RES_CR10 (0x0037)
77 #define WAVE_FORMAT_NMS_VBXADPCM (0x0038)
78 #define WAVE_FORMAT_ROCKWELL_ADPCM (0x003b)
79 #define WAVE_FORMAT_ROCKWELL_DIGITALK (0x003c)
80 #define WAVE_FORMAT_G721_ADPCM (0x0040)
81 #define WAVE_FORMAT_G728_CELP (0x0041)
82 #define WAVE_FORMAT_MPEG (0x0050)
83 #define WAVE_FORMAT_MPEGLAYER3 (0x0055)
84 #define WAVE_FORMAT_G726_ADPCM (0x0064)
85 #define WAVE_FORMAT_G722_ADPCM (0x0065)
86 #define WAVE_FORMAT_IBM_FORMAT_MULAW (0x0101)
87 #define WAVE_FORMAT_IBM_FORMAT_ALAW (0x0102)
88 #define WAVE_FORMAT_IBM_FORMAT_ADPCM (0x0103)
89 #define WAVE_FORMAT_CREATIVE_ADPCM (0x0200)
90 #define WAVE_FORMAT_FM_TOWNS_SND (0x0300)
91 #define WAVE_FORMAT_OLIGSM (0x1000)
92 #define WAVE_FORMAT_OLIADPCM (0x1001)
93 #define WAVE_FORMAT_OLICELP (0x1002)
94 #define WAVE_FORMAT_OLISBC (0x1003)
95 #define WAVE_FORMAT_OLIOPR (0x1004)
96 #define WAVE_FORMAT_EXTENSIBLE (0xfffe)
97
98
99 //! @brief deep copy of a SOUND value.
100
101 static inline void assign_sound (NODE_T *p, A68G_SOUND *dst, A68G_SOUND *src)
102 {
103 COPY ((BYTE_T *) dst, (BYTE_T *) src, SIZE (M_SOUND));
104 BYTE_T *nd = ADDRESS (&(DATA (dst)));
105 BYTE_T *od = ADDRESS (&(DATA (src)));
106 size_t size = A68G_SOUND_DATA_SIZE (src);
107 DATA (dst) = heap_generator (p, M_SOUND_DATA, size);
108 COPY ((BYTE_T *) nd, (BYTE_T *) od, size);
109 }
110
111 #endif
© J.M. van der Veer • jmvdveer@algol68genie.nl