1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: qmus2mid.h 1313 2017-04-20 21:29:35Z wesleyjohnson $
5 //
6 // Copyright (C) 1995 by Sebastien Bacquet.
7 // Portions Copyright (C) 1998-2013 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 //
20 // $Log: qmus2mid.h,v $
21 // Revision 1.4  2000/09/10 10:46:15  metzgermeister
22 // merged with SDL version
23 //
24 // Revision 1.3  2000/04/21 08:23:47  emanne
25 // To have SDL working.
26 // qmus2mid.h: force include of qmus2mid_sdl.h when needed.
27 //
28 // Revision 1.2  2000/02/26 00:28:42  hurdler
29 // Mostly bug fix (see borislog.txt 23-2-2000, 24-2-2000)
30 //
31 //
32 // DESCRIPTION:
33 //   MUS format (music in Doom lumps) to MIDI conversion.
34 //
35 //
36 //-----------------------------------------------------------------------------
37 
38 #ifndef QMUS2MID_H
39 #define QMUS2MID_H
40 
41 #include "doomtype.h"
42 
43 // Call this function to load all music lumps.
44 void* S_CacheMusicLump(int lump);
45 
46 
47 typedef enum {
48   QM_success,
49   QM_NOTMUSFILE,   // Not a MUS file
50   QM_COMUSFILE,    // Can't open MUS file
51   QM_COTMPFILE,    // Can't open TMP file
52   QM_CWMIDFILE,    // Can't write MID file
53   QM_MUSFILECOR,   // MUS file corrupted
54   QM_TOOMCHAN,     // Too many channels
55   QM_MEMALLOC,     // Memory allocation error
56   QM_MIDTOOLARGE,  // If the mid don't fit in the buffer
57 } QMUS_error_code_e;
58 
59 
60 /* some (old) compilers mistake the "MUS\x1A" construct (interpreting
61    it as "MUSx1A")      */
62 #define MUSHEADER     "MUS\032"
63   // this seems to work
64 
65 #ifdef __OS2__
66 // Does not use qmus2mid
67 #else
68 // Buffer to Buffer version
69 // Return QMUS_error_code_e
70 int qmus2mid (byte  *mus,     // input mus
71               int muslength,  // input mus length
72               uint16_t division, // ticks per quarter note
73               int nocomp,     // no compression, is ignored
74               int midbuffersize, // output buffer length
75     /*INOUT*/
76               byte *mid,  // output buffer in memory
77               unsigned long* midilength //faB: return midi file length
78              );
79 #endif
80 
81 #endif
82