Browse Source

Update DUMB to version 2.0.0.

master
Christopher Snowhill 2 years ago
parent
commit
47a6afe62c
100 changed files with 18814 additions and 19198 deletions
  1. +35
    -22
      Frameworks/Dumb/dumb/CHANGELOG.md
  2. +35
    -0
      Frameworks/Dumb/dumb/COMPILING.md
  3. +226
    -0
      Frameworks/Dumb/dumb/DUMBFILE_SYSTEM.md
  4. +96
    -0
      Frameworks/Dumb/dumb/README.md
  5. +393
    -395
      Frameworks/Dumb/dumb/include/dumb.h
  6. +0
    -2
      Frameworks/Dumb/dumb/include/internal/aldumb.h
  7. +26
    -26
      Frameworks/Dumb/dumb/include/internal/barray.h
  8. +33
    -30
      Frameworks/Dumb/dumb/include/internal/dumb.h
  9. +12
    -13
      Frameworks/Dumb/dumb/include/internal/dumbfile.h
  10. +0
    -18
      Frameworks/Dumb/dumb/include/internal/fir_resampler.h
  11. +563
    -615
      Frameworks/Dumb/dumb/include/internal/it.h
  12. +32
    -24
      Frameworks/Dumb/dumb/include/internal/resampler.h
  13. +10
    -12
      Frameworks/Dumb/dumb/include/internal/riff.h
  14. +17
    -12
      Frameworks/Dumb/dumb/include/internal/stack_alloc.h
  15. +9
    -20
      Frameworks/Dumb/dumb/include/internal/tarray.h
  16. +0
    -77
      Frameworks/Dumb/dumb/licence.txt
  17. +0
    -541
      Frameworks/Dumb/dumb/readme.txt
  18. +25
    -36
      Frameworks/Dumb/dumb/src/core/atexit.c
  19. +4
    -12
      Frameworks/Dumb/dumb/src/core/duhlen.c
  20. +20
    -25
      Frameworks/Dumb/dumb/src/core/duhtag.c
  21. +242
    -288
      Frameworks/Dumb/dumb/src/core/dumbfile.c
  22. +8
    -11
      Frameworks/Dumb/dumb/src/core/loadduh.c
  23. +106
    -111
      Frameworks/Dumb/dumb/src/core/makeduh.c
  24. +25
    -30
      Frameworks/Dumb/dumb/src/core/rawsig.c
  25. +71
    -77
      Frameworks/Dumb/dumb/src/core/readduh.c
  26. +45
    -53
      Frameworks/Dumb/dumb/src/core/register.c
  27. +181
    -251
      Frameworks/Dumb/dumb/src/core/rendduh.c
  28. +131
    -241
      Frameworks/Dumb/dumb/src/core/rendsig.c
  29. +24
    -30
      Frameworks/Dumb/dumb/src/core/unload.c
  30. +118
    -152
      Frameworks/Dumb/dumb/src/helpers/barray.c
  31. +195
    -219
      Frameworks/Dumb/dumb/src/helpers/clickrem.c
  32. +0
    -281
      Frameworks/Dumb/dumb/src/helpers/fir_resampler.c
  33. +191
    -191
      Frameworks/Dumb/dumb/src/helpers/lpc.c
  34. +52
    -75
      Frameworks/Dumb/dumb/src/helpers/memfile.c
  35. +89
    -73
      Frameworks/Dumb/dumb/src/helpers/resamp2.inc
  36. +197
    -177
      Frameworks/Dumb/dumb/src/helpers/resamp3.inc
  37. +168
    -166
      Frameworks/Dumb/dumb/src/helpers/resample.c
  38. +216
    -184
      Frameworks/Dumb/dumb/src/helpers/resample.inc
  39. +604
    -686
      Frameworks/Dumb/dumb/src/helpers/resampler.c
  40. +68
    -65
      Frameworks/Dumb/dumb/src/helpers/riff.c
  41. +18
    -39
      Frameworks/Dumb/dumb/src/helpers/sampbuf.c
  42. +2
    -6
      Frameworks/Dumb/dumb/src/helpers/silence.c
  43. +51
    -89
      Frameworks/Dumb/dumb/src/helpers/stdfile.c
  44. +113
    -108
      Frameworks/Dumb/dumb/src/helpers/tarray.c
  45. +8
    -12
      Frameworks/Dumb/dumb/src/it/itload.c
  46. +4
    -7
      Frameworks/Dumb/dumb/src/it/itload2.c
  47. +86
    -166
      Frameworks/Dumb/dumb/src/it/itmisc.c
  48. +30
    -32
      Frameworks/Dumb/dumb/src/it/itorder.c
  49. +1225
    -1198
      Frameworks/Dumb/dumb/src/it/itread.c
  50. +4
    -7
      Frameworks/Dumb/dumb/src/it/itread2.c
  51. +5699
    -5227
      Frameworks/Dumb/dumb/src/it/itrender.c
  52. +35
    -38
      Frameworks/Dumb/dumb/src/it/itunload.c
  53. +8
    -11
      Frameworks/Dumb/dumb/src/it/load669.c
  54. +4
    -7
      Frameworks/Dumb/dumb/src/it/load6692.c
  55. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadamf.c
  56. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadamf2.c
  57. +7
    -10
      Frameworks/Dumb/dumb/src/it/loadany.c
  58. +3
    -6
      Frameworks/Dumb/dumb/src/it/loadany2.c
  59. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadasy.c
  60. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadasy2.c
  61. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadmod.c
  62. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadmod2.c
  63. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadmtm.c
  64. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadmtm2.c
  65. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadokt.c
  66. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadokt2.c
  67. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadoldpsm.c
  68. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadoldpsm2.c
  69. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadpsm.c
  70. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadpsm2.c
  71. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadptm.c
  72. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadptm2.c
  73. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadriff.c
  74. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadriff2.c
  75. +8
    -11
      Frameworks/Dumb/dumb/src/it/loads3m.c
  76. +4
    -7
      Frameworks/Dumb/dumb/src/it/loads3m2.c
  77. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadstm.c
  78. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadstm2.c
  79. +8
    -11
      Frameworks/Dumb/dumb/src/it/loadxm.c
  80. +4
    -7
      Frameworks/Dumb/dumb/src/it/loadxm2.c
  81. +148
    -99
      Frameworks/Dumb/dumb/src/it/ptmeffect.c
  82. +369
    -366
      Frameworks/Dumb/dumb/src/it/read669.c
  83. +26
    -29
      Frameworks/Dumb/dumb/src/it/read6692.c
  84. +714
    -701
      Frameworks/Dumb/dumb/src/it/readam.c
  85. +526
    -494
      Frameworks/Dumb/dumb/src/it/readamf.c
  86. +4
    -7
      Frameworks/Dumb/dumb/src/it/readamf2.c
  87. +103
    -132
      Frameworks/Dumb/dumb/src/it/readany.c
  88. +3
    -6
      Frameworks/Dumb/dumb/src/it/readany2.c
  89. +288
    -286
      Frameworks/Dumb/dumb/src/it/readasy.c
  90. +331
    -324
      Frameworks/Dumb/dumb/src/it/readdsmf.c
  91. +541
    -531
      Frameworks/Dumb/dumb/src/it/readmod.c
  92. +4
    -7
      Frameworks/Dumb/dumb/src/it/readmod2.c
  93. +383
    -358
      Frameworks/Dumb/dumb/src/it/readmtm.c
  94. +531
    -487
      Frameworks/Dumb/dumb/src/it/readokt.c
  95. +4
    -7
      Frameworks/Dumb/dumb/src/it/readokt2.c
  96. +674
    -624
      Frameworks/Dumb/dumb/src/it/readoldpsm.c
  97. +1280
    -1161
      Frameworks/Dumb/dumb/src/it/readpsm.c
  98. +476
    -469
      Frameworks/Dumb/dumb/src/it/readptm.c
  99. +21
    -20
      Frameworks/Dumb/dumb/src/it/readriff.c
  100. +680
    -670
      Frameworks/Dumb/dumb/src/it/reads3m.c

Frameworks/Dumb/dumb/release.txt → Frameworks/Dumb/dumb/CHANGELOG.md View File

@@ -1,3 +1,4 @@
```
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
@@ -8,7 +9,7 @@
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* release.txt - Release notes for DUMB. / / \ \
* CHANGELOG.md - Release notes for DUMB. / / \ \
* | < / \_
* | \/ /\ /
* \_ / > /
@@ -16,11 +17,35 @@
* | ' /
* \__/
*/
```

# DUMB Changelog

