00001 #ifndef WAVELOADER_H 00002 #define WAVELOADER_H 00003 00004 #include "MercuryString.h" 00005 00006 struct RiffChunk 00007 { 00008 int id; //4 (big endian) 00009 unsigned int size; //4 00010 }; 00011 00012 struct WaveHead 00013 { 00014 RiffChunk info; 00015 int type; //4 (big endian) 00016 }; 00017 00018 struct FmtChunk 00019 { 00020 //the compiler pads this to size 28, it should be 26 00021 RiffChunk info; 00022 unsigned short comp; //2 00023 unsigned short channels; //2 00024 unsigned int srate; //4 00025 unsigned int aBPS; //4 00026 unsigned short align; //2 00027 unsigned short sigBPS; //2 00028 unsigned short extraFormat; //2 00029 }; 00030 00031 struct RawAudioPacket 00032 { 00033 RawAudioPacket() { raw = 0; } 00034 unsigned short bits; 00035 unsigned short channels; 00036 unsigned int sampleRate; 00037 unsigned int size; 00038 char* raw; 00039 }; 00040 00041 void LoadWav(const MString& path, RawAudioPacket& audio); 00042 00043 #endif 00044 00045 /* Information on the wave format can be found at 00046 http://www.sonicspot.com/guide/wavefiles.html and 00047 http://ccrma.stanford.edu/courses/422/projects/WaveFormat/ 00048 */ 00049 00050 /* 00051 * Copyright (c) 2006 Joshua Allen 00052 * All rights reserved. 00053 * 00054 * Redistribution and use in source and binary forms, with or 00055 * without modification, are permitted provided that the following 00056 * conditions are met: 00057 * - Redistributions of source code must retain the above 00058 * copyright notice, this list of conditions and the following disclaimer. 00059 * - Redistributions in binary form must reproduce the above copyright 00060 * notice, this list of conditions and the following disclaimer in 00061 * the documentation and/or other materials provided with the distribution. 00062 * - Neither the name of the Mercury Engine nor the names of its 00063 * contributors may be used to endorse or promote products derived from 00064 * this software without specific prior written permission. 00065 * 00066 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00067 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00068 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00069 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 00070 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00071 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00072 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00073 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00074 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00075 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00076 */ 00077