diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e72045..1b4c51da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,4 +86,4 @@ endif(MSVC) include_directories(${OPENSSL_INCLUDE_DIR}) add_subdirectory(Sources/Plasma) -add_subdirectory(Sources/Tools) +add_subdirectory(Sources/Tools) \ No newline at end of file diff --git a/Sources/Plasma/Apps/plClient/CMakeLists.txt b/Sources/Plasma/Apps/plClient/CMakeLists.txt index e4c7667b..d0bd4802 100644 --- a/Sources/Plasma/Apps/plClient/CMakeLists.txt +++ b/Sources/Plasma/Apps/plClient/CMakeLists.txt @@ -214,6 +214,7 @@ if (WIN32) target_link_libraries(plClient Version) target_link_libraries(plClient Vfw32) target_link_libraries(plClient Ws2_32) + target_link_libraries(plClient winmm) target_link_libraries(plClient strmiids) endif(WIN32) diff --git a/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt index 23c90923..27da66ce 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt @@ -16,7 +16,6 @@ set(plAudio_SOURCES plSound.cpp plSoundEvent.cpp plVoiceChat.cpp - plWAVClipBuffer.cpp plWin32GroupedSound.cpp plWin32Sound.cpp plWin32StaticSound.cpp @@ -34,7 +33,6 @@ set(plAudio_HEADERS plSound.h plSoundEvent.h plVoiceChat.h - plWAVClipBuffer.h plWin32GroupedSound.h plWin32Sound.h plWin32StaticSound.h diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp b/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp index 1014f689..18e1bcd0 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioCaps.cpp @@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #endif +#include #include #include "plStatusLog/plStatusLog.h" diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWAVClipBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWAVClipBuffer.cpp deleted file mode 100644 index cc34aea2..00000000 --- a/Sources/Plasma/PubUtilLib/plAudio/plWAVClipBuffer.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -////////////////////////////////////////////////////////////////////////////// -// // -// plWAVClipBuffer - Helper class for writing out WAV data in a buffered // -// manner, with support for clipping off the specified // -// amount at the end, but without knowing beforehand // -// exactly how much data we'll have. // -// // -// The algorithm goes something like this: we keep two buffers, both the // -// size of the amount we want to clip. We then start filling in the first // -// buffer, overflowing into the second buffer and wrapping back to the // -// first again in a circular fashion. When we fill up one buffer and are // -// about to advance to the next, we write that next buffer out. Why? // -// Because we know that, even if we got no more data in, we have enough // -// data in the first buffer to clip out the amount we want, so the other // -// half (which will have older data, being a circular buffer) can be // -// written out safely. // -// // -////////////////////////////////////////////////////////////////////////////// - -#include "hsTypes.h" -#include "plWAVClipBuffer.h" -#include "hsStream.h" -#include "hsUtils.h" - -#include "plAudioCore/plWavFile.h" - - -//// Constructor/Destructor ////////////////////////////////////////////////// - -plWAVClipBuffer::plWAVClipBuffer( UInt32 clipSize, CWaveFile *outFile ) -{ - fBuffers[ 0 ] = fBuffers[ 1 ] = nil; - fFlushCalled = true; - Init( clipSize, outFile ); -} - -plWAVClipBuffer::~plWAVClipBuffer() -{ - IShutdown(); -} - -//// Init & IShutdown //////////////////////////////////////////////////////// - -void plWAVClipBuffer::Init( UInt32 clipSize, CWaveFile *outFile ) -{ - IShutdown(); - if( clipSize > 0 ) - { - fBuffers[ 0 ] = TRACKED_NEW UInt8[ clipSize ]; - fBuffers[ 1 ] = TRACKED_NEW UInt8[ clipSize ]; - memset( fBuffers[ 0 ], 0, clipSize ); - memset( fBuffers[ 1 ], 0, clipSize ); - } - fWhichBuffer = 0; - fBufferSize = clipSize; - fCursor = 0; - fFirstFlip = true; - fOutFile = outFile; - fFlushCalled = false; -} - -void plWAVClipBuffer::IShutdown( void ) -{ - hsAssert( fFlushCalled, "WAVClipBuffer shut down without flushing it!!!" ); - - delete [] fBuffers[ 0 ]; - delete [] fBuffers[ 1 ]; -} - -//// WriteData /////////////////////////////////////////////////////////////// -// The main workhorse; call this to add data to the buffer. - -hsBool plWAVClipBuffer::WriteData( UInt32 size, UInt8 *data ) -{ - while( size > 0 ) - { - UInt32 toWrite = fBufferSize - fCursor; - if( size < toWrite ) - { - // Just write, haven't filled a buffer yet - memcpy( fBuffers[ fWhichBuffer ] + fCursor, data, size ); - data += size; - fCursor += size; - return true; // All done! - } - - // Fill up to the end of a buffer, then flip - memcpy( fBuffers[ fWhichBuffer ] + fCursor, data, toWrite ); - data += toWrite; - fCursor += toWrite; - size -= toWrite; - - // Flip now... - fWhichBuffer = 1 - fWhichBuffer; - fCursor = 0; - - // Now we can write out this buffer, since it'll be old data and - // we have enough in the other buffer to clip with. The *only* - // time we don't want to do this is the first time we flip, since - // at that point, the buffer we just flipped to hasn't been filled yet. - // (Every time afterwards, we'll always be flipping to a buffer with old - // data). - if( fFirstFlip ) - fFirstFlip = false; - else - { - // Write it out before we overwrite it! - UINT written; - HRESULT hr = fOutFile->Write( fBufferSize, fBuffers[ fWhichBuffer ], &written ); - - if( FAILED( hr ) ) - { - hsAssert( false, "ERROR writing WMA stream to WAV file" ); - return false; - } - else if( written != fBufferSize ) - { - hsAssert( false, "Unable to write all of WMA stream to WAV file" ); - return false; - } - } - } - - // Cleanly got here, so just return success - return true; -} - -//// Flush /////////////////////////////////////////////////////////////////// -// Writes out the remaining data, minus our clip value (which is fBufferSize) -// So here's our situation: at this point, one of two things could be true: -// -// 1) We haven't received enough data to clip by, at which point we don't -// write any more and bail (this will be true if fFirstFlip is still true) -// -// 2) Our cursor is at 0, which means we have one filled buffer that hasn't been -// written out and our current buffer is empty. At this point, we discard the -// filled buffer (which is precisely the length we want to clip by) and we're done. -// -// 3) The buffer we're on should be partially filled, while the other one is older -// data. So, we want to write out the older data and the partial buffer all the way, -// except for the clip size. Since we can therefore never write out any data in the -// partial buffer (since that count will always be less than the clip size and thus be -// the second half of what we clip), we simply figure out how much of the other one we -// clip and write out the rest. - -hsBool plWAVClipBuffer::Flush( void ) -{ - fFlushCalled = true; - - if( fFirstFlip ) - return false; // We failed--not enough data to clip with - - if( fCursor == 0 ) - { - // Our current buffer is empty, so the other buffer is precisely what we clip. - // So just discard and return successfully - return true; - } - - // The hard case--we always discard the partial buffer we're on, so figure out - // how much we want to save of the other buffer. The math is: - // Partial buffer amount we're clipping = fCursor - // Amount of other buffer we're clipping = fBufferSize - fCursor - // Amount of other buffer we're writing = fBufferSize - ( fBufferSize - fCursor ) = fCursor - // Go figure :) - - UInt32 toWrite = fCursor; - - UINT written; - HRESULT hr = fOutFile->Write( toWrite, fBuffers[ 1 - fWhichBuffer ], &written ); - - if( FAILED( hr ) ) - { - hsAssert( false, "ERROR writing WMA stream to WAV file" ); - return false; - } - else if( written != toWrite ) - { - hsAssert( false, "Unable to write all of WMA stream to WAV file" ); - return false; - } - - // All done! - return true; -} diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWAVClipBuffer.h b/Sources/Plasma/PubUtilLib/plAudio/plWAVClipBuffer.h deleted file mode 100644 index a631c703..00000000 --- a/Sources/Plasma/PubUtilLib/plAudio/plWAVClipBuffer.h +++ /dev/null @@ -1,78 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -////////////////////////////////////////////////////////////////////////////// -// // -// plWAVClipBuffer - Helper class for writing out WAV data in a buffered // -// manner, with support for clipping off the specified // -// amount at the end, but without knowing beforehand // -// exactly how much data we'll have. // -// // -// The algorithm goes something like this: we keep two buffers, both the // -// size of the amount we want to clip. We then start filling in the first // -// buffer, overflowing into the second buffer and wrapping back to the // -// first again in a circular fashion. When we fill up one buffer and are // -// about to advance to the next, we write that next buffer out. Why? // -// Because we know that, even if we got no more data in, we have enough // -// data in the first buffer to clip out the amount we want, so the other // -// half (which will have older data, being a circular buffer) can be // -// written out safely. // -// // -////////////////////////////////////////////////////////////////////////////// - -#ifndef _plWAVClipBuffer_h -#define _plWAVClipBuffer_h - -//// Class Definition //////////////////////////////////////////////////////// - -class CWaveFile; -class plWAVClipBuffer -{ -public: - - plWAVClipBuffer( UInt32 clipSize, CWaveFile *outFile ); - ~plWAVClipBuffer(); - - // Inits the buffer. Can re-init if you wish - void Init( UInt32 clipSize, CWaveFile *outFile ); - - // Writes/adds data to the buffer - hsBool WriteData( UInt32 size, UInt8 *data ); - - // Call at the end, flushes the buffer and performs the clipping - hsBool Flush( void ); - -protected: - UInt8 *fBuffers[ 2 ]; - UInt8 fWhichBuffer; // 0 or 1 - UInt32 fCursor, fBufferSize; - hsBool fFirstFlip, fFlushCalled; - - CWaveFile *fOutFile; - - void IShutdown( void ); -}; - -#endif //_plWAVClipBuffer_h diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plAudioCore/CMakeLists.txt index 3a2f0d4f..5bfab358 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plAudioCore/CMakeLists.txt @@ -10,6 +10,7 @@ include_directories(${Vorbis_INCLUDE_DIR}) set(plAudioCore_SOURCES plAudioFileReader.cpp plBufferedFileReader.cpp + plCachedFileReader.cpp plFastWavReader.cpp plOGGCodec.cpp plSoundBuffer.cpp @@ -22,6 +23,7 @@ set(plAudioCore_HEADERS plAudioCoreCreatable.h plAudioFileReader.h plBufferedFileReader.h + plCachedFileReader.h plFastWavReader.h plOGGCodec.h plSoundBuffer.h diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp index 7568754c..cafa6797 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp @@ -43,11 +43,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFile/plFileUtils.h" #include "plUnifiedTime/plUnifiedTime.h" #include "plBufferedFileReader.h" +#include "plCachedFileReader.h" #include "plFastWavReader.h" #include "plOGGCodec.h" #include "plWavFile.h" -#define kCacheDirName "streamingCache" +#define kCacheDirName "temp" static void hsStrUpper(char *s) { @@ -73,7 +74,14 @@ plAudioFileReader* plAudioFileReader::CreateReader(const char* path, plAudioCore { char cachedPath[256]; IGetCachedPath(path, cachedPath, whichChan); - plAudioFileReader *r = TRACKED_NEW plFastWAV(cachedPath, plAudioCore::kAll); + plAudioFileReader *r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll); + if (!r->IsValid()) { + // So we tried to play a cached file and it didn't exist + // Oops... we should cache it now + delete r; + ICacheFile(path, true, whichChan); + r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll); + } return r; } @@ -92,7 +100,7 @@ plAudioFileReader* plAudioFileReader::CreateWriter(const char* path, plWAVHeader { const char* ext = plFileUtils::GetFileExt(path); - plAudioFileReader* writer = TRACKED_NEW CWaveFile(path, plAudioCore::kAll); + plAudioFileReader* writer = TRACKED_NEW plCachedFileReader(path, plAudioCore::kAll); writer->OpenForWriting(path, header); return writer; } @@ -113,11 +121,11 @@ void plAudioFileReader::IGetCachedPath(const char* path, char* cachedPath, plAud strncat(cachedPath, fileName, fileExt-fileName-1); if (whichChan == plAudioCore::kLeft) - strcat(cachedPath, "-Left.wav"); + strcat(cachedPath, "-Left.tmp"); else if (whichChan == plAudioCore::kRight) - strcat(cachedPath, "-Right.wav"); + strcat(cachedPath, "-Right.tmp"); else if (whichChan == plAudioCore::kAll) - strcat(cachedPath, ".wav"); + strcat(cachedPath, ".tmp"); } void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCore::ChannelSelect whichChan) diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp new file mode 100644 index 00000000..2b812c93 --- /dev/null +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.cpp @@ -0,0 +1,184 @@ +/*==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +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 3 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, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + +*==LICENSE==*/ +////////////////////////////////////////////////////////////////////////////// +// // +// plCachedFileReader - Reads (and writes, how ironic) decompressed sound // +// data that is temporarily held in a cache. // +// // +//// NOTES /////////////////////////////////////////////////////////////////// +// // +// 2011.04.24 - Created by dpogue. // +// // +////////////////////////////////////////////////////////////////////////////// + +#include "hsTypes.h" +#include "plCachedFileReader.h" + +//// Constructor/Destructor ////////////////////////////////////////////////// + +plCachedFileReader::plCachedFileReader(const char *path, + plAudioCore::ChannelSelect whichChan) + : fFileHandle(nil), fCurPosition(0) +{ + hsAssert(path != nil, "Invalid path specified in plCachedFileReader"); + + strncpy(fFilename, path, sizeof(fFilename)); + + /// Open the file as a plain binary stream + fFileHandle = fopen(path, "rb"); + if (fFileHandle != nil) + { + if (fread(&fHeader, 1, sizeof(plWAVHeader), fFileHandle) + != sizeof(plWAVHeader)) + { + IError("Invalid WAV file header in plCachedFileReader"); + return; + } + + // Check format + if (fHeader.fFormatTag != kPCMFormatTag) + { + IError("Invalid format in plCachedFileReader"); + return; + } + + fseek(fFileHandle, 0, SEEK_END); + fDataLength = ftell(fFileHandle) - sizeof(plWAVHeader); + + fseek(fFileHandle, sizeof(plWAVHeader), SEEK_SET); + } +} + +plCachedFileReader::~plCachedFileReader() +{ + if (fFileHandle != nil) { + fclose(fFileHandle); + } +} + +void plCachedFileReader::IError(const char *msg) +{ + hsAssert(false, msg); + Close(); +} + +plWAVHeader &plCachedFileReader::GetHeader() +{ + hsAssert(IsValid(), "GetHeader() called on an invalid cache file"); + + return fHeader; +} + +void plCachedFileReader::Close() +{ + if (fFileHandle != nil) + { + fclose(fFileHandle); + fFileHandle = nil; + } +} + +UInt32 plCachedFileReader::GetDataSize() +{ + hsAssert(IsValid(), "GetDataSize() called on an invalid cache file"); + + return fDataLength; +} + +float plCachedFileReader::GetLengthInSecs() +{ + hsAssert(IsValid(), "GetLengthInSecs() called on an invalid cache file"); + + return (float)fDataLength / (float)fHeader.fAvgBytesPerSec; +} + +hsBool plCachedFileReader::SetPosition(UInt32 numBytes) +{ + hsAssert(IsValid(), "SetPosition() called on an invalid cache file"); + + fCurPosition = numBytes; + + hsAssert(fCurPosition <= fDataLength, "Invalid position while seeking"); + + return !fseek(fFileHandle, sizeof(plWAVHeader) + fCurPosition, SEEK_SET); +} + +hsBool plCachedFileReader::Read(UInt32 numBytes, void *buffer) +{ + hsAssert(IsValid(), "Read() called on an invalid cache file"); + + size_t numRead = fread(buffer, 1, numBytes, fFileHandle); + + fCurPosition += numRead; + hsAssert(fCurPosition <= fDataLength, "Invalid position while reading"); + + return numRead >= numBytes; +} + +UInt32 plCachedFileReader::NumBytesLeft() +{ + hsAssert(IsValid(), "NumBytesLeft() called on an invalid cache file"); + hsAssert(fCurPosition <= fDataLength, "Invalid position while reading"); + + return fDataLength - fCurPosition; +} + +hsBool plCachedFileReader::OpenForWriting(const char *path, plWAVHeader &header) +{ + hsAssert(path != nil, "Invalid path specified in plCachedFileReader"); + + fHeader = header; + fCurPosition = 0; + fDataLength = 0; + strncpy(fFilename, path, sizeof(fFilename)); + + /// Open the file as a plain binary stream + fFileHandle = fopen(path, "wb"); + + if (fFileHandle != nil) + { + if (fwrite(&fHeader, 1, sizeof(plWAVHeader), fFileHandle) + != sizeof(plWAVHeader)) + { + IError("Could not write WAV file header in plCachedFileReader"); + return false; + } + } + + return fFileHandle != nil; +} + +UInt32 plCachedFileReader::Write(UInt32 bytes, void* buffer) +{ + hsAssert(IsValid(), "Write() called on an invalid cache file"); + + size_t written = fwrite(buffer, 1, bytes, fFileHandle); + + fCurPosition += written; + fDataLength += written; + + return (UInt32)written; +} diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h new file mode 100644 index 00000000..287437d2 --- /dev/null +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plCachedFileReader.h @@ -0,0 +1,82 @@ +/*==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +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 3 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, see . + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + +*==LICENSE==*/ +////////////////////////////////////////////////////////////////////////////// +// // +// plCachedFileReader - Reads (and writes, how ironic) decompressed sound // +// data that is temporarily held in a cache. // +// // +//// NOTES /////////////////////////////////////////////////////////////////// +// // +// 2011.04.24 - Created by dpogue. // +// // +////////////////////////////////////////////////////////////////////////////// + +#ifndef _plcachedfilereader_h +#define _plcachedfilereader_h + +#include "plAudioFileReader.h" + +//// Class Definition //////////////////////////////////////////////////////// + +class plCachedFileReader : public plAudioFileReader +{ +public: + plCachedFileReader(const char *path, + plAudioCore::ChannelSelect whichChan = plAudioCore::kAll); + virtual ~plCachedFileReader(); + + virtual plWAVHeader &GetHeader(); + + virtual void Close(); + + virtual UInt32 GetDataSize(); + virtual float GetLengthInSecs(); + + virtual hsBool SetPosition(UInt32 numBytes); + virtual hsBool Read(UInt32 numBytes, void *buffer); + virtual UInt32 NumBytesLeft(); + + virtual hsBool OpenForWriting(const char *path, plWAVHeader &header); + virtual UInt32 Write(UInt32 bytes, void *buffer); + + virtual hsBool IsValid() { return fFileHandle != nil; } + +protected: + enum + { + kPCMFormatTag = 1 + }; + + char fFilename[512]; + FILE * fFileHandle; + plWAVHeader fHeader; + UInt32 fDataLength; + UInt32 fCurPosition; + + void IError(const char *msg); +}; + +#endif //_plcachedfilereader_h diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp index 116659c5..8a392ca6 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plOGGCodec.cpp @@ -33,9 +33,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // ////////////////////////////////////////////////////////////////////////////// -#include -#include -#include #include #include diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp index 4dd0724e..02afb0b1 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.cpp @@ -26,6 +26,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include "plWavFile.h" +#ifdef BUILDING_MAXPLUGIN + #ifdef DX_OLD_SDK #include #else @@ -1091,3 +1093,5 @@ public: }; #endif + +#endif // BUILDING_MAXPLUGIN diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h index 6d36cdf7..f88d81fb 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plWavFile.h @@ -26,6 +26,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plWavFile_H #define plWavFile_H +#ifdef BUILDING_MAXPLUGIN #define WAVEFILE_READ 1 #define WAVEFILE_WRITE 2 @@ -110,5 +111,6 @@ protected: HRESULT WriteMMIO( WAVEFORMATEX *pwfxDest ); HRESULT IClose(); }; +#endif // BUILDING_MAXPLUGIN #endif // plWavFile_H diff --git a/Sources/Tools/CMakeLists.txt b/Sources/Tools/CMakeLists.txt index 40049d08..b7581384 100644 --- a/Sources/Tools/CMakeLists.txt +++ b/Sources/Tools/CMakeLists.txt @@ -4,8 +4,6 @@ #add_subdirectory(plResBrowser) # Max Stuff goes below here... -option(3dsm_BUILD_PLUGIN "Do we want to build the 3ds Max plugin?" OFF) - if(3dsm_BUILD_PLUGIN) add_definitions(-DMAXPLUGINCODE) diff --git a/Sources/Tools/MaxMain/CMakeLists.txt b/Sources/Tools/MaxMain/CMakeLists.txt index dfd469e9..d39c5d25 100644 --- a/Sources/Tools/MaxMain/CMakeLists.txt +++ b/Sources/Tools/MaxMain/CMakeLists.txt @@ -203,6 +203,7 @@ if (WIN32) target_link_libraries(MaxMain Strmiids) target_link_libraries(MaxMain Vfw32) target_link_libraries(MaxMain Ws2_32) + target_link_libraries(MaxMain winmm) endif(WIN32) source_group("Header Files" FILES ${MaxMain_HEADERS}) diff --git a/cmake/FindMaxSDK.cmake b/cmake/FindMaxSDK.cmake index 90ebdff5..3a059d06 100644 --- a/cmake/FindMaxSDK.cmake +++ b/cmake/FindMaxSDK.cmake @@ -87,4 +87,9 @@ if (3dsm_FOUND) if(NOT 3dsm_FIND_QUIETLY) message(STATUS "Found 3ds Max SDK: ${3dsm_PATH}") endif() + + option(3dsm_BUILD_PLUGIN "Do we want to build the 3ds Max plugin?" OFF) + if (3dsm_BUILD_PLUGIN) + add_definitions(-DBUILDING_MAXPLUGIN) + endif() endif() \ No newline at end of file