*******************************************
*** DUMB v0.9.3, released 7 August 2005 ***
*******************************************
## v2.0.0, released 26 September 2017

* Memory leak and bug fixes
* Audio playback quality improvements for STM
* Added support for FEST MOD files
* Default resampling quality is now cubic
* Allegro 4 support
* New dumbplay, dumbout examples
* Multiple cmake fixes
* Deprecated `duh_render()`, use `duh_render_float()` and `duh_render_int()`
* Removed API deprecated since 0.9.3, see the
[DUMB 0.9.3 deprecation reference](http://dumb.sourceforge.net/index.php?page=docs&doc=deprec)

## v1.0.0, released 17 January 2015

* Support newer compilers
* Better audio playback quality
* More supported formats
* SSE optimizations support
* CMake support
* New resamplers
* Seek support
* Fixes, cleanups, speedups.

## v0.9.3, released 7 August 2005

Hello! Welcome to a long-awaited-or-probably-just-given-up-on-by-everybody
release! New to this release are lower memory usage, faster mixing loops,
@@ -173,9 +198,7 @@ That's it! I hope you enjoy this long-awaited-or-probably-just-given-up-on-
by-everybody release of DUMB!


******************************************
*** DUMB v0.9.2, released 2 April 2003 ***
******************************************
## v0.9.2, released 2 April 2003

Yes, there really has been a release. This is not a day-late April fools'
joke.
@@ -272,9 +295,7 @@ explained in licence.txt. However, the request is still there ...
As usual, enjoy!


**********************************************
*** DUMB v0.9.1, released 19 December 2002 ***
**********************************************
## v0.9.1, released 19 December 2002

Hi again! Lots to say this time, so I shall cut right to the chase.

@@ -355,9 +376,7 @@ the last release; they are relevant for this release too.
That's all folks! Until next time.


*******************************************
*** DUMB v0.9, released 16 October 2002 ***
*******************************************
## v0.9, released 16 October 2002

MOD support is here! DUMB now supports all four of the common module formats.
As usual, there have also been some improvements to the way modules are
@@ -431,9 +450,7 @@ Off you go.
Bye.


********************************************
*** DUMB v0.8.1, released 11 August 2002 ***
********************************************
## v0.8.1, released 11 August 2002

This is a minor release that fixes a few bugs. One of these bugs, however,
was pretty serious. dumb_register_dat_xm() was never coded! It was prototyped
@@ -487,9 +504,7 @@ The point about length not being calculated also applies to XM files.
Enjoy :)


****************************************
*** DUMB v0.8, released 14 June 2002 ***
****************************************
## v0.8, released 14 June 2002

Welcome to the second release of DUMB!

