moved declaration of error/warning/debug from engine.h to util.h; added voc.cpp

svn-id: r10150
This commit is contained in:
Max Horn 2003-09-10 12:19:57 +00:00
parent 110152ddcf
commit eae239394c
5 changed files with 47 additions and 16 deletions

View File

@ -32,7 +32,7 @@
#include "fmopl.h"
#include "common/engine.h" // for warning/error/debug
#include "common/util.h"
#ifndef PI
#define PI 3.14159265358979323846

View File

@ -21,7 +21,6 @@
*/
#include "stdafx.h"
#include "common/engine.h" // for warning/error/debug
#include "common/file.h"
#include "common/util.h"

View File

@ -8,8 +8,9 @@ MODULE_OBJS = \
sound/midiparser_xmidi.o \
sound/mixer.o \
sound/mpu401.o \
sound/rate.o
# sound/resample.o
sound/rate.o \
# sound/resample.o \
sound/voc.o
# Include common rules
include common.rules

38
sound/voc.cpp Normal file
View File

@ -0,0 +1,38 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#include "stdafx.h"
#include "common/util.h"
#include "sound/voc.h"
int getSampleRateFromVOCRate(int vocSR) {
if (vocSR == 0xa5 || vocSR == 0xa6) {
return 11025;
} else if (vocSR == 0xd2 || vocSR == 0xd3) {
return 22050;
} else {
int sr = 1000000L / (256L - vocSR);
warning("inexact sample rate used: %i (0x%x)", sr, vocSR);
return sr;
}
}

View File

@ -48,17 +48,10 @@ struct VocBlockHeader {
#pragma END_PACK_STRUCTS
#endif
static inline int getSampleRateFromVOCRate(int vocSR) {
if (vocSR == 0xa5 || vocSR == 0xa6) {
return 11025;
} else if (vocSR == 0xd2 || vocSR == 0xd3) {
return 22050;
} else {
int sr = 1000000L / (256L - vocSR);
warning("inexact sample rate used: %i (0x%x)", sr, vocSR);
return sr;
}
}
/**
* Take a sample rate parameter as it occurs in a VOC sound header, and
* return the corresponding sample frequency.
*/
extern int getSampleRateFromVOCRate(int vocSR);
#endif