summaryrefslogtreecommitdiffstats
path: root/libSYS
diff options
context:
space:
mode:
Diffstat (limited to 'libSYS')
-rw-r--r--libSYS/include/machine_type.h2
-rw-r--r--libSYS/include/wav_file.h29
-rw-r--r--libSYS/src/cmdl_parser.cpp4
-rw-r--r--libSYS/src/genericStds.cpp2
-rw-r--r--libSYS/src/wav_file.cpp24
5 files changed, 44 insertions, 17 deletions
diff --git a/libSYS/include/machine_type.h b/libSYS/include/machine_type.h
index e5017ea..4745e43 100644
--- a/libSYS/include/machine_type.h
+++ b/libSYS/include/machine_type.h
@@ -173,7 +173,7 @@ amm-info@iis.fraunhofer.de
/* Define 64 bit base integer type. */
-#ifdef _WIN32
+#ifdef _MSC_VER
typedef __int64 INT64;
typedef unsigned __int64 UINT64;
#else
diff --git a/libSYS/include/wav_file.h b/libSYS/include/wav_file.h
index a48634b..2bc43b2 100644
--- a/libSYS/include/wav_file.h
+++ b/libSYS/include/wav_file.h
@@ -111,16 +111,36 @@ amm-info@iis.fraunhofer.de
extern "C" {
#endif
+#define SPEAKER_FRONT_LEFT 0x1
+#define SPEAKER_FRONT_RIGHT 0x2
+#define SPEAKER_FRONT_CENTER 0x4
+#define SPEAKER_LOW_FREQUENCY 0x8
+#define SPEAKER_BACK_LEFT 0x10
+#define SPEAKER_BACK_RIGHT 0x20
+#define SPEAKER_FRONT_LEFT_OF_CENTER 0x40
+#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
+#define SPEAKER_BACK_CENTER 0x100
+#define SPEAKER_SIDE_LEFT 0x200
+#define SPEAKER_SIDE_RIGHT 0x400
+#define SPEAKER_TOP_CENTER 0x800
+#define SPEAKER_TOP_FRONT_LEFT 0x1000
+#define SPEAKER_TOP_FRONT_CENTER 0x2000
+#define SPEAKER_TOP_FRONT_RIGHT 0x4000
+#define SPEAKER_TOP_BACK_LEFT 0x8000
+#define SPEAKER_TOP_BACK_CENTER 0x10000
+#define SPEAKER_TOP_BACK_RIGHT 0x20000
+#define SPEAKER_RESERVED 0x80000000
+
/*!
* RIFF WAVE file struct.
* For details see WAVE file format documentation (for example at http://www.wotsit.org).
*/
typedef struct WAV_HEADER
{
- char riffType[4];
+ char riffType[4];
UINT riffSize;
- char waveType[4];
- char formatType[4];
+ char waveType[4];
+ char formatType[4];
UINT formatSize;
USHORT compressionCode;
USHORT numChannels;
@@ -128,7 +148,7 @@ typedef struct WAV_HEADER
UINT bytesPerSecond;
USHORT blockAlign;
USHORT bitsPerSample;
- char dataType[4];
+ char dataType[4];
UINT dataSize;
} WAV_HEADER;
@@ -136,6 +156,7 @@ struct WAV
{
WAV_HEADER header;
FDKFILE *fp;
+ UINT channelMask;
};
typedef struct WAV *HANDLE_WAV;
diff --git a/libSYS/src/cmdl_parser.cpp b/libSYS/src/cmdl_parser.cpp
index ed37d8d..24ec0d5 100644
--- a/libSYS/src/cmdl_parser.cpp
+++ b/libSYS/src/cmdl_parser.cpp
@@ -465,7 +465,7 @@ INT CheckArg(TEXTCHAR* arg, TEXTCHAR* str, UINT numArgs, TEXTCHAR type, TEXTCHAR
for ( i = 0; i < _tcslen(arg); ++i )
{
- if ( (type == 'd') && !_istdigit(arg[i]) && arg[i] != 'x' )
+ if ( (type == 'd') && !_istdigit(arg[i]) && arg[i] != 'x' && arg[i] != '-')
{
#ifdef _UNICODE
_ftprintf(stderr, _TEXT("\n\nError: Argument '%ls' for switch '%ls' is not a valid number.\n" ), arg, cur_str);
@@ -549,7 +549,7 @@ int IIS_ProcessCmdlList(const char* param_filename, int (*pFunction)(int, TEXTCH
/* Skip consecutive blanks. */
while (*line_ptr == ' ' && line_ptr < line+CMDL_MAX_STRLEN)
line_ptr++;
- /* Assign argument. TODO: maybe handle quotes */
+ /* Assign argument. */
argv_ptr[argc] = line_ptr;
/* Get pointer to next blank. */
line_ptr = (char*)FDKstrchr(line_ptr, ' ');
diff --git a/libSYS/src/genericStds.cpp b/libSYS/src/genericStds.cpp
index c4d8d8f..07dd3e3 100644
--- a/libSYS/src/genericStds.cpp
+++ b/libSYS/src/genericStds.cpp
@@ -99,7 +99,7 @@ amm-info@iis.fraunhofer.de
/* library info */
#define SYS_LIB_VL0 1
#define SYS_LIB_VL1 3
-#define SYS_LIB_VL2 0
+#define SYS_LIB_VL2 1
#define SYS_LIB_TITLE "System Integration Library"
#define SYS_LIB_BUILD_DATE __DATE__
#define SYS_LIB_BUILD_TIME __TIME__
diff --git a/libSYS/src/wav_file.cpp b/libSYS/src/wav_file.cpp
index 38b4a37..58bcfaa 100644
--- a/libSYS/src/wav_file.cpp
+++ b/libSYS/src/wav_file.cpp
@@ -174,7 +174,6 @@ INT WAV_InputOpen (HANDLE_WAV *pWav, const char *filename)
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
};
USHORT extraFormatBytes, validBitsPerSample;
- UINT channelMask;
UCHAR guid[16];
INT i;
@@ -184,7 +183,7 @@ INT WAV_InputOpen (HANDLE_WAV *pWav, const char *filename)
if (extraFormatBytes >= 22) {
FDKfread_EL(&(validBitsPerSample), 2, 1, wav->fp);
- FDKfread_EL(&(channelMask), 4, 1, wav->fp);
+ FDKfread_EL(&(wav->channelMask), 4, 1, wav->fp);
FDKfread_EL(&(guid), 16, 1, wav->fp);
/* check for PCM GUID */
@@ -228,12 +227,12 @@ INT WAV_InputOpen (HANDLE_WAV *pWav, const char *filename)
/* Error path */
error:
- if (wav->fp) {
- FDKfclose(wav->fp);
- wav->fp = NULL;
- }
if (wav) {
+ if (wav->fp) {
+ FDKfclose(wav->fp);
+ wav->fp = NULL;
+ }
FDKfree(wav);
}
@@ -388,6 +387,11 @@ INT WAV_OutputOpen(HANDLE_WAV *pWav, const char *outputFilename, INT sampleRate,
HANDLE_WAV wav = (HANDLE_WAV)FDKcalloc(1, sizeof(struct WAV));
UINT size = 0;
+ if (wav == NULL) {
+ FDKprintfErr("WAV_OutputOpen(): Unable to allocate WAV struct.\n");
+ goto bail;
+ }
+
if (bitsPerSample != 16 && bitsPerSample != 24 && bitsPerSample != 32)
{
FDKprintfErr("WAV_OutputOpen(): Invalid argument (bitsPerSample).\n");
@@ -433,10 +437,12 @@ INT WAV_OutputOpen(HANDLE_WAV *pWav, const char *outputFilename, INT sampleRate,
return 0;
bail:
- if (wav->fp)
- FDKfclose(wav->fp);
- if (wav)
+ if (wav) {
+ if (wav->fp) {
+ FDKfclose(wav->fp);
+ }
FDKfree(wav);
+ }
pWav = NULL;