@@ -530,9 +545,7 @@ going myself (72 GBP, and I'd have to wear a suit, ugh), but with all the
noise outside I shall enjoy pumping up the speakers tonight!


****************************************
*** DUMB v0.7, released 2 March 2002 ***
****************************************
## DUMB v0.7, released 2 March 2002

This is the first release of DUMB, and parts of the library are not
crystallised. Don't let this put you off! Provided you don't try to use any

+ 35
- 0
Frameworks/Dumb/dumb/COMPILING.md View File

@@ -0,0 +1,35 @@
# Compiling

## 1. CMake

### 1.1. Example

In libdumb project root, run:
```
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_ALLEGRO4:BOOL=ON ..
make
make install
```

### 1.2. Steps

1. Create a new temporary build directory and cd into it
2. Run libdumb cmake file with cmake (eg. `cmake -DCMAKE_INSTALL_PREFIX=/install/dir -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE=Release path/to/dumb/cmake/dir`).
3. Run make (eg. just `make` or `mingw32-make` or something).
4. If needed, run make install.

### 1.3. Flags

* `CMAKE_INSTALL_PREFIX` sets the installation path prefix.
* `CMAKE_BUILD_TYPE` chooses the build type: `Release`, `Debug`, `RelWithDebInfo`, or `MinSizeRel`. Debug libraries will be named `libdumbd`, release libraries `libdumb`. Default is `Release`.
* `BUILD_SHARED_LIBS` selects whether cmake should build a dynamic (`ON`) or static (`OFF`) library. Default is `OFF`.
* `BUILD_ALLEGRO4` enables (`ON`) or disables (`OFF`) the optional Allegro 4 support. This requires Allegro 4 installed on the system. Default is `ON`.
* `BUILD_EXAMPLES` selects example binaries. These example binaries require argtable2 and SDL2 libraries. Default is `ON`.
* `USE_SSE` enables or disables SSE support. Default is `ON`.
* You may also need to tell cmake what kind of makefiles to create with the "-G" flag. Eg. for MSYS one would say something like `cmake -G "MSYS Makefiles" .`.

## 2. Visual Studio

TODO

+ 226
- 0
Frameworks/Dumb/dumb/DUMBFILE_SYSTEM.md View File

@@ -0,0 +1,226 @@
Specification of DUMBFILE_SYSTEM
================================

DUMB is designed filesystem-agnostic, even though the C standard library
already defines an abstraction over files on a disk. This is useful because
Allegro 4 and 5 define their own abstractions.

To register your own filesystem abstraction with DUMB, you must create an
instance of struct `DUMBFILE_SYSTEM`, fill in your own function pointers
according to the specification below, and call `register_dumbfile_system` on
your instance.

The header `dumb.h` defines `DUMBFILE_SYSTEM` as a struct of function pointers:

```
typedef struct DUMBFILE_SYSTEM
{
void *(*open)(const char *filename);
int (*skip)(void *f, dumb_off_t n);
int (*getc)(void *f);
dumb_ssize_t (*getnc)(char *ptr, size_t n, void *f);
void (*close)(void *f);
int (*seek)(void *f, dumb_off_t n);
dumb_off_t (*get_size)(void *f);
}
DUMBFILE_SYSTEM;
```

Here, `dumb_off_t` is a signed integer at least 64 bits wide, it is intended
to measure file offsets. The return type `dumb_ssize_t` is a signed integer
exactly as wide as `size_t`, it is intended to store either a `size_t` or a
negative error code. Both `dumb_*_t` are defined in `dumb.h`.

The function pointers `skip` and `getnc` are optional, i.e., you may set
some of these to `NULL` in your struct instance. DUMB will then try to
mimick the missing functions' behavior by calling your `getc` several times.
If DUMB is built with debugging flags, it will assert that all other
functions are not `NULL`. In release mode, DUMB will silently fail.

Your non-`NULL` function pointers must conform to the following specification.



open
----

```
void *(*open)(const char *filename);
```

Open a file for reading.

Arguments:

* `const char *filename`: A normal filename as understood by the operating
system. Will be opened for reading.

Returns as `void *`:

* the address of a file handle on successfully opening the file.
DUMB will pass this file handle as argument to other functions of
the `DUMBFILE_SYSTEM`.

* `NULL` on error during opening the file.

Each file has a *position* internally managed by DUMB. A newly opened file
has a position of 0. Other functions from the `DUMBFILE_SYSTEM` can move
this position around.

DUMB allocates memory for the successfully opened file, and will store opaque
information in that memory, e.g., the DUMB-internal file position. This memory
be freed when DUMB calls `close` on the file's handle. The memory is separate
from your own filesystem implementation: You are responsible for supplying the
data, and DUMB is responsible for storing anything about interpreting that
data.



skip
----

```
int (*skip)(void *f, dumb_off_t n);
```

Advance the position in the file.

Arguments:

* `void *f`: A file handle that `open` returned. Guaranteed non-`NULL`.

* `dumb_off_t n`: Number of bytes to advance in the file. DUMB will only
call this with `n >= 0`. For `n < 0`, the behavior of `skip` is undefined.

Returns as `int`:

* `0` on successfully skipping ahead by `n` bytes.

* `-1` on error.

It is legal to set `skip = NULL` in a `DUMBFILE_SYSTEM`. DUMB will then call
`getc` a total of `n` times to skip ahead in a file. For speed, it is
advisable to supply a proper `skip` implementation.



getc
----

```
int (*getc)(void *f);
```

Read a byte from the file.

Arguments:

* `void *f`: A file handle that `open` returned. Guaranteed non-`NULL`.

Returns as `int`:

* the value of the byte read, on successfully reading one byte.

* `-1` on error.

After a succesful read, DUMB will treat the file as advanced by one byte.



getnc
-----

```
dumb_ssize_t (*getnc)(char *ptr, size_t n, void *f);
```

Read up to the given number of bytes from the file into a given buffer.

* `char *ptr`: The start of a buffer provided by DUMB.

* `size_t n`: The length of the number of bytes to be read.

* `void *f`: A file handle that `open` returned. Guaranteed non-`NULL`.

Returns as `dumb_ssize_t`:

* the number of bytes successfully read, if it was possible to read at least
one byte.

* `-1` on error.

This function shall bytes from the file `f` and store them in sequence in the
buffer beginning at `ptr`. It shall read fewer than `n` bytes if end of file
is encountered before `n` bytes could have been read, otherwise it should read
`n` bytes.

It is legal to set `skip = NULL` in a `DUMBFILE_SYSTEM`. DUMB will then call
`getc` a total of `n` times and store the results in its buffer.



close
-----

```
void (*close)(void *f);
```

Closes a file that has been opened before with `open`.

Arguments:

* `void *f`: A file handle that `open` returned. Guaranteed non-`NULL`.

DUMB will deallocate the memory that it used to interpret the file. You are
free to treat your resource however you would like: You may deallocate it, or
keep it around for other things. For example, Allegro 5's implementation
of `close` takes a void pointer and does nothing with it at all.



seek
----

```
int (*seek)(void *f, dumb_off_t n);
```

Jump to an arbitrary position in the file.

Arguments:

* `void *f`: A file handle that `open` returned. Guaranteed non-`NULL`.

* `dumb_off_t n`: The position in the file, relative to the beginning.
There is no guarantee whether `n >= 0`.

Returns as `int`:

* `0` on successfully seeking in the file.

* `-1` on error.

DUMB will modify its internal position of the file accordingly.

A value of `n < 0` shall set the file into an erroneous state from which no
bytes can be read.



get_size
--------

```
dumb_off_t (*get_size)(void *f);
```

Get the length in bytes, i.e., the position after the final byte, of a file.

Arguments:

* `void *f`: A file handle that `open` returned. Guaranteed non-`NULL`.

Returns as `dumb_off_t`:

* the length of the file in bytes.

+ 96
- 0
Frameworks/Dumb/dumb/README.md View File

@@ -0,0 +1,96 @@
# Dynamic Universal Music Bibliotheque (libdumb)

_______ ____ __ ___ ___
\ _ \ \ / \ / \ \ / / ' ' '
| | \ \ | | || | \/ | . .
| | | | | | || ||\ /| |
| | | | | | || || \/ | | ' ' '
| | | | | | || || | | . .
| |_/ / \ \__// || | |
/_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
/ \
/ . \
/ / \ \
| < / \_
| \/ /\ /
\_ / > /
| \ / /
| ' /
\__/



## Introduction

DUMB is a module audio renderer library. It reads module files and
outputs audio that can be dumped to the actual audio playback library.

This is a fork of the original dumb (http://dumb.sf.net/) by Ben Davis.

## Features

- Supports playback of the following module formats. The tracker software or
library the format is known for is given in parentheses. This does not mean
that DUMB does not support files created by other trackers provided that they
output files in one of those formats.

* IT (Impulse Tracker)
* XM (Fasttracker II)
* MOD (Ultimate SoundTracker, ProTracker)
* STM (Scream Tracker)
* S3M (Scream Tracker 3)
* 669 (Composer 669)
* AMF Asylum Music Format
* AMF Digital Sound and Music Interface Advanced Music Format
* DSM Digital Sound Interface Kit module format
* MTM (MultiTracker)
* OKT (Oktalyzer)
* PSM (Protracker Studio)
Both the older PSM16 and the newer PSM format is supported.
* PTM (PolyTracker)
* RIFF AM/AMFF (Galaxy Music System internal format)

- Audio generated can be used in any way; DUMB does not necessarily send it
straight to a sound output system

- Portable

- Faithful to the original trackers, especially IT; if it plays a module
wrongly, it is considered a bug

- Accurate support for low-pass resonant filters for IT files

- Very accurate timing and pitching; completely deterministic playback

- Click removal

- Six resampling quality settings: aliasing, aliasing with bandwidth limiting,
linear interpolation, linear interpolation with bandwidth limiting, cubic
interpolation, and a compile-time-configurable fast sinc resampler

- Number of samples playing at once can be limited to reduce processor usage,
but samples will come back in when other louder ones stop

- Option to take longer loading but seek fast to any point before the music
first loops (seeking time increases beyond this point)

- All notes will be present and correct even if a module's playback is started
in the middle

- Optional Allegro 4 or Allegro 5 integration support

- Facility to embed music files in other files (e.g. Allegro datafiles)


## Installation

Currently you need to compile libdumb yourself. For more details, please see
the file [COMPILING.md](COMPILING.md).

## License

See [LICENSE](LICENSE) for license details.

## Contributing

Bugs, feature requests and patches can be submitted at https://github.com/kode54/dumb/.

+ 393
- 395
Frameworks/Dumb/dumb/include/dumb.h
File diff suppressed because it is too large
View File


+ 0
- 2
Frameworks/Dumb/dumb/include/internal/aldumb.h View File

@@ -20,8 +20,6 @@
#ifndef INTERNAL_ALDUMB_H
#define INTERNAL_ALDUMB_H
void _dat_unload_duh(void *duh);
#endif /* INTERNAL_DUMB_H */

+ 26
- 26
Frameworks/Dumb/dumb/include/internal/barray.h View File

@@ -6,38 +6,38 @@
#ifdef BARRAY_DECORATE
#undef PASTE
#undef EVALUATE
#define PASTE(a,b) a ## b
#define EVALUATE(a,b) PASTE(a,b)
#define bit_array_create EVALUATE(BARRAY_DECORATE,_bit_array_create)
#define bit_array_destroy EVALUATE(BARRAY_DECORATE,_bit_array_destroy)
#define bit_array_dup EVALUATE(BARRAY_DECORATE,_bit_array_dup)
#define bit_array_reset EVALUATE(BARRAY_DECORATE,_bit_array_reset)
#define bit_array_set EVALUATE(BARRAY_DECORATE,_bit_array_set)
#define bit_array_set_range EVALUATE(BARRAY_DECORATE,_bit_array_set_range)
#define bit_array_test EVALUATE(BARRAY_DECORATE,_bit_array_test)
#define bit_array_test_range EVALUATE(BARRAY_DECORATE,_bit_array_test_range)
#define bit_array_clear EVALUATE(BARRAY_DECORATE,_bit_array_clear)
#define bit_array_clear_range EVALUATE(BARRAY_DECORATE,_bit_array_clear_range)
#define bit_array_merge EVALUATE(BARRAY_DECORATE,_bit_array_merge)
#define bit_array_mask EVALUATE(BARRAY_DECORATE,_bit_array_mask)
#define PASTE(a, b) a##b
#define EVALUATE(a, b) PASTE(a, b)
#define bit_array_create EVALUATE(BARRAY_DECORATE, _bit_array_create)
#define bit_array_destroy EVALUATE(BARRAY_DECORATE, _bit_array_destroy)
#define bit_array_dup EVALUATE(BARRAY_DECORATE, _bit_array_dup)
#define bit_array_reset EVALUATE(BARRAY_DECORATE, _bit_array_reset)
#define bit_array_set EVALUATE(BARRAY_DECORATE, _bit_array_set)
#define bit_array_set_range EVALUATE(BARRAY_DECORATE, _bit_array_set_range)
#define bit_array_test EVALUATE(BARRAY_DECORATE, _bit_array_test)
#define bit_array_test_range EVALUATE(BARRAY_DECORATE, _bit_array_test_range)
#define bit_array_clear EVALUATE(BARRAY_DECORATE, _bit_array_clear)
#define bit_array_clear_range EVALUATE(BARRAY_DECORATE, _bit_array_clear_range)
#define bit_array_merge EVALUATE(BARRAY_DECORATE, _bit_array_merge)
#define bit_array_mask EVALUATE(BARRAY_DECORATE, _bit_array_mask)
#endif
void * bit_array_create(size_t size);
void bit_array_destroy(void * array);
void * bit_array_dup(void * array);
void *bit_array_create(size_t size);
void bit_array_destroy(void *array);
void *bit_array_dup(void *array);
void bit_array_reset(void * array);
void bit_array_reset(void *array);
void bit_array_set(void * array, size_t bit);
void bit_array_set_range(void * array, size_t bit, size_t count);
void bit_array_set(void *array, size_t bit);
void bit_array_set_range(void *array, size_t bit, size_t count);
int bit_array_test(void * array, size_t bit);
int bit_array_test_range(void * array, size_t bit, size_t count);
int bit_array_test(void *array, size_t bit);
int bit_array_test_range(void *array, size_t bit, size_t count);
void bit_array_clear(void * array, size_t bit);
void bit_array_clear_range(void * array, size_t bit, size_t count);
void bit_array_clear(void *array, size_t bit);
void bit_array_clear_range(void *array, size_t bit, size_t count);
void bit_array_merge(void * array, void * source, size_t offset);
void bit_array_mask(void * array, void * source, size_t offset);
void bit_array_merge(void *array, void *source, size_t offset);
void bit_array_mask(void *array, void *source, size_t offset);
#endif

+ 33
- 30
Frameworks/Dumb/dumb/include/internal/dumb.h View File

@@ -26,47 +26,50 @@
#ifndef INTERNAL_DUMB_H
#define INTERNAL_DUMB_H
#include "../dumb.h"
#undef MIN
#undef MAX
#undef MID
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#define MID(x,y,z) MAX((x), MIN((y), (z)))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MID(x, y, z) MAX((x), MIN((y), (z)))
#undef ABS
#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
typedef struct DUH_SIGTYPE_DESC_LINK
{
struct DUH_SIGTYPE_DESC_LINK *next;
DUH_SIGTYPE_DESC *desc;
}
DUH_SIGTYPE_DESC_LINK;
typedef struct DUH_SIGNAL
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *desc;
}
DUH_SIGNAL;
struct DUH
{
long length;
int n_tags;
char *(*tag)[2];
int n_signals;
DUH_SIGNAL **signal;
#ifndef LONG_LONG
#if defined __GNUC__ || defined __INTEL_COMPILER || defined __MWERKS__ || \
defined __sgi
#define LONG_LONG long long
#elif defined _MSC_VER || defined __WATCOMC__
#define LONG_LONG __int64
#else
#error 64-bit integer type unknown
#endif
#endif
typedef struct DUH_SIGTYPE_DESC_LINK {
struct DUH_SIGTYPE_DESC_LINK *next;
DUH_SIGTYPE_DESC *desc;
} DUH_SIGTYPE_DESC_LINK;
typedef struct DUH_SIGNAL {
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *desc;
} DUH_SIGNAL;
struct DUH {
dumb_off_t length;
int n_tags;
char *(*tag)[2];
int n_signals;
DUH_SIGNAL **signal;
};
DUH_SIGTYPE_DESC *_dumb_get_sigtype_desc(long type);
#endif /* INTERNAL_DUMB_H */

+ 12
- 13
Frameworks/Dumb/dumb/include/internal/dumbfile.h View File

@@ -1,13 +1,12 @@
#ifndef DUMBFILE_H
#define DUMBFILE_H

#include "../dumb.h"

struct DUMBFILE
{
const DUMBFILE_SYSTEM *dfs;
void *file;
long pos;
};

#endif // DUMBFILE_H
#ifndef DUMBFILE_H
#define DUMBFILE_H
#include "../dumb.h"
struct DUMBFILE {
const DUMBFILE_SYSTEM *dfs;
void *file;
long pos;
};
#endif // DUMBFILE_H

+ 0
- 18
Frameworks/Dumb/dumb/include/internal/fir_resampler.h View File

@@ -1,18 +0,0 @@
#ifndef _FIR_RESAMPLER_H_
#define _FIR_RESAMPLER_H_

void fir_init();

void * fir_resampler_create();
void fir_resampler_delete(void *);
void * fir_resampler_dup(void *);

int fir_resampler_get_free_count(void *);
void fir_resampler_write_sample(void *, short sample);
void fir_resampler_set_rate( void *, double new_factor );
int fir_resampler_ready(void *);
void fir_resampler_clear(void *);
int fir_resampler_get_sample(void *);
void fir_resampler_remove_sample(void *);

#endif

+ 563
- 615
Frameworks/Dumb/dumb/include/internal/it.h
File diff suppressed because it is too large
View File


+ 32
- 24
Frameworks/Dumb/dumb/include/internal/resampler.h View File

@@ -5,36 +5,44 @@
#ifdef RESAMPLER_DECORATE
#undef PASTE
#undef EVALUATE
#define PASTE(a,b) a ## b
#define EVALUATE(a,b) PASTE(a,b)
#define resampler_init EVALUATE(RESAMPLER_DECORATE,_resampler_init)
#define resampler_create EVALUATE(RESAMPLER_DECORATE,_resampler_create)
#define resampler_delete EVALUATE(RESAMPLER_DECORATE,_resampler_delete)
#define resampler_dup EVALUATE(RESAMPLER_DECORATE,_resampler_dup)
#define resampler_dup_inplace EVALUATE(RESAMPLER_DECORATE,_resampler_dup_inplace)
#define resampler_set_quality EVALUATE(RESAMPLER_DECORATE,_resampler_set_quality)
#define resampler_get_free_count EVALUATE(RESAMPLER_DECORATE,_resampler_get_free_count)
#define resampler_write_sample EVALUATE(RESAMPLER_DECORATE,_resampler_write_sample)
#define resampler_write_sample_fixed EVALUATE(RESAMPLER_DECORATE,_resampler_write_sample_fixed)
#define resampler_write_sample_float EVALUATE(RESAMPLER_DECORATE,_resampler_write_sample_float)
#define resampler_set_rate EVALUATE(RESAMPLER_DECORATE,_resampler_set_rate)
#define resampler_ready EVALUATE(RESAMPLER_DECORATE,_resampler_ready)
#define resampler_clear EVALUATE(RESAMPLER_DECORATE,_resampler_clear)
#define resampler_get_sample_count EVALUATE(RESAMPLER_DECORATE,_resampler_get_sample_count)
#define resampler_get_sample EVALUATE(RESAMPLER_DECORATE,_resampler_get_sample)
#define resampler_get_sample_float EVALUATE(RESAMPLER_DECORATE,_resampler_get_sample_float)
#define resampler_remove_sample EVALUATE(RESAMPLER_DECORATE,_resampler_remove_sample)
#define PASTE(a, b) a##b
#define EVALUATE(a, b) PASTE(a, b)
#define resampler_init EVALUATE(RESAMPLER_DECORATE, _resampler_init)
#define resampler_create EVALUATE(RESAMPLER_DECORATE, _resampler_create)
#define resampler_delete EVALUATE(RESAMPLER_DECORATE, _resampler_delete)
#define resampler_dup EVALUATE(RESAMPLER_DECORATE, _resampler_dup)
#define resampler_dup_inplace \
EVALUATE(RESAMPLER_DECORATE, _resampler_dup_inplace)
#define resampler_set_quality \
EVALUATE(RESAMPLER_DECORATE, _resampler_set_quality)
#define resampler_get_free_count \
EVALUATE(RESAMPLER_DECORATE, _resampler_get_free_count)
#define resampler_write_sample \
EVALUATE(RESAMPLER_DECORATE, _resampler_write_sample)
#define resampler_write_sample_fixed \
EVALUATE(RESAMPLER_DECORATE, _resampler_write_sample_fixed)
#define resampler_write_sample_float \
EVALUATE(RESAMPLER_DECORATE, _resampler_write_sample_float)
#define resampler_set_rate EVALUATE(RESAMPLER_DECORATE, _resampler_set_rate)
#define resampler_ready EVALUATE(RESAMPLER_DECORATE, _resampler_ready)
#define resampler_clear EVALUATE(RESAMPLER_DECORATE, _resampler_clear)
#define resampler_get_sample_count \
EVALUATE(RESAMPLER_DECORATE, _resampler_get_sample_count)
#define resampler_get_sample EVALUATE(RESAMPLER_DECORATE, _resampler_get_sample)
#define resampler_get_sample_float \
EVALUATE(RESAMPLER_DECORATE, _resampler_get_sample_float)
#define resampler_remove_sample \
EVALUATE(RESAMPLER_DECORATE, _resampler_remove_sample)
#endif
void resampler_init(void);
void * resampler_create(void);
void *resampler_create(void);
void resampler_delete(void *);
void * resampler_dup(const void *);
void *resampler_dup(const void *);
void resampler_dup_inplace(void *, const void *);
enum
{
enum {
RESAMPLER_QUALITY_MIN = 0,
RESAMPLER_QUALITY_ZOH = 0,
RESAMPLER_QUALITY_BLEP = 1,
@@ -51,7 +59,7 @@ int resampler_get_free_count(void *);
void resampler_write_sample(void *, short sample);
void resampler_write_sample_fixed(void *, int sample, unsigned char depth);
void resampler_write_sample_float(void *, float sample);
void resampler_set_rate( void *, double new_factor );
void resampler_set_rate(void *, double new_factor);
int resampler_ready(void *);
void resampler_clear(void *);
int resampler_get_sample_count(void *);


+ 10
- 12
Frameworks/Dumb/dumb/include/internal/riff.h View File

@@ -3,22 +3,20 @@
struct riff;
struct riff_chunk
{
unsigned type;
struct riff_chunk {
unsigned type;
long offset;
unsigned size;
struct riff * nested;
unsigned size;
struct riff *nested;
};
struct riff
{
unsigned type;
unsigned chunk_count;
struct riff_chunk * chunks;
struct riff {
unsigned type;
unsigned chunk_count;
struct riff_chunk *chunks;
};
struct riff * riff_parse( DUMBFILE * f, long offset, long size, unsigned proper );
void riff_free( struct riff * );
struct riff *riff_parse(DUMBFILE *f, long offset, long size, unsigned proper);
void riff_free(struct riff *);
#endif

+ 17
- 12
Frameworks/Dumb/dumb/include/internal/stack_alloc.h View File

@@ -36,13 +36,13 @@
#define STACK_ALLOC_H
#ifdef WIN32
# include <malloc.h>
#include <malloc.h>
#else
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# include <stdlib.h>
# endif
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#else
#include <stdlib.h>
#endif
#endif
/**
@@ -86,15 +86,21 @@
#include <valgrind/memcheck.h>
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size)-1))
#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#define PUSH(stack, size, type) \
(VALGRIND_MAKE_NOACCESS(stack, 1000), ALIGN((stack), sizeof(type)), \
VALGRIND_MAKE_WRITABLE(stack, ((size) * sizeof(type))), \
(stack) += ((size) * sizeof(type)), \
(type *)((stack) - ((size) * sizeof(type))))
#else
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size)-1))
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#define PUSH(stack, size, type) \
(ALIGN((stack), sizeof(type)), (stack) += ((size) * sizeof(type)), \
(type *)((stack) - ((size) * sizeof(type))))
#endif
@@ -103,11 +109,10 @@
#define ALLOC(var, size, type) type var[size]
#elif defined(USE_ALLOCA)
#define VARDECL(var) var
#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
#define ALLOC(var, size, type) var = alloca(sizeof(type) * (size))
#else
#define VARDECL(var) var
#define ALLOC(var, size, type) var = PUSH(stack, size, type)
#endif
#endif

+ 9
- 20
Frameworks/Dumb/dumb/include/internal/tarray.h View File

@@ -2,30 +2,19 @@
#define _T_ARRAY_H_
#include <stdlib.h>
#include "internal/dumb.h"
#ifndef LONG_LONG
#if defined __GNUC__ || defined __INTEL_COMPILER || defined __MWERKS__
#define LONG_LONG long long
#elif defined _MSC_VER || defined __WATCOMC__
#define LONG_LONG __int64
#elif defined __sgi
#define LONG_LONG long long
#else
#error 64-bit integer type unknown
#endif
#endif
void * timekeeping_array_create(size_t size);
void timekeeping_array_destroy(void * array);
void * timekeeping_array_dup(void * array);
void *timekeeping_array_create(size_t size);
void timekeeping_array_destroy(void *array);
void *timekeeping_array_dup(void *array);
void timekeeping_array_reset(void * array, size_t loop_start);
void timekeeping_array_reset(void *array, size_t loop_start);
void timekeeping_array_push(void * array, size_t index, LONG_LONG time);
void timekeeping_array_bump(void * array, size_t index);
void timekeeping_array_push(void *array, size_t index, LONG_LONG time);
void timekeeping_array_bump(void *array, size_t index);
unsigned int timekeeping_array_get_count(void * array, size_t index);
unsigned int timekeeping_array_get_count(void *array, size_t index);
LONG_LONG timekeeping_array_get_item(void * array, size_t index);
LONG_LONG timekeeping_array_get_item(void *array, size_t index);
#endif

+ 0
- 77
Frameworks/Dumb/dumb/licence.txt View File

@@ -1,77 +0,0 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* licence.txt - Conditions for use of DUMB. / / \ \
* | < / \_
* If you do not agree to these terms, please | \/ /\ /
* do not use DUMB. \_ / > /
* | \ / /
* Information in [brackets] is provided to aid | ' /
* interpretation of the licence. \__/
*/


Dynamic Universal Music Bibliotheque, Version 0.9.3

Copyright (C) 2001-2005 Ben Davis, Robert J Ohannessian and Julien Cugniere

This software is provided 'as-is', without any express or implied warranty.
In no event shall the authors be held liable for any damages arising from the
use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a
product, you are requested to acknowledge its use in the product
documentation, along with details on where to get an unmodified version of
this software, but this is not a strict requirement.

[Note that the above point asks for a link to DUMB, not just a mention.
Googling for DUMB doesn't help much! The URL is "http://dumb.sf.net/".]

[The link was originally strictly required. This was changed for two
reasons. Firstly, if many projects request an acknowledgement, the list of
acknowledgements can become quite unmanageable. Secondly, DUMB was placing
a restriction on the code using it, preventing people from using the GNU
General Public Licence which disallows any such restrictions. See
http://www.gnu.org/philosophy/bsd.html for more information on this
subject. However, if DUMB plays a significant part in your project, we do
urge you to acknowledge its use.]

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed from or altered in any source distribution.

4. If you are using the Program in someone else's bedroom on any Monday at
3:05 pm, you are not allowed to modify the Program for ten minutes. [This
clause provided by Inphernic; every licence should contain at least one
clause, the reasoning behind which is far from obvious.]

5. Users who wish to use DUMB for the specific purpose of playing music are
required to feed their dog on every full moon (if deemed appropriate).
[This clause provided by Allefant, who couldn't remember what Inphernic's
clause was.]

6. No clause in this licence shall prevent this software from being depended
upon by a product licensed under the GNU General Public Licence. If such a
clause is deemed to exist, Debian, then it shall be respected in spirit as
far as possible and all other clauses shall continue to apply in full
force.

We regret that we cannot provide any warranty, not even the implied warranty
of merchantability or fitness for a particular purpose.

Some files generated or copied by automake, autoconf and friends are
available in an extra download. These fall under separate licences but are
all free to distribute. Please check their licences as necessary.

+ 0
- 541
Frameworks/Dumb/dumb/readme.txt View File

@@ -1,541 +0,0 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readme.txt - General information on DUMB. / / \ \
* | < / \_
* | \/ /\ /
* \_ / > /
* | \ / /
* | ' /
* \__/
*/


********************
*** Introduction ***
********************


Thank you for downloading DUMB v0.9.3! You should have the following
documentation:

readme.txt - This file
licence.txt - Conditions for the use of this software
release.txt - Release notes and changes for this and past releases
docs/
howto.txt - Step-by-step instructions on adding DUMB to your project
faq.txt - Frequently asked questions and answers to them
dumb.txt - DUMB library reference
deprec.txt - Information about deprecated parts of the API
ptr.txt - Quick introduction to pointers for those who need it
fnptr.txt - Explanation of function pointers for those who need it
modplug.txt - Our official position regarding ModPlug Tracker

This file will help you get DUMB set up. If you have not yet done so, please
read licence.txt and release.txt before proceeding. After you've got DUMB set
up, please refer to the files in the docs/ directory at your convenience. I
recommend you start with howto.txt.


****************
*** Features ***
****************


Here is the statutory feature list:

- Freeware

- Supports playback of IT, XM, S3M and MOD files

- Faithful to the original trackers, especially IT; if it plays your module
wrongly, please tell me so I can fix the bug! (But please don't complain
about differences between DUMB and ModPlug Tracker; see docs/modplug.txt)

- Accurate support for low-pass resonant filters for IT files

- Very accurate timing and pitching; completely deterministic playback

- Click removal

- Facility to embed music files in other files (e.g. Allegro datafiles)

- Three resampling quality settings: aliasing, linear interpolation and cubic
interpolation

- Number of samples playing at once can be limited to reduce processor usage,
but samples will come back in when other louder ones stop

- All notes will be present and correct even if you start a piece of music in
the middle

- Option to take longer loading but seek fast to any point before the music
first loops (seeking time increases beyond this point)

- Audio generated can be used in any way; DUMB does not necessarily send it
straight to a sound output system

- Can be used with Allegro, can be used without (if you'd like to help make
DUMB more approachable to people who aren't using Allegro, please contact
me)

- Makefile provided for DJGPP, MinGW, Linux, BeOS and Mac OS X

- Project files provided for MSVC 6

- Autotools-based configure script available as a separate download for
masochists

- Code should port anywhere that has a 32-bit C compiler; instructions on
compiling it manually are available further down


*********************
*** What you need ***
*********************


To use DUMB, you need a 32-bit C compiler (GCC and MSVC are fine). If you
have Allegro, DUMB can integrate with its audio streams and datafiles, making
your life easier. If you do not wish to use Allegro, you will have to do some
work to get music playing back. The 'dumbplay' example program requires
Allegro.

Allegro - http://alleg.sf.net/


**********************************************
*** How to set DUMB up with DJGPP or MinGW ***
**********************************************


You should have got the .zip version. If for some reason you got the .tar.gz
version instead, you may have to convert make/config.bat to DOS text file
format. WinZip does this automatically by default. Otherwise, loading it into
MS EDIT and saving it again should do the trick (but do not do this to the
Makefiles as it destroys tabs). You will have to do the same for any files
you want to view in Windows Notepad. If you have problems, just go and
download the .zip instead.

Make sure you preserved the directory structure when you extracted DUMB from
the archive. Most unzipping programs will do this by default, but pkunzip
requires you to pass -d. If not, please delete DUMB and extract it again
properly.

If you are using Windows, open an MS-DOS Prompt or a Windows Command Line.
Change to the directory into which you unzipped DUMB.

If you are using MinGW (and you haven't renamed 'mingw32-make'), type:

mingw32-make

Otherwise, type the following:

make

DUMB will ask you whether you wish to compile for DJGPP or MinGW. Then it
will ask you whether you want support for Allegro. (You have to have made and
installed Allegro's optimised library for this to work.) Finally, it will
compile optimised and debugging builds of DUMB, along with the example
programs. When it has finished, run one of the following to install the
libraries:

make install
mingw32-make install

All done! If you ever need the configuration again (e.g. if you compiled for
DJGPP before and you want to compile for MinGW now), run one of the
following:

make config
mingw32-make config

See the comments in the Makefile for other targets.

Note: the Makefile will only work properly if you have COMSPEC or ComSpec set
to point to command.com or cmd.exe. If you set it to point to a Unix-style
shell, the Makefile won't work.

Please let me know if you have any trouble.

As an alternative, MSYS users may attempt to use the configure script,
available in dumb-0.9.3-autotools.tar.gz. This has been found to work without
Allegro, and is untested with Allegro. I should appreciate feedback from
anyone else who tries this. I do not recommend its use, partly because it
creates dynamically linked libraries and I don't know how to stop it from
doing that (see the section on compiling DUMB manually), and partly because
autotools are plain evil.

Scroll down for information on the example programs. Refer to docs/howto.txt
when you are ready to start programming with DUMB. If you use DUMB in a game,
let me know - I might decide to place a link to your game on DUMB's website!


******************************************************
*** How to set DUMB up with Microsoft Visual C++ 6 ***
******************************************************


If you have a newer version of Microsoft Visual C++ or Visual Something that
supports C++, please try these instructions and let me know if it works.

You should have got the .zip version. If for some reason you got the .tar.gz
version instead, you may have to convert some files to DOS text file format.
WinZip does this automatically by default. Otherwise, loading such files into
MS EDIT and saving them again should do the trick. You will have to do this
for any files you want to view in Windows Notepad. If you have problems, just
go and download the .zip instead.

Make sure you preserved the directory structure when you extracted DUMB from
the archive. Most unzipping programs will do this by default, but pkunzip
requires you to pass -d. If not, please delete DUMB and extract it again
properly.

DUMB comes with a workspace Microsoft Visual C++ 6, containing projects for
the DUMB core, the Allegro interface library and each of the examples. The
first thing you might want to do is load the workspace up and have a look
around. You will find it in the dumb\vc6 directory under the name dumb.dsw.
Note that the aldumb and dumbplay projects require Allegro, so they won't
work if you don't have Allegro. Nevertheless, dumbplay is the best-commented
of the examples, so do have a look.

When you are ready to add DUMB to your project, follow these instructions:

1. Open your project in VC++.
2. Select Project|Insert Project into Workspace...
3. Navigate to the dumb\vc6\dumb directory and select dumb.dsp.
Alternatively, if you know that you are statically linking with a library
that uses the statically linked multithreaded runtime (/MT), you may wish
to select dumb_static.dsp in the dumb_static subdirectory instead.
4. Select Build|Set Active Configuration..., and reselect one of your
project's configurations.
5. Select Project|Dependencies... and ensure your project is dependent on
DUMB.
6. Select Project|Settings..., Settings for: All Configurations, C/C++ tab,
Preprocessor category. Add the DUMB include directory to the Additional
Include Directories box.
7. Ensure that for all the projects in the workspace (or more likely just all
the projects in a particular dependency chain) the run-time libraries are
the same. That's in Project|Settings, C/C++ tab, Code generation category,
Use run-time library dropdown. The settings for Release and Debug are
separate, so you'll have to change them one at a time. Exactly which run-
time library you use will depend on what you need; it doesn't appear that
DUMB has any particular requirements, so set it to whatever you're using
now. (It will have to be /MD, the multithreaded DLL library, if you are
statically linking with Allegro. If you are dynamically linking with
Allegro than it doesn't matter.)
8. If you are using Allegro, do some or all of the above for the aldumb.dsp
project in the aldumb directory too.

Good thing you only have to do all that once ... or twice ...

If you have the Intel compiler installed, it will - well, should - be used to
compile DUMB. The only setting I [Tom Seddon] added is /QxiM. This allows the
compiler to use PPro and MMX instructions, and so when compiling with Intel
the resultant EXE will require a Pentium II or greater. I don't think this is
unreasonable. After all, it is 2003 :)

[Note from Ben: the Intel compiler is evil! It makes AMD processors look bad!
Patch it or boycott it or something!]

If you don't have the Intel compiler, VC will compile DUMB as normal.

This project file and these instructions were provided by Tom Seddon (I hope
I got his name right; I had to guess it from his e-mail address!). Chad
Austin has since changed the project files around, and I've just attempted to
hack them to incorporate new source files. I've also tried to update the
instructions using guesswork and some knowledge of Visual J++ (you heard me).
The instructions and the project files are to this day untested by me. If you
have problems, check the download page at http://dumb.sf.net/ to see if they
are addressed; failing that, direct queries to me and I'll try to figure them
out.

If you have any comments at all on how the VC6 projects are laid out, or how
the instructions could be improved, I should be really grateful to hear them.
I am a perfectionist, after all. :)

Scroll down for information on the example programs. When you are ready to
start using DUMB, refer to docs/howto.txt. If you use DUMB in a game, let me
know - I might decide to place a link to your game on DUMB's website!


******************************************************
*** How to set DUMB up on Linux, BeOS and Mac OS X ***
******************************************************


You should have got the .tar.gz version. If for some reason you got the .zip
version instead, you may have to strip all characters with ASCII code 13 from
some of the text files. If you have problems, just go and download the
.tar.gz instead.

You have two options. There is a Makefile which should cope with most
systems. The first option is to use this default Makefile, and the procedure
is explained below. The second option is to download
dumb-0.9.3-autotools.tar.gz, extract it over the installation, run
./configure and use the generated Makefile. Users who choose to do this are
left to their own devices but advised to read the information at the end of
this section. I strongly recommend the first option.

If you are not using the configure script, the procedure is as follows.

First, run the following command as a normal user:

make

You will be asked whether you want Allegro support. Then, unless you are on
BeOS, you will be asked where you'd like DUMB to install its headers,
libraries and examples (which will go in the include/, lib/ and bin/
subdirectories of the prefix you specify). BeOS has fixed locations for these
files. You may use shell variables here, e.g. $HOME or ${HOME}, but ~ will
not work. Once you have specified these pieces of information, the optimised
and debugging builds of DUMB will be compiled, along with the examples. When
it has finished, you can install them with:

make install

You may need to be root for this to work. It depends on the prefix you chose.

Note: the Makefile will only work if COMSPEC and ComSpec are both undefined.
If either of these is defined, the Makefile will try to build for a Windows
system, and will fail.

Please let me know if you have any trouble.

Scroll down for information on the example programs. Refer to docs/howto.txt
when you are ready to start programming with DUMB. If you use DUMB in a game,
let me know - I might decide to place a link to your game on DUMB's website!

Important information for users of the configure script follows.

The Makefile generated by the configure script creates dynamically linked
libraries, and I don't know how to stop it from doing so. See the section
below on building DUMB manually for why I recommend linking DUMB statically.
However, if you choose to use the configure script, note the following.

The default Makefile is a copy of Makefile.rdy (short for 'ready'), and it
must exist with the name Makefile.rdy in order to work. The configure script
will overwrite Makefile, so if you want the default Makefile back, just run:

cp Makefile.rdy Makefile

Do not use a symlink, as that would result in Makefile.rdy getting
overwritten next time the configure script is run!

You can also access the usual build system by passing '-f Makefile.rdy' to
Make.


********************************************************
*** How to build DUMB manually if nothing else works ***
********************************************************


Those porting to platforms without floating point support should be aware
that DUMB does use floating point operations but not in the inner loops. They
are used for volume and note pitch calculations, and they are used when
initialising the filter algorithm for given cut-off and resonance values.
Please let me know if this is a problem for you. If there is enough demand, I
may be able to eliminate one or both of these cases.

All of the library source code may be found in the src/ subdirectory. There
are headers in the include/ subdirectory, and src/helpers/resample.c also
#includes some .inc files in its own directory.

There are four subdirectories under src/. For projects not using Allegro, you
will need all the files in src/core/, src/helpers/ and src/it/. If you are
using Allegro, you will want the src/allegro/ subdirectory too. For
consistency with the other build systems, the contents of src/allegro/ should
be compiled into a separate library.

I recommend static-linking DUMB, since the version information is done via
macros and the API has a tendency to change. If you static-link, then once
your program is in binary form, you can be sure that changes to the installed
version of DUMB won't cause it to malfuction. It is my fault that the API has
been so unstable. Sorry!

Compile each .c file separately. As mentioned above, you will need to specify
two places to look for #include files: the include/ directory and the source
file's own directory. You will also need to define the symbol
DUMB_DECLARE_DEPRECATED on the command line.

Do not compile the .inc files separately.

You may need to edit dumb.h and add your own definition for LONG_LONG. It
should be a 64-bit integer. If you do this, please see if you can add a check
for your compiler so that it still works with other compilers.

DUMB has two build modes. If you define the symbol DEBUGMODE, some checks for
programmer error will be incorporated into the library. Otherwise it will be
built without any such checks. (DUMB will however always thoroughly check the
validity of files it is loading. If you ever find a module file that crashes
DUMB, please let me know!)

I recommend building two versions of the library, one with DEBUGMODE defined
and debugging information included, and the other with compiler optimisation
enabled. If you can install DUMB system-wide so that your projects, and other
people's, can simply #include <dumb.h> or <aldumb.h> and link with libraries
by simple name with no path, then that is ideal.

If you successfully port DUMB to a new platform, please let me know!


****************************
*** The example programs ***
****************************


Three example programs are provided. On DOS and Windows, you can find them in
the examples subdirectory. On other systems they will be installed system-
wide.

dumbplay
This program will only be built if you have Allegro. Pass it the filename
of an IT, XM, S3M or MOD file, and it will play it. It's not a polished
player with real-time threading or anything - so don't complain about it
stuttering while you use other programs - but it does show DUMB's fidelity
nicely. You can control the playback quality by editing dumb.ini, which
must be in the current working directory. (This is a flaw for systems
where the program is installed system-wide, but it is non-fatal.) Have a
look at the examples/dumb.ini file for further information.

dumbout
This program does not need Allegro. You can use it to stream an IT, XM,
S3M or MOD file to raw PCM. This can be used as input to an encoder like
oggenc (with appropriate command-line options), or it can be sent to a
.pcm file which can be read by any respectable waveform editor. This
program is also convenient for timing DUMB. Compare the time it takes to
render a module with the module's playing time! dumbout doesn't try to
read any configuration file; the options are set on the command line.

dumb2wav
This program is much the same as dumbout, but it writes a .wav file with
the appropriate header. Thanks go to Chad Austin for this useful tool.


*********************************************
*** Downloading music or writing your own ***
*********************************************


If you would like to compose your own music modules, then this section should
help get you started.

The best programs for the job are the trackers that pioneered the file
formats:

Impulse Tracker - IT files - http://www.lim.com.au/ImpulseTracker/
Fast Tracker II - XM files - http://www.fasttracker2.com/
Scream Tracker 3 - S3M files - No official site known, please use Google

MOD files come from the Amiga; I do not know what PC tracker to recommend for
editing these. If you know of one, let me know! In the meantime, I would
recommend using a more advanced file format. However, don't convert your
existing MODs just for the sake of it.

Fast Tracker II is Shareware. It offers a very flashy interface and has a
game embedded, but the IT file format is more powerful and better defined. By
all means try them both and see which you prefer; it is largely a matter of
taste (and, in some cases, religion). Impulse Tracker and Scream Tracker 3
are Freeware, although you can donate to Impulse Tracker and receive a
slightly upgraded version. DUMB is likely to be at its best with IT files.

These editors are DOS programs. Users of DOS-incapable operating systems may
like to try ModPlug Tracker, but should read docs/modplug.txt before using it
for any serious work. If you use a different operating system, or if you know
of any module editors for Windows that are more faithful to the original
trackers' playback, please give me some links so I can put them here!

ModPlug Tracker - http://www.modplug.com/

If you have an x86 Linux system with VGA-compatible hardware (which covers
all PC graphics cards I've ever seen), you should be able to get Impulse
Tracker running with DOSEMU. You will have to give it access to the VGA ports
and run it in a true console, as it will not work with the X-based VGA
emulation. I personally added the SB16 emulation to DOSEMU, so you can even
use filters! However, it corrupts samples alarmingly often when saving on my
system - probably a DOSEMU issue. If you set this up, I am curious to know
whether it works for you.

DOSEMU - http://www.dosemu.org/

BEWARE OF WINAMP! Although it's excellent for MP3s, it is notorious for being
one of the worst module players in existence; very many modules play wrongly
with it. There are plug-ins available to improve Winamp's module support, for
example WSP.

Winamp - http://www.winamp.com/
WSP - http://www.spytech.cz/index.php?sec=demo

(There is a Winamp plug-in that uses DUMB, but it is unreliable. If anyone
would like to work on it, please get in touch.)

While I am at it I should also point out that Winamp is notorious for
containing security flaws. Install it at your own risk, and if it is your
work computer, check with your boss first!

Samples and instruments are the building blocks of music modules. You can
download samples at

http://www.tump.net/

If you would like to download module files composed by other people, check
the following sites:

http://www.modarchive.com/
http://www.scene.org/
http://www.tump.net/
http://www.homemusic.cc/main.php
http://www.modplug.com/

Once again, if you know of more sites where samples or module files are
available for download, please let me know.

If you wish to use someone's music in your game, please respect the
composer's wishes. In general, you should ask the composer. Music that has
been placed in the Public Domain can be used by anyone for anything, but it
wouldn't do any harm to ask anyway if you know who the author is. In many
cases the author will be thrilled, so don't hesitate!

A note about converting modules from one format to another, or converting
from MIDI: don't do it, unless you are a musician and are prepared to go
through the file and make sure everything sounds the way it should! The
module formats are all slightly different, and MIDI is very different;
converting from one format to another will usually do some damage.

Instead, it is recommended that you allow DUMB to interpret the original file
as it sees fit. DUMB may make mistakes (it does a lot of conversion on
loading), but future versions of DUMB will be able to rectify these mistakes.
On the other hand, if you convert the file, the damage is permanent.


***********************
*** Contact details ***
***********************


If you have trouble with DUMB, or want to contact me for any other reason, my
e-mail address is given below. Please do get in touch, even if I appear to
have disappeared!

If you wish to chat online about something, perhaps on IRC, that can most
likely be arranged. Send me an e-mail.


******************
*** Conclusion ***
******************


This is the conclusion.


Ben Davis
entheh@users.sf.net

+ 25
- 36
Frameworks/Dumb/dumb/src/core/atexit.c View File

@@ -22,50 +22,39 @@
#include "dumb.h"
#include "internal/dumb.h"
typedef struct DUMB_ATEXIT_PROC
{
struct DUMB_ATEXIT_PROC *next;
void (*proc)(void);
}
DUMB_ATEXIT_PROC;
typedef struct DUMB_ATEXIT_PROC {
struct DUMB_ATEXIT_PROC *next;
void (*proc)(void);
} DUMB_ATEXIT_PROC;
static DUMB_ATEXIT_PROC *dumb_atexit_proc = NULL;
int dumb_atexit(void (*proc)(void)) {
DUMB_ATEXIT_PROC *dap = dumb_atexit_proc;
while (dap) {
if (dap->proc == proc)
return 0;
dap = dap->next;
}
int dumb_atexit(void (*proc)(void))
{
DUMB_ATEXIT_PROC *dap = dumb_atexit_proc;
dap = malloc(sizeof(*dap));
while (dap) {
if (dap->proc == proc) return 0;
dap = dap->next;
}
if (!dap)
return -1;
dap = malloc(sizeof(*dap));
dap->next = dumb_atexit_proc;
dap->proc = proc;
dumb_atexit_proc = dap;
if (!dap)
return -1;
dap->next = dumb_atexit_proc;
dap->proc = proc;
dumb_atexit_proc = dap;
return 0;
return 0;
}
void dumb_exit(void)
{
while (dumb_atexit_proc) {
DUMB_ATEXIT_PROC *next = dumb_atexit_proc->next;
(*dumb_atexit_proc->proc)();
free(dumb_atexit_proc);
dumb_atexit_proc = next;
}
void dumb_exit(void) {
while (dumb_atexit_proc) {
DUMB_ATEXIT_PROC *next = dumb_atexit_proc->next;
(*dumb_atexit_proc->proc)();
free(dumb_atexit_proc);
dumb_atexit_proc = next;
}
}

+ 4
- 12
Frameworks/Dumb/dumb/src/core/duhlen.c View File

@@ -26,17 +26,9 @@
#include "dumb.h"
#include "internal/dumb.h"
dumb_off_t duh_get_length(DUH *duh) { return duh ? duh->length : 0; }
long duh_get_length(DUH *duh)
{
return duh ? duh->length : 0;
}
void duh_set_length(DUH *duh, long length)
{
if (duh)
duh->length = length;
void duh_set_length(DUH *duh, dumb_off_t length) {
if (duh)
duh->length = length;
}

+ 20
- 25
Frameworks/Dumb/dumb/src/core/duhtag.c View File

@@ -22,37 +22,32 @@
#include "dumb.h"
#include "internal/dumb.h"
const char *duh_get_tag(DUH *duh, const char *key) {
int i;
ASSERT(key);
if (!duh || !duh->tag)
return NULL;
for (i = 0; i < duh->n_tags; i++)
if (strcmp(key, duh->tag[i][0]) == 0)
return duh->tag[i][1];
const char *duh_get_tag(DUH *duh, const char *key)
{
int i;
ASSERT(key);
if (!duh || !duh->tag) return NULL;
for (i = 0; i < duh->n_tags; i++)
if (strcmp(key, duh->tag[i][0]) == 0)
return duh->tag[i][1];
return NULL;
return NULL;
}
int duh_get_tag_iterator_size(DUH *duh)
{
return (duh && duh->tag ? duh->n_tags : 0);
int duh_get_tag_iterator_size(DUH *duh) {
return (duh && duh->tag ? duh->n_tags : 0);
}
int duh_get_tag_iterator_get(DUH *duh, const char **key, const char **tag,
int i) {
ASSERT(key);
ASSERT(tag);
if (!duh || !duh->tag || i >= duh->n_tags)
return -1;
int duh_get_tag_iterator_get(DUH *duh, const char **key, const char **tag, int i)
{
ASSERT(key);
ASSERT(tag);
if (!duh || !duh->tag || i >= duh->n_tags) return -1;
*key = duh->tag[i][0];
*tag = duh->tag[i][1];
*key = duh->tag[i][0];
*tag = duh->tag[i][1];
return 0;
return 0;
}

+ 242
- 288
Frameworks/Dumb/dumb/src/core/dumbfile.c View File

@@ -22,398 +22,352 @@
#include "dumb.h"
#include "internal/dumb.h"
static const DUMBFILE_SYSTEM *the_dfs = NULL;
void register_dumbfile_system(const DUMBFILE_SYSTEM *dfs)
{
ASSERT(dfs);
ASSERT(dfs->open);
ASSERT(dfs->getc);
ASSERT(dfs->close);
void register_dumbfile_system(const DUMBFILE_SYSTEM *dfs) {
ASSERT(dfs);
ASSERT(dfs->open);
ASSERT(dfs->getc);
ASSERT(dfs->close);
ASSERT(dfs->seek);
ASSERT(dfs->get_size);
the_dfs = dfs;
the_dfs = dfs;
}
#include "internal/dumbfile.h"
DUMBFILE *dumbfile_open(const char *filename) {
DUMBFILE *f;
ASSERT(the_dfs);
DUMBFILE *dumbfile_open(const char *filename)
{
DUMBFILE *f;
ASSERT(the_dfs);
f = (DUMBFILE *) malloc(sizeof(*f));
f = (DUMBFILE *)malloc(sizeof(*f));
if (!f)
return NULL;
if (!f)
return NULL;
f->dfs = the_dfs;
f->dfs = the_dfs;
f->file = (*the_dfs->open)(filename);
f->file = (*the_dfs->open)(filename);
if (!f->file) {
free(f);
return NULL;
}
if (!f->file) {
free(f);
return NULL;
}
f->pos = 0;
f->pos = 0;
return f;
return f;
}
DUMBFILE *dumbfile_open_ex(void *file, const DUMBFILE_SYSTEM *dfs) {
DUMBFILE *f;
ASSERT(dfs);
ASSERT(dfs->getc);
ASSERT(file);
DUMBFILE *dumbfile_open_ex(void *file, const DUMBFILE_SYSTEM *dfs)
{
DUMBFILE *f;
ASSERT(dfs);
ASSERT(dfs->getc);
ASSERT(file);
f = (DUMBFILE *)malloc(sizeof(*f));
f = (DUMBFILE *) malloc(sizeof(*f));
if (!f) {
if (dfs->close)
(*dfs->close)(file);
return NULL;
}
if (!f) {
if (dfs->close)
(*dfs->close)(file);
return NULL;
}
f->dfs = dfs;
f->file = file;
f->dfs = dfs;
f->file = file;
f->pos = 0;
f->pos = 0;
return f;
return f;
}
dumb_off_t dumbfile_pos(DUMBFILE *f) {
ASSERT(f);
long dumbfile_pos(DUMBFILE *f)
{
ASSERT(f);
return f->pos;
return f->pos;
}
/* Move forward in the file from the current position by n bytes. */
int dumbfile_skip(DUMBFILE *f, dumb_off_t n) {
int rv;
ASSERT(f);
ASSERT(n >= 0);
if (f->pos < 0)
return -1;
f->pos += n;
if (f->dfs->skip) {
rv = (*f->dfs->skip)(f->file, n);
if (rv) {
f->pos = -1;
return rv;
}
} else {
while (n) {
rv = (*f->dfs->getc)(f->file);
if (rv < 0) {
f->pos = -1;
return rv;
}
n--;
}
}
int dumbfile_skip(DUMBFILE *f, long n)
{
int rv;
ASSERT(f);
ASSERT(n >= 0);
if (f->pos < 0)
return -1;
f->pos += n;
if (f->dfs->skip) {
rv = (*f->dfs->skip)(f->file, n);
if (rv) {
f->pos = -1;
return rv;
}
} else {
while (n) {
rv = (*f->dfs->getc)(f->file);
if (rv < 0) {
f->pos = -1;
return rv;
}
n--;
}
}
return 0;
return 0;
}
int dumbfile_getc(DUMBFILE *f) {
int rv;
ASSERT(f);
int dumbfile_getc(DUMBFILE *f)
{
int rv;
ASSERT(f);
if (f->pos < 0)
return -1;
if (f->pos < 0)
return -1;
rv = (*f->dfs->getc)(f->file);
rv = (*f->dfs->getc)(f->file);
if (rv < 0) {
f->pos = -1;
return rv;
}
if (rv < 0) {
f->pos = -1;
return rv;
}
f->pos++;
f->pos++;
return rv;
return rv;
}
int dumbfile_igetw(DUMBFILE *f) {
int l, h;
ASSERT(f);
int dumbfile_igetw(DUMBFILE *f)
{
int l, h;
if (f->pos < 0)
return -1;
ASSERT(f);
if (f->pos < 0)
return -1;
l = (*f->dfs->getc)(f->file);
if (l < 0) {
f->pos = -1;
return l;
}
l = (*f->dfs->getc)(f->file);
if (l < 0) {
f->pos = -1;
return l;
}
h = (*f->dfs->getc)(f->file);
if (h < 0) {
f->pos = -1;
return h;
}
h = (*f->dfs->getc)(f->file);
if (h < 0) {
f->pos = -1;
return h;
}
f->pos += 2;
f->pos += 2;
return l | (h << 8);
return l | (h << 8);
}
int dumbfile_mgetw(DUMBFILE *f) {
int l, h;
ASSERT(f);
int dumbfile_mgetw(DUMBFILE *f)
{
int l, h;
if (f->pos < 0)
return -1;
ASSERT(f);
if (f->pos < 0)
return -1;
h = (*f->dfs->getc)(f->file);
if (h < 0) {
f->pos = -1;
return h;
}