From: <man...@us...> - 2013-09-03 13:11:40
|
Revision: 2627 http://sourceforge.net/p/modplug/code/2627 Author: manxorist Date: 2013-09-03 13:11:31 +0000 (Tue, 03 Sep 2013) Log Message: ----------- [Ref] Explicitly reset used channels mixer statistics externally to CSoundFile::Read(). Calculate statistics over the interval as maximum used channels instead of a approximation of average used channels. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-01 10:31:18 UTC (rev 2626) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-03 13:11:31 UTC (rev 2627) @@ -195,6 +195,7 @@ } } std::size_t module_impl::read_wrapper( std::size_t count, std::int16_t * left, std::int16_t * right, std::int16_t * rear_left, std::int16_t * rear_right ) { + m_sndFile->ResetMixStat(); std::size_t count_read = 0; while ( count > 0 ) { std::int16_t * const buffers[4] = { left + count_read, right + count_read, rear_left + count_read, rear_right + count_read }; @@ -212,6 +213,7 @@ return count_read; } std::size_t module_impl::read_wrapper( std::size_t count, float * left, float * right, float * rear_left, float * rear_right ) { + m_sndFile->ResetMixStat(); std::size_t count_read = 0; while ( count > 0 ) { float * const buffers[4] = { left + count_read, right + count_read, rear_left + count_read, rear_right + count_read }; @@ -229,6 +231,7 @@ return count_read; } std::size_t module_impl::read_interleaved_wrapper( std::size_t count, std::size_t channels, std::int16_t * interleaved ) { + m_sndFile->ResetMixStat(); std::size_t count_read = 0; while ( count > 0 ) { AudioReadTargetGainBuffer<std::int16_t> target(*m_Dither, interleaved + count_read * channels, 0, m_Gain); @@ -245,6 +248,7 @@ return count_read; } std::size_t module_impl::read_interleaved_wrapper( std::size_t count, std::size_t channels, float * interleaved ) { + m_sndFile->ResetMixStat(); std::size_t count_read = 0; while ( count > 0 ) { AudioReadTargetGainBuffer<float> target(*m_Dither, interleaved + count_read * channels, 0, m_Gain); @@ -599,7 +603,7 @@ return m_sndFile->m_nRow; } std::int32_t module_impl::get_current_playing_channels() const { - return m_sndFile->m_nMixChannels; + return m_sndFile->GetMixStat(); } float module_impl::get_current_channel_vu_left( std::int32_t channel ) const { if ( channel < 0 || channel >= m_sndFile->GetNumChannels() ) { Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-09-01 10:31:18 UTC (rev 2626) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-09-03 13:11:31 UTC (rev 2627) @@ -1059,8 +1059,10 @@ } // Add an entry to the notification history - Notification notification(notifyType, notifyItem, notificationtimestamp, m_pSndFile->m_nRow, m_pSndFile->m_nTickCount, m_pSndFile->m_nCurrentOrder, m_pSndFile->m_nPattern, m_pSndFile->m_nMixStat); + Notification notification(notifyType, notifyItem, notificationtimestamp, m_pSndFile->m_nRow, m_pSndFile->m_nTickCount, m_pSndFile->m_nCurrentOrder, m_pSndFile->m_nPattern, m_pSndFile->GetMixStat()); + m_pSndFile->ResetMixStat(); + if(m_pSndFile->m_SongFlags[SONG_ENDREACHED]) notification.type.set(Notification::EOS); if(notifyType[Notification::Sample]) Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-09-01 10:31:18 UTC (rev 2626) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-09-03 13:11:31 UTC (rev 2627) @@ -1591,7 +1591,7 @@ if (nsamples > 0) goto SampleLooping; nchmixed += addmix?1:0; } - m_nMixStat += nchused; + m_nMixStat = std::max<CHANNELINDEX>(m_nMixStat, nchused); } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-09-01 10:31:18 UTC (rev 2626) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-09-03 13:11:31 UTC (rev 2627) @@ -327,7 +327,9 @@ UINT m_nDefaultSpeed, m_nDefaultTempo, m_nDefaultGlobalVolume; FlagSet<SongFlags> m_SongFlags; CHANNELINDEX m_nMixChannels; - UINT m_nMixStat; +private: + CHANNELINDEX m_nMixStat; +public: samplecount_t m_nBufferCount; double m_dBufferDiff; UINT m_nTickCount; @@ -472,6 +474,8 @@ void PatternTransitionChnUnmuteAll(); double GetCurrentBPM() const; void DontLoopPattern(PATTERNINDEX nPat, ROWINDEX nRow = 0); //rewbs.playSongFromCursor + CHANNELINDEX GetMixStat() const { return m_nMixStat; } + void ResetMixStat() { m_nMixStat = 0; } void SetCurrentPos(UINT nPos); void SetCurrentOrder(ORDERINDEX nOrder); std::string GetTitle() const { return songName; } Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-09-01 10:31:18 UTC (rev 2626) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-09-03 13:11:31 UTC (rev 2627) @@ -96,6 +96,7 @@ { if(bReset) { + ResetMixStat(); gnDryLOfsVol = 0; gnDryROfsVol = 0; } @@ -145,8 +146,6 @@ { ALWAYS_ASSERT(m_MixerSettings.IsValid()); - int mixStatCount = 0; - bool mixPlugins = false; for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; ++i) { @@ -220,12 +219,6 @@ const samplecount_t countChunk = std::min<samplecount_t>(MIXBUFFERSIZE, std::min<samplecount_t>(m_nBufferCount, countToRender)); - if(mixStatCount == 0) - { // reset mixer channel count before we are calling CreateStereoMix the first time this round, if we are not updating the mixer state, we do not reset statistics - m_nMixStat = 0; - } - mixStatCount++; - CreateStereoMix(countChunk); #ifndef NO_REVERB @@ -269,11 +262,6 @@ // mix done - if(mixStatCount > 0) - { - m_nMixStat = (m_nMixStat + mixStatCount - 1) / mixStatCount; // round up - } - return countRendered; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-09-03 16:04:33
|
Revision: 2631 http://sourceforge.net/p/modplug/code/2631 Author: saga-games Date: 2013-09-03 16:04:23 +0000 (Tue, 03 Sep 2013) Log Message: ----------- [Fix] Re-implemented DSM loader (no more broken patterns + support for delta-encoded samples) [Mod] OpenMPT: Version is now 1.22.05.02 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Load_dsm.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-09-03 16:04:06 UTC (rev 2630) +++ trunk/OpenMPT/common/versionNumber.h 2013-09-03 16:04:23 UTC (rev 2631) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 05 -#define VER_MINORMINOR 01 +#define VER_MINORMINOR 02 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Load_dsm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_dsm.cpp 2013-09-03 16:04:06 UTC (rev 2630) +++ trunk/OpenMPT/soundlib/Load_dsm.cpp 2013-09-03 16:04:23 UTC (rev 2631) @@ -2,9 +2,8 @@ * Load_dsm.cpp * ------------ * Purpose: Digisound Interface Kit (DSIK) Internal Format (DSM) module loader - * Notes : (currently none) - * Authors: Olivier Lapicque - * OpenMPT Devs + * Notes : There is also another fundamentally different DSIK "DSM" module format, not handled here. + * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ @@ -16,301 +15,291 @@ #pragma pack(push, 1) #endif -#define DSMID_RIFF 0x46464952 // "RIFF" -#define DSMID_DSMF 0x464d5344 // "DSMF" -#define DSMID_SONG 0x474e4f53 // "SONG" -#define DSMID_INST 0x54534e49 // "INST" -#define DSMID_PATT 0x54544150 // "PATT" +struct PACKED DSMChunk +{ + char magic[4]; + uint32 size; + // Convert all multi-byte numeric values to current platform's endianness or vice versa. + void ConvertEndianness() + { + SwapBytesLE(size); + } +}; -typedef struct PACKED DSMNOTE -{ - BYTE note,ins,vol,cmd,inf; -} DSMNOTE; +STATIC_ASSERT(sizeof(DSMChunk) == 8); -STATIC_ASSERT(sizeof(DSMNOTE) == 5); - -typedef struct PACKED DSMSAMPLE +struct PACKED DSMSongHeader { - DWORD id_INST; - DWORD inst_len; - char filename[13]; - BYTE flags; - BYTE flags2; - BYTE volume; - DWORD length; - DWORD loopstart; - DWORD loopend; - DWORD reserved1; - WORD c2spd; - WORD reserved2; - char samplename[28]; -} DSMSAMPLE; + char songName[28]; + char reserved1[2]; + uint16 flags; + char reserved2[4]; + uint16 numOrders; + uint16 numSamples; + uint16 numPatterns; + uint16 numChannels; + uint8 globalVol; + uint8 mastervol; + uint8 speed; + uint8 bpm; + uint8 panPos[16]; + uint8 orders[128]; -STATIC_ASSERT(sizeof(DSMSAMPLE) == 72); + // Convert all multi-byte numeric values to current platform's endianness or vice versa. + void ConvertEndianness() + { + SwapBytesLE(flags); + SwapBytesLE(numOrders); + SwapBytesLE(numSamples); + SwapBytesLE(numPatterns); + SwapBytesLE(numChannels); + } +}; +STATIC_ASSERT(sizeof(DSMSongHeader) == 192); -typedef struct PACKED DSMFILEHEADER -{ - DWORD id_RIFF; // "RIFF" - DWORD riff_len; - DWORD id_DSMF; // "DSMF" - DWORD id_SONG; // "SONG" - DWORD song_len; -} DSMFILEHEADER; -STATIC_ASSERT(sizeof(DSMFILEHEADER) == 20); - - -typedef struct PACKED DSMFILEHEADERNORIFF +struct PACKED DSMSampleHeader { - DWORD id_DSMF; // "DSMF" - DWORD unknown1; - DWORD data_len; - DWORD unknown2; - DWORD id_SONG; // "SONG" - DWORD song_len; -} DSMFILEHEADERNORIFF; + char filename[13]; + uint8 flags; + char reserved1; + uint8 volume; + uint32 length; + uint32 loopStart; + uint32 loopEnd; + char reserved2[4]; + uint32 sampleRate; + char sampleName[28]; -STATIC_ASSERT(sizeof(DSMFILEHEADERNORIFF) == 24); + // Convert all multi-byte numeric values to current platform's endianness or vice versa. + void ConvertEndianness() + { + SwapBytesLE(length); + SwapBytesLE(loopStart); + SwapBytesLE(loopEnd); + SwapBytesLE(sampleRate); + } + // Convert a DSM sample header to OpenMPT's internal sample header. + void ConvertToMPT(ModSample &mptSmp) const + { + mptSmp.Initialize(); + mpt::String::Read<mpt::String::nullTerminated>(mptSmp.filename, filename); -typedef struct PACKED DSMSONG -{ - char songname[28]; - WORD reserved1; - WORD flags; - DWORD reserved2; - WORD numord; - WORD numsmp; - WORD numpat; - WORD numtrk; - BYTE globalvol; - BYTE mastervol; - BYTE speed; - BYTE bpm; - BYTE panpos[16]; - BYTE orders[128]; -} DSMSONG; + mptSmp.nC5Speed = sampleRate; + mptSmp.uFlags.set(CHN_LOOP, (flags & 1) != 0); + mptSmp.nLength = length; + mptSmp.nLoopStart = loopStart; + mptSmp.nLoopEnd = loopEnd; + mptSmp.nVolume = std::min(volume, uint8(64)) * 4; + } -STATIC_ASSERT(sizeof(DSMSONG) == 192); + // Retrieve the internal sample format flags for this sample. + SampleIO GetSampleFormat() const + { + SampleIO sampleIO( + SampleIO::_8bit, + SampleIO::mono, + SampleIO::littleEndian, + SampleIO::unsignedPCM); + if(flags & 0x40) + { + sampleIO |= SampleIO::deltaPCM; // fairlight.dsm by Comrade J + } else if(flags & 0x02) + { + sampleIO |= SampleIO::signedPCM; + } + return sampleIO; + } +}; +STATIC_ASSERT(sizeof(DSMSampleHeader) == 64); -typedef struct PACKED DSMPATT -{ - DWORD id_PATT; - DWORD patt_len; - BYTE dummy1; - BYTE dummy2; -} DSMPATT; -STATIC_ASSERT(sizeof(DSMPATT) == 10); - - #ifdef NEEDS_PRAGMA_PACK #pragma pack(pop) #endif -bool CSoundFile::ReadDSM(const LPCBYTE lpStream, const DWORD dwMemLength, ModLoadingFlags loadFlags) -//-------------------------------------------------------------------------------------------------- +bool CSoundFile::ReadDSM(FileReader &file, ModLoadingFlags loadFlags) +//------------------------------------------------------------------- { - DSMSONG *psong; - DWORD dwMemPos; - UINT nSmp; - PATTERNINDEX nPat; + file.Rewind(); - if(!lpStream || (dwMemLength < 1024)) + char fileMagic[3][4]; + file.ReadArray(fileMagic); + if(!memcmp(fileMagic[0], "RIFF", 4) + && !memcmp(fileMagic[2], "DSMF", 4)) { + // "Normal" DSM files with RIFF header + // <RIFF> <file size> <DSMF> + } else if(!memcmp(fileMagic[0], "DSMF", 4)) + { + // DSM files with alternative header + // <DSMF> <4 bytes, usually 4x NUL or RIFF> <file size> <4 bytes, usually DSMF but not always> + file.Skip(4); + } else + { return false; } - DSMFILEHEADER *pfh = (DSMFILEHEADER *)lpStream; - if(pfh->id_RIFF == DSMID_RIFF) + DSMChunk chunkHeader; + + file.ReadConvertEndianness(chunkHeader); + // Technically, the song chunk could be anywhere in the file, but we're going to simplify + // things by not using a chunk header here and just expect it to be right at the beginning. + if(memcmp(chunkHeader.magic, "SONG", 4)) { - if((pfh->riff_len + 8 > dwMemLength) || (pfh->riff_len < 1024) - || (pfh->id_DSMF != DSMID_DSMF) || (pfh->id_SONG != DSMID_SONG) - || (pfh->song_len > dwMemLength)) - { - return false; - } else if(loadFlags == onlyVerifyHeader) - { - return true; - } - psong = (DSMSONG *)(lpStream + sizeof(DSMFILEHEADER)); - dwMemPos = sizeof(DSMFILEHEADER) + pfh->song_len; - } else + return false; + } else if(loadFlags == onlyVerifyHeader) { - // without "RIFF" - DSMFILEHEADERNORIFF *pfh2 = (DSMFILEHEADERNORIFF *)lpStream; - if((pfh2->id_DSMF != DSMID_DSMF) || (pfh2->id_SONG != DSMID_SONG) - || (pfh2->song_len > dwMemLength)) - { - return false; - } else if(loadFlags == onlyVerifyHeader) - { - return true; - } - psong = (DSMSONG *)(lpStream + sizeof(DSMFILEHEADERNORIFF)); - dwMemPos = sizeof(DSMFILEHEADERNORIFF) + pfh2->song_len; + return true; } + DSMSongHeader songHeader; + file.ReadStructPartial(songHeader, chunkHeader.size); + songHeader.ConvertEndianness(); + InitializeGlobals(); + mpt::String::Read<mpt::String::maybeNullTerminated>(songName, songHeader.songName); m_nType = MOD_TYPE_DSM; - m_nChannels = psong->numtrk; - if (m_nChannels < 1) m_nChannels = 1; - if (m_nChannels > 16) m_nChannels = 16; - m_nSamples = psong->numsmp; - if (m_nSamples >= MAX_SAMPLES) m_nSamples = MAX_SAMPLES - 1; - m_nDefaultSpeed = psong->speed; - m_nDefaultTempo = psong->bpm; - m_nDefaultGlobalVolume = psong->globalvol << 2; - if ((!m_nDefaultGlobalVolume) || (m_nDefaultGlobalVolume > MAX_GLOBAL_VOLUME)) m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME; - if(psong->mastervol == 0x80) + m_nChannels = Clamp(songHeader.numChannels, uint16(1), uint16(16)); + m_nDefaultSpeed = songHeader.speed; + m_nDefaultTempo = songHeader.bpm; + m_nDefaultGlobalVolume = std::min(songHeader.globalVol, uint8(64)) * 4u; + if(!m_nDefaultGlobalVolume) m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME; + if(songHeader.mastervol == 0x80) { m_nSamplePreAmp = 256 / m_nChannels; } else { - m_nSamplePreAmp = psong->mastervol & 0x7F; + m_nSamplePreAmp = songHeader.mastervol & 0x7F; } - Order.ReadFromArray(psong->orders, psong->numord); - for (UINT iPan=0; iPan<16; iPan++) + // Read channel panning + for(CHANNELINDEX chn = 0; chn < 16; chn++) { - ChnSettings[iPan].Reset(); - ChnSettings[iPan].nPan = 0x80; - if (psong->panpos[iPan] <= 0x80) + ChnSettings[chn].Reset(); + if(songHeader.panPos[chn] <= 0x80) { - ChnSettings[iPan].nPan = psong->panpos[iPan] << 1; + ChnSettings[chn].nPan = songHeader.panPos[chn] * 2; } } - mpt::String::Read<mpt::String::maybeNullTerminated>(songName, psong->songname); + Order.ReadFromArray(songHeader.orders, songHeader.numOrders); - nPat = 0; - nSmp = 1; - while (dwMemPos < dwMemLength - 8) + // Read pattern and sample chunks + PATTERNINDEX patNum = 0; + while(file.ReadConvertEndianness(chunkHeader)) { - DSMPATT *ppatt = (DSMPATT *)(lpStream + dwMemPos); - DSMSAMPLE *pSmp = (DSMSAMPLE *)(lpStream+dwMemPos); - // Reading Patterns - if (ppatt->id_PATT == DSMID_PATT && (loadFlags & loadPatternData)) + FileReader chunk = file.GetChunk(chunkHeader.size); + + if(!memcmp(chunkHeader.magic, "PATT", 4) && (loadFlags & loadPatternData)) { - dwMemPos += 8; - if (dwMemPos + ppatt->patt_len >= dwMemLength) break; - DWORD dwPos = dwMemPos; - dwMemPos += ppatt->patt_len; - if(Patterns.Insert(nPat, 64)) - break; + // Read pattern + if(Patterns.Insert(patNum, 64)) + { + continue; + } + chunk.Skip(2); - ModCommand *m = Patterns[nPat]; - UINT row = 0; - while ((row < 64) && (dwPos + 2 <= dwMemPos)) + ROWINDEX row = 0; + PatternRow rowBase = Patterns[patNum]; + while(chunk.AreBytesLeft() && row < 64) { - UINT flag = lpStream[dwPos++]; - if (flag) + uint8 flag = chunk.ReadUint8(); + if(!flag) { - UINT ch = (flag & 0x0F) % m_nChannels; - if (flag & 0x80) + row++; + rowBase = Patterns[patNum].GetRow(row); + continue; + } + + CHANNELINDEX chn = (flag & 0x0F); + ModCommand dummy; + ModCommand &m = (chn < GetNumChannels() ? rowBase[chn] : dummy); + + if(flag & 0x80) + { + uint8 note = chunk.ReadUint8(); + if(note) { - UINT note = lpStream[dwPos++]; - if (note) - { - if (note <= 12*9) note += 12; - m[ch].note = (BYTE)note; - } + if(note <= 12 * 9) note += 11 + NOTE_MIN; + m.note = note; } - if (flag & 0x40) + } + if(flag & 0x40) + { + m.instr = chunk.ReadUint8(); + } + if (flag & 0x20) + { + m.volcmd = VOLCMD_VOLUME; + m.vol = std::min(chunk.ReadUint8(), uint8(64)); + } + if(flag & 0x10) + { + uint8 command = chunk.ReadUint8(); + uint8 param = chunk.ReadUint8(); + switch(command) { - m[ch].instr = lpStream[dwPos++]; - } - if (flag & 0x20) - { - m[ch].volcmd = VOLCMD_VOLUME; - m[ch].vol = lpStream[dwPos++]; - } - if (flag & 0x10) - { - UINT command = lpStream[dwPos++]; - UINT param = lpStream[dwPos++]; - switch(command) + // 4-bit Panning + case 0x08: + switch(param & 0xF0) { - // 4-bit Panning - case 0x08: - switch(param & 0xF0) - { - case 0x00: param <<= 4; break; - case 0x10: command = 0x0A; param = (param & 0x0F) << 4; break; - case 0x20: command = 0x0E; param = (param & 0x0F) | 0xA0; break; - case 0x30: command = 0x0E; param = (param & 0x0F) | 0x10; break; - case 0x40: command = 0x0E; param = (param & 0x0F) | 0x20; break; - default: command = 0; - } - break; + case 0x00: param <<= 4; break; + case 0x10: command = 0x0A; param = (param & 0x0F) << 4; break; + case 0x20: command = 0x0E; param = (param & 0x0F) | 0xA0; break; + case 0x30: command = 0x0E; param = (param & 0x0F) | 0x10; break; + case 0x40: command = 0x0E; param = (param & 0x0F) | 0x20; break; + default: command = 0; + } + break; // Portamentos - case 0x11: - case 0x12: - command &= 0x0F; - break; + case 0x11: + case 0x12: + command &= 0x0F; + break; // 3D Sound (?) - case 0x13: - command = 'X' - 55; - param = 0x91; - break; - default: - // Volume + Offset (?) + case 0x13: + command = 'X' - 55; + param = 0x91; + break; + default: + // Volume + Offset (?) + if(command > 0x10) command = ((command & 0xF0) == 0x20) ? 0x09 : 0; - } - m[ch].command = (BYTE)command; - m[ch].param = (BYTE)param; - if (command) ConvertModCommand(m[ch]); } - } else - { - m += m_nChannels; - row++; + if(command) + { + m.command = command; + m.param = param; + ConvertModCommand(m); + } } } - nPat++; - } else - // Reading Samples - if ((nSmp <= m_nSamples) && (pSmp->id_INST == DSMID_INST)) + patNum++; + } else if(!memcmp(chunkHeader.magic, "INST", 4) && GetNumSamples() < SAMPLEINDEX(MAX_SAMPLES - 1)) { - if (dwMemPos + pSmp->inst_len >= dwMemLength - 8) break; - DWORD dwPos = dwMemPos + sizeof(DSMSAMPLE); - dwMemPos += 8 + pSmp->inst_len; + // Read sample + m_nSamples++; + ModSample &sample = Samples[m_nSamples]; - ModSample &sample = Samples[nSmp]; - sample.Initialize(); + DSMSampleHeader sampleHeader; + chunk.ReadConvertEndianness(sampleHeader); + sampleHeader.ConvertToMPT(sample); - mpt::String::Read<mpt::String::maybeNullTerminated>(m_szNames[nSmp], pSmp->samplename); - mpt::String::Read<mpt::String::nullTerminated>(sample.filename, pSmp->filename); + mpt::String::Read<mpt::String::maybeNullTerminated>(m_szNames[m_nSamples], sampleHeader.sampleName); - sample.nC5Speed = pSmp->c2spd; - sample.uFlags.set(CHN_LOOP, (pSmp->flags & 1) != 0); - sample.nLength = pSmp->length; - sample.nLoopStart = pSmp->loopstart; - sample.nLoopEnd = pSmp->loopend; - sample.nVolume = (WORD)(pSmp->volume << 2); - if (sample.nVolume > 256) sample.nVolume = 256; - if(loadFlags & loadSampleData) { - FileReader chunk(lpStream + dwPos, dwMemLength - dwPos); - SampleIO( - SampleIO::_8bit, - SampleIO::mono, - SampleIO::littleEndian, - (pSmp->flags & 2) ? SampleIO::signedPCM : SampleIO::unsignedPCM) - .ReadSample(sample, chunk); + sampleHeader.GetSampleFormat().ReadSample(sample, chunk); } - - nSmp++; - } else - { - break; } } + return true; } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-09-03 16:04:06 UTC (rev 2630) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-09-03 16:04:23 UTC (rev 2631) @@ -710,7 +710,7 @@ && !ReadPTM(file, loadFlags) && !ReadUlt(file, loadFlags) && !ReadDMF(file, loadFlags) - && !ReadDSM(lpStream, dwMemLength, loadFlags) + && !ReadDSM(file, loadFlags) && !ReadUMX(file, loadFlags) && !ReadAMF_Asylum(file, loadFlags) && !ReadAMF_DSMI(file, loadFlags) Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-09-03 16:04:06 UTC (rev 2630) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-09-03 16:04:23 UTC (rev 2631) @@ -525,7 +525,7 @@ bool Read669(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); bool ReadUlt(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); bool ReadWav(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); - bool ReadDSM(const LPCBYTE lpStream, const DWORD dwMemLength, ModLoadingFlags loadFlags = loadCompleteModule); + bool ReadDSM(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); bool ReadFAR(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); bool ReadAMS(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); bool ReadAMS2(FileReader &file, ModLoadingFlags loadFlags = loadCompleteModule); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-03 19:15:30
|
Revision: 2632 http://sourceforge.net/p/modplug/code/2632 Author: manxorist Date: 2013-09-03 19:15:19 +0000 (Tue, 03 Sep 2013) Log Message: ----------- [Ref] Small type cleanups. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.h trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDevicePortAudio.h Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-03 16:04:23 UTC (rev 2631) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-03 19:15:19 UTC (rev 2632) @@ -410,7 +410,7 @@ m_CbnMixingFreq.ResetContent(); std::vector<bool> supportedRates; - std::vector<UINT> samplerates; + std::vector<uint32> samplerates; for(size_t i = 0; i < CountOf(nMixingRates); i++) { samplerates.push_back(nMixingRates[i]); Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-09-03 16:04:23 UTC (rev 2631) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-09-03 19:15:19 UTC (rev 2632) @@ -168,7 +168,7 @@ virtual int64 GetStreamPositionSamples() const { return 0; } virtual UINT GetCurrentSampleRate(UINT nDevice) { UNREFERENCED_PARAMETER(nDevice); return 0; } // Return which samplerates are actually supported by the device. Currently only implemented properly for ASIO. - virtual bool CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result) { UNREFERENCED_PARAMETER(nDevice); result.assign(samplerates.size(), true); return true; } ; + virtual bool CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result) { UNREFERENCED_PARAMETER(nDevice); result.assign(samplerates.size(), true); return true; } ; }; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-09-03 16:04:23 UTC (rev 2631) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-09-03 19:15:19 UTC (rev 2632) @@ -702,8 +702,8 @@ } -bool CASIODevice::CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result) -//------------------------------------------------------------------------------------------------------ +bool CASIODevice::CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result) +//------------------------------------------------------------------------------------------------------- { const bool wasOpen = (m_pAsioDrv != NULL); if(!wasOpen) Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2013-09-03 16:04:23 UTC (rev 2631) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2013-09-03 19:15:19 UTC (rev 2632) @@ -68,7 +68,7 @@ UINT GetNumBuffers() { return 2; } float GetCurrentRealLatencyMS() { return m_nAsioBufferLen * 2 * 1000.0f / m_Settings.Samplerate; } - bool CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result); + bool CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result); UINT GetCurrentSampleRate(UINT nDevice); public: Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-09-03 16:04:23 UTC (rev 2631) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-09-03 19:15:19 UTC (rev 2632) @@ -159,8 +159,8 @@ } -bool CPortaudioDevice::CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result) -//----------------------------------------------------------------------------------------------------------- +bool CPortaudioDevice::CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result) +//------------------------------------------------------------------------------------------------------------ { result.clear(); for(UINT n=0; n<samplerates.size(); n++) Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.h 2013-09-03 16:04:23 UTC (rev 2631) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.h 2013-09-03 19:15:19 UTC (rev 2632) @@ -57,7 +57,7 @@ float GetCurrentRealLatencyMS(); bool HasGetStreamPosition() const { return false; } int64 GetStreamPositionSamples() const; - bool CanSampleRate(UINT nDevice, std::vector<UINT> &samplerates, std::vector<bool> &result); + bool CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result); int StreamCallback( const void *input, void *output, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-05 14:21:20
|
Revision: 2634 http://sourceforge.net/p/modplug/code/2634 Author: manxorist Date: 2013-09-05 14:21:11 +0000 (Thu, 05 Sep 2013) Log Message: ----------- [Mod] libopenmpt: All strings are now returned in UTF-8 encoding. [Ref] xmp-openmpt: Adapt coded to always utf8. [Mod] openmpt123: Set console to UTF-8 mode to properly display hopefully all strings from the mod files. This breaks filename display (but non-ansi filenames where broken anyway before, will be fixed later). [Mod] in_openmpt: Strings are now returned in UTF-8. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-05 14:08:00 UTC (rev 2633) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-05 14:21:11 UTC (rev 2634) @@ -22,6 +22,10 @@ #include <cstdlib> #include <cstring> +#if !defined(WIN32) +#include <iconv.h> +#endif // !WIN32 + #include "soundlib/Sndfile.h" #include "soundlib/AudioReadTarget.h" #include "soundlib/FileReader.h" @@ -149,6 +153,58 @@ } } +std::string module_impl::mod_string_to_utf8( const std::string & encoded ) const { + std::string charset = m_sndFile->GetCharset().second; + #if defined(WIN32) + std::transform( charset.begin(), charset.end(), charset.begin(), tolower ); + UINT codepage = 0; + if ( charset == "" ) { + codepage = 20127; // us ascii fallback + } else if ( charset == "windows-1252" ) { + codepage = 1252; + } else if ( charset == "iso-8859-1" ) { + codepage = 28591; + } else if ( charset == "utf-8" ) { + codepage = 65001; + } else if ( charset == "us-ascii" ) { + codepage = 20127; + } else if ( charset == "cp437" ) { + codepage = 437; + } else { + codepage = 20127; // us ascii fallback + } + int required_size = 0; + required_size = MultiByteToWideChar( codepage, 0, encoded.c_str(), -1, NULL, 0 ); + if ( required_size <= 0 ) { + return std::string(); + } + std::vector<WCHAR> unicode_string( required_size ); + MultiByteToWideChar( codepage, 0, encoded.data(), -1, &unicode_string[0], unicode_string.size() ); + required_size = WideCharToMultiByte( CP_UTF8, 0, &unicode_string[0], -1, NULL, 0, NULL, NULL ); + if ( required_size <= 0 ) { + return std::string(); + } + std::vector<CHAR> utf8_string( required_size ); + WideCharToMultiByte( CP_UTF8, 0, &unicode_string[0], -1, &utf8_string[0], utf8_string.size(), NULL, NULL ); + return &utf8_string[0]; + #else + iconv_t conv = iconv_t(); + conv = iconv_open( "UTF-8", charset.c_str() ); + std::vector<char> utf8_string( ( encoded.length() + 1 ) * 8 ); // large enough + const char * inbuf = encoded.c_str(); + size_t inbytesleft = encoded.length() + 1; + char * outbuf = &utf8_string[0]; + size_t outbytesleft = utf8_string.size(); + if ( iconv( conv, encoded.c_str(), &inbuf, &inbytesleft, &outbuf, &outbytesleft ) < 0 ) { + iconv_close( conv ); + conv = iconv_t(); + return std::string(); + } + std::string result = &utf8_string[0]; + iconv_close( conv ); + conv = iconv_t(); + #endif +} void module_impl::apply_mixer_settings( std::int32_t samplerate, int channels ) { if ( static_cast<std::int32_t>( m_sndFile->m_MixerSettings.gdwMixingFreq ) != samplerate || @@ -540,7 +596,7 @@ } else if ( key == std::string("tracker") ) { return m_sndFile->madeWithTracker; } else if ( key == std::string("title") ) { - return m_sndFile->GetTitle(); + return mod_string_to_utf8( m_sndFile->GetTitle() ); } else if ( key == std::string("message") ) { std::string retval = m_sndFile->songMessage.GetFormatted( SongMessage::leLF ); if ( retval.empty() ) { @@ -571,7 +627,7 @@ retval = tmp.str(); } } - return retval; + return mod_string_to_utf8( retval ); } else if ( key == std::string("warnings") ) { std::ostringstream retval; bool first = true; @@ -640,14 +696,14 @@ std::vector<std::string> module_impl::get_subsong_names() const { std::vector<std::string> retval; for ( SEQUENCEINDEX i = 0; i < m_sndFile->Order.GetNumSequences(); ++i ) { - retval.push_back( m_sndFile->Order.GetSequence( i ).m_sName ); + retval.push_back( mod_string_to_utf8( m_sndFile->Order.GetSequence( i ).m_sName ) ); } return retval; } std::vector<std::string> module_impl::get_channel_names() const { std::vector<std::string> retval; for ( CHANNELINDEX i = 0; i < m_sndFile->GetNumChannels(); ++i ) { - retval.push_back( m_sndFile->ChnSettings[i].szName ); + retval.push_back( mod_string_to_utf8( m_sndFile->ChnSettings[i].szName ) ); } return retval; } @@ -656,7 +712,7 @@ for ( ORDERINDEX i = 0; i < m_sndFile->Order.GetLengthTailTrimmed(); ++i ) { PATTERNINDEX pat = m_sndFile->Order[i]; if ( m_sndFile->Patterns.IsValidIndex( pat ) ) { - retval.push_back( m_sndFile->Patterns[ m_sndFile->Order[i] ].GetName() ); + retval.push_back( mod_string_to_utf8( m_sndFile->Patterns[ m_sndFile->Order[i] ].GetName() ) ); } else { if ( pat == m_sndFile->Order.GetIgnoreIndex() ) { retval.push_back( "+++ skip" ); @@ -672,21 +728,21 @@ std::vector<std::string> module_impl::get_pattern_names() const { std::vector<std::string> retval; for ( PATTERNINDEX i = 0; i < m_sndFile->Patterns.GetNumPatterns(); ++i ) { - retval.push_back( m_sndFile->Patterns[i].GetName() ); + retval.push_back( mod_string_to_utf8( m_sndFile->Patterns[i].GetName() ) ); } return retval; } std::vector<std::string> module_impl::get_instrument_names() const { std::vector<std::string> retval; for ( INSTRUMENTINDEX i = 1; i <= m_sndFile->GetNumInstruments(); ++i ) { - retval.push_back( m_sndFile->GetInstrumentName( i ) ); + retval.push_back( mod_string_to_utf8( m_sndFile->GetInstrumentName( i ) ) ); } return retval; } std::vector<std::string> module_impl::get_sample_names() const { std::vector<std::string> retval; for ( SAMPLEINDEX i = 1; i <= m_sndFile->GetNumSamples(); ++i ) { - retval.push_back( m_sndFile->GetSampleName( i ) ); + retval.push_back( mod_string_to_utf8( m_sndFile->GetSampleName( i ) ) ); } return retval; } @@ -797,7 +853,10 @@ if ( ctl == "" ) { throw openmpt::exception("unknown ctl"); } else if ( ctl == "charset" ) { + /* return m_sndFile->GetCharset().second; + */ + return "UTF-8"; } throw openmpt::exception("unknown ctl"); } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp 2013-09-05 14:08:00 UTC (rev 2633) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.hpp 2013-09-05 14:21:11 UTC (rev 2634) @@ -64,6 +64,7 @@ void PushToCSoundFileLog( const std::string & text ) const; void PushToCSoundFileLog( int loglevel, const std::string & text ) const; private: + std::string mod_string_to_utf8( const std::string & encoded ) const; void apply_mixer_settings( std::int32_t samplerate, int channels ); void apply_libopenmpt_defaults(); void init( const std::map< std::string, std::string > & ctls ); Modified: trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-09-05 14:08:00 UTC (rev 2633) +++ trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-09-05 14:21:11 UTC (rev 2634) @@ -77,33 +77,7 @@ }; static std::string convert_to_native( const std::string & str, std::string encoding ) { - std::transform( encoding.begin(), encoding.end(), encoding.begin(), tolower ); - UINT codepage = 0; - if ( encoding == "" ) { - codepage = 20127; // us ascii fallback - } else if ( encoding == "windows-1252" ) { - codepage = 1252; - } else if ( encoding == "iso-8859-1" ) { - codepage = 28591; - } else if ( encoding == "utf-8" ) { - codepage = 65001; - } else if ( encoding == "us-ascii" ) { - codepage = 20127; - } else if ( encoding == "cp437" ) { - codepage = 437; - } else { - codepage = 20127; // us ascii fallback - } - std::vector<WCHAR> unicode_string( ( ( str.length() + 1 ) * 8 ) ); // sufficiently large enough; - int mbtowc_result = MultiByteToWideChar( codepage, 0, str.data(), -1, unicode_string.data(), unicode_string.size() ); - if ( mbtowc_result > 0 ) { - unicode_string.resize( mbtowc_result ); - } else { - unicode_string.clear(); - unicode_string.push_back( L' ' ); - unicode_string.push_back( L'\0' ); - } - char * native_string = xmpftext->Unicode( unicode_string.data(), -1 ); + char * native_string = xmpftext->Utf8( str.c_str(), -1 ); std::string result = native_string ? native_string : ""; if ( native_string ) { xmpfmisc->Free( native_string ); Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-09-05 14:08:00 UTC (rev 2633) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-09-05 14:21:11 UTC (rev 2634) @@ -1376,6 +1376,13 @@ static int main( int argc, char * argv [] ) { + #if defined(_MSC_VER) + + SetConsoleCP( 65001 ); // UTF-8 + SetConsoleOutputCP( 65001 ); // UTF-8 + + #endif + textout_dummy dummy_log; #if defined(_MSC_VER) @@ -1433,7 +1440,6 @@ if ( flags.mode == ModeUI ) { set_input_mode(); - } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-05 14:32:34
|
Revision: 2635 http://sourceforge.net/p/modplug/code/2635 Author: manxorist Date: 2013-09-05 14:32:28 +0000 (Thu, 05 Sep 2013) Log Message: ----------- [Fix] Fix unix compile. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/openmpt123/openmpt123.hpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-05 14:21:11 UTC (rev 2634) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-05 14:32:28 UTC (rev 2635) @@ -190,12 +190,13 @@ #else iconv_t conv = iconv_t(); conv = iconv_open( "UTF-8", charset.c_str() ); - std::vector<char> utf8_string( ( encoded.length() + 1 ) * 8 ); // large enough - const char * inbuf = encoded.c_str(); - size_t inbytesleft = encoded.length() + 1; + std::vector<char> encoded_string( encoded.c_str(), encoded.c_str() + encoded.length() + 1 ); + std::vector<char> utf8_string( encoded_string.size() * 8 ); // large enough + char * inbuf = &encoded_string[0]; + size_t inbytesleft = encoded_string.size(); char * outbuf = &utf8_string[0]; size_t outbytesleft = utf8_string.size(); - if ( iconv( conv, encoded.c_str(), &inbuf, &inbytesleft, &outbuf, &outbytesleft ) < 0 ) { + if ( iconv( conv, &inbuf, &inbytesleft, &outbuf, &outbytesleft ) == (size_t)-1 ) { iconv_close( conv ); conv = iconv_t(); return std::string(); @@ -203,6 +204,7 @@ std::string result = &utf8_string[0]; iconv_close( conv ); conv = iconv_t(); + return result; #endif } void module_impl::apply_mixer_settings( std::int32_t samplerate, int channels ) { Modified: trunk/OpenMPT/openmpt123/openmpt123.hpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.hpp 2013-09-05 14:21:11 UTC (rev 2634) +++ trunk/OpenMPT/openmpt123/openmpt123.hpp 2013-09-05 14:32:28 UTC (rev 2635) @@ -49,7 +49,7 @@ return; } public: - virtual void write( const std::string & text ) { + virtual void write( const std::string & /* text */ ) { return; } }; @@ -76,6 +76,8 @@ } }; +#if defined(_MSC_VER) + class textout_console : public textout { private: HANDLE handle; @@ -94,6 +96,8 @@ } }; +#endif // _MSC_VER + static inline float mpt_round( float val ) { if ( val >= 0.0f ) { return std::floor( val + 0.5f ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-06 12:05:55
|
Revision: 2639 http://sourceforge.net/p/modplug/code/2639 Author: manxorist Date: 2013-09-06 12:05:47 +0000 (Fri, 06 Sep 2013) Log Message: ----------- [Ref] sounddev: Remove support code for DirecTsound versions before v7. All supported windows versions have DX9 available. [Ref] sounddev: Remove code for delay-loading dsound.dll and link it directly instead. [Mod] Remove /wavex command line option. It forced the usage of WAVEFORMATEX even if DX7 was not available which was just a heuristic anyway. WAVEFORMATEX is used for > 16 bits/sample and > 2 channels sound output. This is available on all supported windows versions, thus enable it unconditionally. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-06 11:36:44 UTC (rev 2638) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-06 12:05:47 UTC (rev 2639) @@ -268,10 +268,6 @@ m_CbnChannels.ResetContent(); for(UINT channels = 4; channels >= 1; channels /= 2) { - if(channels > 2 && !theApp.IsWaveExEnabled()) - { - continue; - } wsprintf(s, "%s", gszChnCfgNames[(channels+2)/2-1]); UINT ndx = m_CbnChannels.AddString(s); m_CbnChannels.SetItemData(ndx, channels); @@ -297,10 +293,6 @@ m_CbnSampleFormat.EnableWindow(asio ? FALSE : TRUE); for(UINT bits = 40; bits >= 8; bits -= 8) { - if(bits > 16 && !theApp.IsWaveExEnabled() && !asio) - { - continue; - } if(bits == 40) { if(!asio || (asio && SampleFormatFloat32 == m_SampleFormat)) Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-09-06 11:36:44 UTC (rev 2638) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-09-06 12:05:47 UTC (rev 2639) @@ -269,13 +269,13 @@ //================================================ { public: - bool m_bNoAcm, m_bNoDls, m_bSafeMode, m_bWavEx, m_bNoPlugins, m_bDebug, + bool m_bNoAcm, m_bNoDls, m_bSafeMode, m_bNoPlugins, m_bDebug, m_bPortable, m_bNoSettingsOnNewVersion; public: CMPTCommandLineInfo() { - m_bNoAcm = m_bNoDls = m_bSafeMode = m_bWavEx = + m_bNoAcm = m_bNoDls = m_bSafeMode = m_bNoPlugins = m_bDebug = m_bNoSettingsOnNewVersion = m_bPortable = false; } virtual void ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast); @@ -290,7 +290,6 @@ if (!lstrcmpi(lpszParam, "nologo")) { m_bShowSplash = FALSE; return; } else if (!lstrcmpi(lpszParam, "nodls")) { m_bNoDls = true; return; } else if (!lstrcmpi(lpszParam, "noacm")) { m_bNoAcm = true; return; } else - if (!lstrcmpi(lpszParam, "wavex")) { m_bWavEx = true; return; } else if (!lstrcmpi(lpszParam, "noplugs")) { m_bNoPlugins = true; return; } else if (!lstrcmpi(lpszParam, "debug")) { m_bDebug = true; return; } else if (!lstrcmpi(lpszParam, "portable")) { m_bPortable = true; return; } else @@ -624,37 +623,11 @@ m_pModTemplate = NULL; m_pPluginManager = NULL; m_bInitialized = FALSE; - m_bExWaveSupport = FALSE; m_bDebugMode = FALSE; m_szConfigFileName[0] = 0; } -///////////////////////////////////////////////////////////////////////////// -// GetDSoundVersion -static DWORD GetDSoundVersion() -//----------------------------- -{ - DWORD dwVersion = 0x600; - HKEY key = NULL; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectX", 0, KEY_READ, &key) == ERROR_SUCCESS) - { - CHAR szVersion[32] = ""; - DWORD dwSize = sizeof(szVersion); - DWORD dwType = REG_SZ; - if (RegQueryValueEx(key, "Version", NULL, &dwType, (LPBYTE)szVersion, &dwSize) == ERROR_SUCCESS) - { - // "4.06.03.xxxx" - dwVersion = ((szVersion[3] - '0') << 8) | ((szVersion[5] - '0') << 4) | ((szVersion[6] - '0')); - if (dwVersion < 0x600) dwVersion = 0x600; - if (dwVersion > 0x800) dwVersion = 0x800; - } - RegCloseKey(key); - } - return dwVersion; -} - - ///////////////////////////////////////////////////////////////////////////// // CTrackApp initialization @@ -830,7 +803,6 @@ // Parse command line for standard shell commands, DDE, file open CMPTCommandLineInfo cmdInfo; - if (GetDSoundVersion() >= 0x0700) cmdInfo.m_bWavEx = true; ParseCommandLine(cmdInfo); TrackerSettings::Instance().noACM = cmdInfo.m_bNoAcm; @@ -895,8 +867,7 @@ // Register MOD extensions //RegisterExtensions(); - // Load DirectSound (if available) - m_bExWaveSupport = cmdInfo.m_bWavEx; + // Load sound APIs SndDevInitialize(); // Load DLS Banks Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2013-09-06 11:36:44 UTC (rev 2638) +++ trunk/OpenMPT/mptrack/Mptrack.h 2013-09-06 12:05:47 UTC (rev 2639) @@ -111,7 +111,7 @@ protected: CMultiDocTemplate *m_pModTemplate; CVstPluginManager *m_pPluginManager; - BOOL m_bInitialized, m_bExWaveSupport, m_bDebugMode; + BOOL m_bInitialized, m_bDebugMode; DWORD m_dwTimeStarted, m_dwLastPluginIdleCall; // Default macro configuration MIDIMacroConfig m_MidiCfg; @@ -157,7 +157,6 @@ CVstPluginManager *GetPluginManager() const { return m_pPluginManager; } void GetDefaultMidiMacro(MIDIMacroConfig &cfg) const { cfg = m_MidiCfg; } void SetDefaultMidiMacro(const MIDIMacroConfig &cfg) { m_MidiCfg = cfg; } - BOOL IsWaveExEnabled() const { return m_bExWaveSupport; } BOOL IsDebug() const { return m_bDebugMode; } LPCTSTR GetConfigFileName() const { return m_szConfigFileName; } bool IsPortableMode() { return m_bPortableMode; } Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-09-06 11:36:44 UTC (rev 2638) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-09-06 12:05:47 UTC (rev 2639) @@ -84,7 +84,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib ../include/flac/lib/libFLAC_staticd.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib ../include/flac/lib/libFLAC_staticd.lib" OutputFile=".\Debug/mptrack.exe" Version="5.0" LinkIncremental="2" @@ -191,7 +191,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib ../include/flac/lib/libFLAC_static.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib ../include/flac/lib/libFLAC_static.lib" OutputFile=".\Bin/mptrack.exe" Version="5.0" LinkIncremental="1" Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-09-06 11:36:44 UTC (rev 2638) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-09-06 12:05:47 UTC (rev 2639) @@ -102,7 +102,7 @@ </ResourceCompile> <Link> <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>.\Debug/mptrack.exe</OutputFile> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> @@ -163,7 +163,7 @@ </ResourceCompile> <Link> <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> @@ -227,7 +227,7 @@ </ResourceCompile> <Link> <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> Modified: trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2013-09-06 11:36:44 UTC (rev 2638) +++ trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2013-09-06 12:05:47 UTC (rev 2639) @@ -32,12 +32,6 @@ #define MAX_DSOUND_DEVICES 16 -typedef BOOL (WINAPI * LPDSOUNDENUMERATE)(LPDSENUMCALLBACK lpDSEnumCallback, LPVOID lpContext); -typedef HRESULT (WINAPI * LPDSOUNDCREATE)(GUID * lpGuid, LPDIRECTSOUND * ppDS, IUnknown * pUnkOuter); - -static HINSTANCE ghDSoundDLL = NULL; -static LPDSOUNDENUMERATE gpDSoundEnumerate = NULL; -static LPDSOUNDCREATE gpDSoundCreate = NULL; static BOOL gbDSoundEnumerated = FALSE; static UINT gnDSoundDevices = 0; static GUID *glpDSoundGUID[MAX_DSOUND_DEVICES]; @@ -67,10 +61,9 @@ BOOL CDSoundDevice::EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize) //---------------------------------------------------------------------------------- { - if (!gpDSoundEnumerate) return FALSE; - if (!gbDSoundEnumerated) + if(!gbDSoundEnumerated) { - gpDSoundEnumerate((LPDSENUMCALLBACK)DSEnumCallback, NULL); + DirectSoundEnumerate(DSEnumCallback, NULL); } if (nIndex >= gnDSoundDevices) return FALSE; lstrcpyn(pszDescription, gszDSoundDrvNames[nIndex], cbSize); @@ -109,12 +102,11 @@ DSBCAPS dsc; UINT nPriorityLevel = (m_Settings.fulCfgOptions & SNDDEV_OPTIONS_EXCLUSIVE) ? DSSCL_WRITEPRIMARY : DSSCL_PRIORITY; - if (m_piDS) return true; - if (!gpDSoundEnumerate) return false; - if (!gbDSoundEnumerated) gpDSoundEnumerate((LPDSENUMCALLBACK)DSEnumCallback, NULL); - if ((nDevice >= gnDSoundDevices) || (!gpDSoundCreate)) return false; - if (gpDSoundCreate(glpDSoundGUID[nDevice], &m_piDS, NULL) != DS_OK) return false; - if (!m_piDS) return false; + if(m_piDS) return true; + if(!gbDSoundEnumerated) DirectSoundEnumerate(DSEnumCallback, NULL); + if(nDevice >= gnDSoundDevices) return false; + if(DirectSoundCreate(glpDSoundGUID[nDevice], &m_piDS, NULL) != DS_OK) return false; + if(!m_piDS) return false; m_piDS->SetCooperativeLevel(m_Settings.hWnd, nPriorityLevel); m_bMixRunning = FALSE; m_nDSoundBufferSize = (m_Settings.LatencyMS * pwfx->nAvgBytesPerSec) / 1000; @@ -356,11 +348,6 @@ BOOL SndDevDSoundInitialize() //--------------------------- { - if (ghDSoundDLL) return TRUE; - if ((ghDSoundDLL = LoadLibrary("dsound.dll")) == NULL) return FALSE; - static_assert(sizeof(TCHAR) == 1, "Check DirectSoundEnumerateA below"); - if ((gpDSoundEnumerate = (LPDSOUNDENUMERATE)GetProcAddress(ghDSoundDLL, "DirectSoundEnumerateA")) == NULL) return FALSE; - if ((gpDSoundCreate = (LPDSOUNDCREATE)GetProcAddress(ghDSoundDLL, "DirectSoundCreate")) == NULL) return FALSE; MemsetZero(glpDSoundGUID); return TRUE; } @@ -369,13 +356,6 @@ BOOL SndDevDSoundUninitialize() //----------------------------- { - gpDSoundEnumerate = NULL; - gpDSoundCreate = NULL; - if (ghDSoundDLL) - { - FreeLibrary(ghDSoundDLL); - ghDSoundDLL = NULL; - } for (UINT i=0; i<MAX_DSOUND_DEVICES; i++) { if (glpDSoundGUID[i]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-06 15:22:26
|
Revision: 2642 http://sourceforge.net/p/modplug/code/2642 Author: manxorist Date: 2013-09-06 15:22:10 +0000 (Fri, 06 Sep 2013) Log Message: ----------- Merged revision(s) 2606, 2609-2610, 2614, 2616, 2621, 2624, 2641 from branches/manx/premake: [Ref] Replace all project files for external libraries in include/ with project files which are generated via premake4. Add corresponding premake4 files. Adopt mptrack and libopenmpt project and solution files for VS2010 to new project files. This also adds 64bit project configurations for all VS2010 external projects. Each library is built in 3 versions, Debug,Release,Normal. Debug and Release correspond to the standard VS build configurations. Normal is the same as Release, but with link time code generation disabled for increased build speeds. VS2008 projects are broken with the premake conversion - they will be fixed later. ........ [Ref] Convert VS2008 mptrack solution to premake4-generated library project files. ........ [Fix] Work-around premake quote escaping stupidity. ........ [Ref] libopenmpt: Support compiling without including windows.h on Windows (when MO3 support is disabled which would require LoadLibrary()). ........ [Ref] Add portmidi 217 sourcecode. [Ref] Add premake4 project file for portmidi. [Ref] Build midi i/o plugin with premake4 portmidi project. [Ref] Add midi i/o plugin to VS2010 mptrack solution. [Ref] Remove MIDI Tools.sln. [Fix] Fix compilation of MidiInOut.h . ........ [Ref] libopenmpt: Silence linker warnings by setting /LTCG and using release-build external libraries. [Ref] openmtp123: Silence linker warnings by setting /LTCG and using release-build external libraries. ........ [Ref] Silence a warning in portaudio code. ........ [Fix] Fix debug build of midi i/o plugin. ........ Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/include/flac/OpenMPT.txt trunk/OpenMPT/include/lhasa/OpenMPT.txt trunk/OpenMPT/include/lhasa/lhasa.vcproj trunk/OpenMPT/include/lhasa/lhasa.vcxproj trunk/OpenMPT/include/lhasa/lhasa.vcxproj.filters trunk/OpenMPT/include/portaudio/OpenMPT.txt trunk/OpenMPT/include/readme.txt trunk/OpenMPT/include/soundtouch/OpenMPT.txt trunk/OpenMPT/include/soundtouch/soundtouch.vcproj trunk/OpenMPT/libopenmpt/libopenmpt.sln trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.sln trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.vcxproj trunk/OpenMPT/mptrack/MPTRACK_08.sln trunk/OpenMPT/mptrack/MPTRACK_10.sln trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/openmpt123/openmpt123.sln trunk/OpenMPT/openmpt123/openmpt123.vcxproj trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h trunk/OpenMPT/plugins/MidiInOut/MidiInOut.vcxproj trunk/OpenMPT/soundlib/load_j2b.cpp trunk/OpenMPT/unarchiver/ungzip.cpp trunk/OpenMPT/unarchiver/unzip.cpp Added Paths: ----------- trunk/OpenMPT/include/flac/flac.vcproj trunk/OpenMPT/include/flac/flac.vcxproj trunk/OpenMPT/include/flac/flac.vcxproj.filters trunk/OpenMPT/include/portaudio/portaudio.vcproj trunk/OpenMPT/include/portaudio/portaudio.vcxproj trunk/OpenMPT/include/portaudio/portaudio.vcxproj.filters trunk/OpenMPT/include/portmidi/ALL_BUILD.vcproj trunk/OpenMPT/include/portmidi/CHANGELOG.txt trunk/OpenMPT/include/portmidi/CMakeLists.txt trunk/OpenMPT/include/portmidi/Doxyfile trunk/OpenMPT/include/portmidi/README.txt trunk/OpenMPT/include/portmidi/ZERO_CHECK.vcproj trunk/OpenMPT/include/portmidi/license.txt trunk/OpenMPT/include/portmidi/pm_cl/ trunk/OpenMPT/include/portmidi/pm_common/ trunk/OpenMPT/include/portmidi/pm_csharp/ trunk/OpenMPT/include/portmidi/pm_dylib/ trunk/OpenMPT/include/portmidi/pm_java/ trunk/OpenMPT/include/portmidi/pm_linux/ trunk/OpenMPT/include/portmidi/pm_mac/ trunk/OpenMPT/include/portmidi/pm_mingw/ trunk/OpenMPT/include/portmidi/pm_python/ trunk/OpenMPT/include/portmidi/pm_qt/ trunk/OpenMPT/include/portmidi/pm_test/ trunk/OpenMPT/include/portmidi/pm_win/ trunk/OpenMPT/include/portmidi/portmidi.sln trunk/OpenMPT/include/portmidi/portmidi.vcproj trunk/OpenMPT/include/portmidi/portmidi.vcxproj trunk/OpenMPT/include/portmidi/portmidi.vcxproj.filters trunk/OpenMPT/include/portmidi/portmidi_cdt.zip trunk/OpenMPT/include/portmidi/portmusic_logo.png trunk/OpenMPT/include/portmidi/porttime/ trunk/OpenMPT/include/premake4-defaults.lua trunk/OpenMPT/include/premake4.lua trunk/OpenMPT/include/smbPitchShift/smbPitchShift.vcproj trunk/OpenMPT/include/smbPitchShift/smbPitchShift.vcxproj trunk/OpenMPT/include/smbPitchShift/smbPitchShift.vcxproj.filters trunk/OpenMPT/include/soundtouch/soundtouch.vcxproj trunk/OpenMPT/include/soundtouch/soundtouch.vcxproj.filters trunk/OpenMPT/include/update_premake4_projects.cmd trunk/OpenMPT/include/zlib/minizip.vcproj trunk/OpenMPT/include/zlib/minizip.vcxproj trunk/OpenMPT/include/zlib/minizip.vcxproj.filters trunk/OpenMPT/include/zlib/zlib.vcproj trunk/OpenMPT/include/zlib/zlib.vcxproj trunk/OpenMPT/include/zlib/zlib.vcxproj.filters Removed Paths: ------------- trunk/OpenMPT/include/smbPitchShift/xsoundlib_08.vcproj trunk/OpenMPT/include/smbPitchShift/xsoundlib_10.vcxproj trunk/OpenMPT/include/smbPitchShift/xsoundlib_10.vcxproj.filters trunk/OpenMPT/include/soundtouch/soundtouch_08.vcproj trunk/OpenMPT/include/soundtouch/soundtouch_10.vcxproj trunk/OpenMPT/include/soundtouch/soundtouch_10.vcxproj.filters trunk/OpenMPT/plugins/MIDI Tools.sln Property Changed: ---------------- trunk/OpenMPT/ trunk/OpenMPT/include/ trunk/OpenMPT/include/flac/ trunk/OpenMPT/include/lhasa/ trunk/OpenMPT/include/portaudio/ trunk/OpenMPT/include/portmidi/ trunk/OpenMPT/include/smbPitchShift/ trunk/OpenMPT/include/soundtouch/ trunk/OpenMPT/include/zlib/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT 2013-09-06 15:22:10 UTC (rev 2642) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -4,6 +4,7 ## /branches/manx/instrument-fields-fixes:2203-2238 /branches/manx/mptstring-stdstring-support:2204,2208,2212,2214,2217,2220,2224,2259,2261-2262,2264,2267 /branches/manx/nonglobal-mixer:1715-1841 +/branches/manx/premake:2606,2609-2610,2614,2616,2621,2624,2641 /branches/manx/profiler:1813 /branches/manx/project-files-cleanups:1378-1382 /branches/manx/sampleformat-ref:2554-2582 \ No newline at end of property Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/common/BuildSettings.h 2013-09-06 15:22:10 UTC (rev 2642) @@ -174,6 +174,11 @@ // fixing stuff up +#if !defined(MODPLUG_TRACKER) && defined(NO_MO3) +// For library builds, windows.h is only required for LoadLibrary, +#define NO_WINDOWS_H +#endif + #if !defined(ENABLE_MMX) && !defined(NO_REVERB) #define NO_REVERB // reverb requires mmx #endif Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/common/typedefs.h 2013-09-06 15:22:10 UTC (rev 2642) @@ -271,7 +271,7 @@ -#if defined(_WIN32) +#if !defined(NO_WINDOWS_H) #ifndef NOMINMAX #define NOMINMAX Index: trunk/OpenMPT/include =================================================================== --- trunk/OpenMPT/include 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/include 2013-09-06 15:22:10 UTC (rev 2642) Property changes on: trunk/OpenMPT/include ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,7 ## +*.sdf +*.suo +bin +include.sln +includeDLL.sln +ipch +premake4.exe Added: svn:global-ignores ## -0,0 +1 ## +premake4.exe Index: trunk/OpenMPT/include/flac =================================================================== --- trunk/OpenMPT/include/flac 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/include/flac 2013-09-06 15:22:10 UTC (rev 2642) Property changes on: trunk/OpenMPT/include/flac ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,2 ## +*.user +obj Added: svn:global-ignores ## -0,0 +1 ## +obj Modified: trunk/OpenMPT/include/flac/OpenMPT.txt =================================================================== --- trunk/OpenMPT/include/flac/OpenMPT.txt 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/include/flac/OpenMPT.txt 2013-09-06 15:22:10 UTC (rev 2642) @@ -1,20 +1,5 @@ The FLAC package has been left pretty much untouched, except for a few changes: - Obviously, unnecessary folders and files (documentation, makefiles, etc.) have been removed. -- The existing libFLAC_static project files have been upgraded to VS2008 and - VS2010. The following changes have been made: - - Output directory for the library has been changed to ..\..\lib\ - - Output filename has been changed to ..\..\lib\libFLAC_staticd.lib (debug) - and ..\..\lib\libFLAC_static.lib (release). - - ASM files and nasm.h have been excluded from the project to be able to - compile without NASM. - - *ogg*.c/h files have been excluded from the project to be able to compile - without libvorbis. - - The following preprocessor directives have been removed from both debug - and release configurations: FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM - - Debug configurations have been changed to use a multi-threaded debug DLL - runtime library (/MDd) - - x64 project configurations have been added for VS2010. - These are based on the modified x86 ones, which output filesnames and - directories suffixed by '64'. FLAC__USE_3DNOW is removed for x64. - - A c implementation for local_swap32_block_ if !_M_IX86 has been added. +- For building, premake4 is used to generate Visual Studio project files. + See ../premake4.lua for details. Copied: trunk/OpenMPT/include/flac/flac.vcproj (from rev 2606, branches/manx/premake/include/flac/flac.vcproj) =================================================================== --- trunk/OpenMPT/include/flac/flac.vcproj (rev 0) +++ trunk/OpenMPT/include/flac/flac.vcproj 2013-09-06 15:22:10 UTC (rev 2642) @@ -0,0 +1,708 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="flac" + ProjectGUID="{E599F5AA-F9A3-46CC-8DB0-C8DEFCEB90C5}" + RootNamespace="flac" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="DebugLib|Win32" + OutputDirectory="..\bin\DebugLib" + IntermediateDirectory="obj\x32\DebugLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="include;src\libFLAC\include" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\flac.pdb" + DebugInformationFormat="4" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="include;src\libFLAC\include" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\flac.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="DebugLib|x64" + OutputDirectory="..\bin\DebugLib" + IntermediateDirectory="obj\x64\DebugLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="include;src\libFLAC\include" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\flac64.pdb" + DebugInformationFormat="3" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="include;src\libFLAC\include" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\flac64.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="NormalLib|Win32" + OutputDirectory="..\bin\NormalLib" + IntermediateDirectory="obj\x32\NormalLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/GL- /MP" + Optimization="3" + AdditionalIncludeDirectories="include;src\libFLAC\include" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\flac.pdb" + DebugInformationFormat="3" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="include;src\libFLAC\include" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\flac.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="NormalLib|x64" + OutputDirectory="..\bin\NormalLib" + IntermediateDirectory="obj\x64\NormalLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/GL- /MP" + Optimization="3" + AdditionalIncludeDirectories="include;src\libFLAC\include" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\flac64.pdb" + DebugInformationFormat="3" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="include;src\libFLAC\include" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\flac64.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="ReleaseLib|Win32" + OutputDirectory="..\bin\ReleaseLib" + IntermediateDirectory="obj\x32\ReleaseLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/MP" + Optimization="3" + AdditionalIncludeDirectories="include;src\libFLAC\include" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\flac.pdb" + DebugInformationFormat="3" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="include;src\libFLAC\include" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\flac.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="ReleaseLib|x64" + OutputDirectory="..\bin\ReleaseLib" + IntermediateDirectory="obj\x64\ReleaseLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/MP" + Optimization="3" + AdditionalIncludeDirectories="include;src\libFLAC\include" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + FloatingPointModel="2" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\flac64.pdb" + DebugInformationFormat="3" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="FLAC__NO_DLL;VERSION=\"1.2.1\";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="include;src\libFLAC\include" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\flac64.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="src" + Filter="" + > + <Filter + Name="libFLAC" + Filter="" + > + <Filter + Name="include" + Filter="" + > + <Filter + Name="private" + Filter="" + > + <File + RelativePath="src\libFLAC\include\private\all.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\bitmath.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\bitreader.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\bitwriter.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\cpu.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\crc.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\fixed.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\float.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\format.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\lpc.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\md5.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\memory.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\metadata.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\stream_encoder_framing.h" + > + </File> + <File + RelativePath="src\libFLAC\include\private\window.h" + > + </File> + </Filter> + <Filter + Name="protected" + Filter="" + > + <File + RelativePath="src\libFLAC\include\protected\all.h" + > + </File> + <File + RelativePath="src\libFLAC\include\protected\stream_decoder.h" + > + </File> + <File + RelativePath="src\libFLAC\include\protected\stream_encoder.h" + > + </File> + </Filter> + </Filter> + <File + RelativePath="src\libFLAC\bitmath.c" + > + </File> + <File + RelativePath="src\libFLAC\bitreader.c" + > + </File> + <File + RelativePath="src\libFLAC\bitwriter.c" + > + </File> + <File + RelativePath="src\libFLAC\cpu.c" + > + </File> + <File + RelativePath="src\libFLAC\crc.c" + > + </File> + <File + RelativePath="src\libFLAC\fixed.c" + > + </File> + <File + RelativePath="src\libFLAC\float.c" + > + </File> + <File + RelativePath="src\libFLAC\format.c" + > + </File> + <File + RelativePath="src\libFLAC\lpc.c" + > + </File> + <File + RelativePath="src\libFLAC\md5.c" + > + </File> + <File + RelativePath="src\libFLAC\memory.c" + > + </File> + <File + RelativePath="src\libFLAC\metadata_iterators.c" + > + </File> + <File + RelativePath="src\libFLAC\metadata_object.c" + > + </File> + <File + RelativePath="src\libFLAC\stream_decoder.c" + > + </File> + <File + RelativePath="src\libFLAC\stream_encoder.c" + > + </File> + <File + RelativePath="src\libFLAC\stream_encoder_framing.c" + > + </File> + <File + RelativePath="src\libFLAC\window.c" + > + </File> + </Filter> + </Filter> + <Filter + Name="include" + Filter="" + > + <Filter + Name="FLAC" + Filter="" + > + <File + RelativePath="include\FLAC\all.h" + > + </File> + <File + RelativePath="include\FLAC\assert.h" + > + </File> + <File + RelativePath="include\FLAC\callback.h" + > + </File> + <File + RelativePath="include\FLAC\export.h" + > + </File> + <File + RelativePath="include\FLAC\format.h" + > + </File> + <File + RelativePath="include\FLAC\metadata.h" + > + </File> + <File + RelativePath="include\FLAC\ordinals.h" + > + </File> + <File + RelativePath="include\FLAC\stream_decoder.h" + > + </File> + <File + RelativePath="include\FLAC\stream_encoder.h" + > + </File> + </Filter> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Copied: trunk/OpenMPT/include/flac/flac.vcxproj (from rev 2606, branches/manx/premake/include/flac/flac.vcxproj) =================================================================== --- trunk/OpenMPT/include/flac/flac.vcxproj (rev 0) +++ trunk/OpenMPT/include/flac/flac.vcxproj 2013-09-06 15:22:10 UTC (rev 2642) @@ -0,0 +1,358 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="DebugLib|Win32"> + <Configuration>DebugLib</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="DebugLib|x64"> + <Configuration>DebugLib</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="NormalLib|Win32"> + <Configuration>NormalLib</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="NormalLib|x64"> + <Configuration>NormalLib</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="ReleaseLib|Win32"> + <Configuration>ReleaseLib</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="ReleaseLib|x64"> + <Configuration>ReleaseLib</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{E599F5AA-F9A3-46CC-8DB0-C8DEFCEB90C5}</ProjectGuid> + <RootNamespace>flac</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugLib|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugLib|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='NormalLib|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='NormalLib|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugLib|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugLib|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='NormalLib|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='NormalLib|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugLib|Win32'">..\bin\DebugLib\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugLib|Win32'">obj\x32\DebugLib\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='DebugLib|Win32'">flac</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugLib|x64'">..\bin\DebugLib\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugLib|x64'">obj\x64\DebugLib\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='DebugLib|x64'">flac64</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='NormalLib|Win32'">..\bin\NormalLib\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='NormalLib|Win32'">obj\x32\NormalLib\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='NormalLib|Win32'">flac</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='NormalLib|x64'">..\bin\NormalLib\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='NormalLib|x64'">obj\x64\NormalLib\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='NormalLib|x64'">flac64</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|Win32'">..\bin\ReleaseLib\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|Win32'">obj\x32\ReleaseLib\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|Win32'">flac</TargetName> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">..\bin\ReleaseLib\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">obj\x64\ReleaseLib\</IntDir> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">flac64</TargetName> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugLib|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)flac.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDataBaseFileName>$(OutDir)flac.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugLib|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>OldStyle</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)flac64.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDataBaseFileName>$(OutDir)flac64.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='NormalLib|Win32'"> + <ClCompile> + <AdditionalOptions>/GL- /MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)flac.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ProgramDataBaseFileName>$(OutDir)flac.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='NormalLib|x64'"> + <ClCompile> + <AdditionalOptions>/GL- /MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)flac64.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ProgramDataBaseFileName>$(OutDir)flac64.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|Win32'"> + <ClCompile> + <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)flac.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ProgramDataBaseFileName>$(OutDir)flac.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'"> + <ClCompile> + <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader></PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <FloatingPointModel>Fast</FloatingPointModel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>FLAC__NO_DLL;VERSION="1.2.1";NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>include;src\libFLAC\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Lib> + <OutputFile>$(OutDir)flac64.lib</OutputFile> + </Lib> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ProgramDataBaseFileName>$(OutDir)flac64.pdb</ProgramDataBaseFileName> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="src\libFLAC\include\private\all.h" /> + <ClInclude Include="src\libFLAC\include\private\bitmath.h" /> + <ClInclude Include="src\libFLAC\include\private\bitreader.h" /> + <ClInclude Include="src\libFLAC\include\private\bitwriter.h" /> + <ClInclude Include="src\libFLAC\include\private\cpu.h" /> + <ClInclude Include="src\libFLAC\include\private\crc.h" /> + <ClInclude Include="src\libFLAC\include\private\fixed.h" /> + <ClInclude Include="src\libFLAC\include\private\float.h" /> + <ClInclude Include="src\libFLAC\include\private\format.h" /> + <ClInclude Include="src\libFLAC\include\private\lpc.h" /> + <ClInclude Include="src\libFLAC\include\private\md5.h" /> + <ClInclude Include="src\libFLAC\include\private\memory.h" /> + <ClInclude Include="src\libFLAC\include\private\metadata.h" /> + <ClInclude Include="src\libFLAC\include\private\stream_encoder_framing.h" /> + <ClInclude Include="src\libFLAC\include\private\window.h" /> + <ClInclude Include="src\libFLAC\include\protected\all.h" /> + <ClInclude Include="src\libFLAC\include\protected\stream_decoder.h" /> + <ClInclude Include="src\libFLAC\include\protected\stream_encoder.h" /> + <ClInclude Include="include\FLAC\all.h" /> + <ClInclude Include="include\FLAC\assert.h" /> + <ClInclude Include="include\FLAC\callback.h" /> + <ClInclude Include="include\FLAC\export.h" /> + <ClInclude Include="include\FLAC\format.h" /> + <ClInclude Include="include\FLAC\metadata.h" /> + <ClInclude Include="include\FLAC\ordinals.h" /> + <ClInclude Include="include\FLAC\stream_decoder.h" /> + <ClInclude Include="include\FLAC\stream_encoder.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\libFLAC\bitmath.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\bitreader.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\bitwriter.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\cpu.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\crc.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\fixed.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\float.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\format.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\lpc.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\md5.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\memory.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\metadata_iterators.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\metadata_object.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\stream_decoder.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\stream_encoder.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\stream_encoder_framing.c"> + </ClCompile> + <ClCompile Include="src\libFLAC\window.c"> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> Copied: trunk/OpenMPT/include/flac/flac.vcxproj.filters (from rev 2606, branches/manx/premake/include/flac/flac.vcxproj.filters) =================================================================== --- trunk/OpenMPT/include/flac/flac.vcxproj.filters (rev 0) +++ trunk/OpenMPT/include/flac/flac.vcxproj.filters 2013-09-06 15:22:10 UTC (rev 2642) @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="src"> + <UniqueIdentifier>{BBF2D14A-8E59-A544-9020-5934856C6448}</UniqueIdentifier> + </Filter> + <Filter Include="src\libFLAC"> + <UniqueIdentifier>{D099BA2E-71AE-E749-9790-2E15124CFA84}</UniqueIdentifier> + </Filter> + <Filter Include="src\libFLAC\include"> + <UniqueIdentifier>{7BAE1380-58B5-F84A-84D3-435738E5A493}</UniqueIdentifier> + </Filter> + <Filter Include="src\libFLAC\include\private"> + <UniqueIdentifier>{CD4927A6-4150-534C-A102-B7BEA298EB87}</UniqueIdentifier> + </Filter> + <Filter Include="src\libFLAC\include\protected"> + <UniqueIdentifier>{404C67D4-91D9-DD40-A9CA-655744FEB544}</UniqueIdentifier> + </Filter> + <Filter Include="include"> + <UniqueIdentifier>{D0B2E3C1-5592-6F4B-A6C8-B76AFC874957}</UniqueIdentifier> + </Filter> + <Filter Include="include\FLAC"> + <UniqueIdentifier>{EA0AFA08-1C54-3A49-B735-1CB0686E3C39}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="src\libFLAC\include\private\all.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\bitmath.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\bitreader.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\bitwriter.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\cpu.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\crc.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\fixed.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\float.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\format.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\lpc.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\md5.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\memory.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\metadata.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\stream_encoder_framing.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\private\window.h"> + <Filter>src\libFLAC\include\private</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\protected\all.h"> + <Filter>src\libFLAC\include\protected</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\protected\stream_decoder.h"> + <Filter>src\libFLAC\include\protected</Filter> + </ClInclude> + <ClInclude Include="src\libFLAC\include\protected\stream_encoder.h"> + <Filter>src\libFLAC\include\protected</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\all.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\assert.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\callback.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\export.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\format.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\metadata.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\ordinals.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\stream_decoder.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + <ClInclude Include="include\FLAC\stream_encoder.h"> + <Filter>include\FLAC</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\libFLAC\bitmath.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\bitreader.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\bitwriter.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\cpu.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\crc.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\fixed.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\float.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\format.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\lpc.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\md5.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\memory.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\metadata_iterators.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\metadata_object.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\stream_decoder.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\stream_encoder.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\stream_encoder_framing.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + <ClCompile Include="src\libFLAC\window.c"> + <Filter>src\libFLAC</Filter> + </ClCompile> + </ItemGroup> +</Project> Index: trunk/OpenMPT/include/lhasa =================================================================== --- trunk/OpenMPT/include/lhasa 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/include/lhasa 2013-09-06 15:22:10 UTC (rev 2642) Property changes on: trunk/OpenMPT/include/lhasa ___________________________________________________________________ Modified: svn:ignore ## -1,3 +1,4 ## Debug Release lhasa.vcxproj.user +obj Added: svn:global-ignores ## -0,0 +1 ## +obj Modified: trunk/OpenMPT/include/lhasa/OpenMPT.txt =================================================================== --- trunk/OpenMPT/include/lhasa/OpenMPT.txt 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/include/lhasa/OpenMPT.txt 2013-09-06 15:22:10 UTC (rev 2642) @@ -1,2 +1,4 @@ lhasa LHA decompression library from https://github.com/fragglet/lhasa commit 13b44ac7859aad2f2b4fa76600c186f9f7f98c63 as of 2013-06-16. No local changes made. +For building, premake4 is used to generate Visual Studio project files. +See ../premake4.lua for details. Modified: trunk/OpenMPT/include/lhasa/lhasa.vcproj =================================================================== --- trunk/OpenMPT/include/lhasa/lhasa.vcproj 2013-09-06 14:16:11 UTC (rev 2641) +++ trunk/OpenMPT/include/lhasa/lhasa.vcproj 2013-09-06 15:22:10 UTC (rev 2642) @@ -1,26 +1,29 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="lhasa" - ProjectGUID="{3960775B-D852-4974-903D-573E54FF565D}" + ProjectGUID="{6B11F6A8-B131-4D2B-80EF-5731A9016436}" RootNamespace="lhasa" - TargetFrameworkVersion="196613" + Keyword="Win32Proj" > <Platforms> <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="DebugLib|Win32" + OutputDirectory="..\bin\DebugLib" + IntermediateDirectory="obj\x32\DebugLib" ConfigurationType="4" - CharacterSet="0" + CharacterSet="2" > <Tool Name="VCPreBuildEventTool" @@ -40,29 +43,40 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\msinttypes\stdint;..\msinttypes\inttypes" + AdditionalIncludeDirectories="..\msinttypes\inttypes;..\msinttypes\stdint" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\lhasa.pdb" DebugInformationFormat="4" + CompileAs="1" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\msinttypes\inttypes;..\msinttypes\stdint" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" + OutputFile="$(OutDir)\lhasa.lib" /> <Tool Name="VCALinkTool" /> <Tool + Name="VCManifestTool" + /> + <Tool Name="VCXDCMakeTool" /> <Tool @@ -72,16 +86,21 @@ Name="VCFxCopTool" /> <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="DebugLib|x64" + OutputDirectory="..\bin\DebugLib" + IntermediateDirectory="obj\x64\DebugLib" ConfigurationType="4" - CharacterSet="0" - WholeProgramOptimization="1" + CharacterSet="2" > <Tool Name="VCPreBuildEventTool" @@ -97,33 +116,123 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\msinttypes\stdint;..\msinttypes\inttypes" + Optimization="0" + AdditionalIncludeDirectories="..\msinttypes\inttypes;..\msinttypes\stdint" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + ProgramDataBaseFileName="$(OutDir)\lhasa64.pdb" + DebugInformationFormat="3" + CompileAs="1" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\msinttypes\inttypes;..\msinttypes\stdint" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)\lhasa64.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="NormalLib|Win32" + OutputDirectory="..\bin\NormalLib" + IntermediateDirectory="obj\x32\NormalLib" + ConfigurationType="4" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/GL- /MP" + Optimization="3" + AdditionalIncludeDirectories="..\msinttypes\inttypes;..\msinttypes\stdint" + PreprocessorDefinitions="NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + StringPooling="true" RuntimeLibrary="0" EnableFunctionL... [truncated message content] |
From: <man...@us...> - 2013-09-06 15:42:25
|
Revision: 2644 http://sourceforge.net/p/modplug/code/2644 Author: manxorist Date: 2013-09-06 15:42:12 +0000 (Fri, 06 Sep 2013) Log Message: ----------- [New] Add support for WDM-KS sound output on WindowsXP and for WaveRT on Vista/Win7 via portaudio (both are called WDM-KS in portaudio code). [Mod] portuadio: Build with WDM-KS code. [Fix] portaudio: Portaudio does not like linking against strmiids.lib and defines the needed GUIDs globally itself. Stop it from doing that because this causes duplicate symbols when we link strmiids.lib . [Fix] sounddev/Portaudio: Work-around a problem with portaudio WDM-KS code. The value for timeInfo->outputBufferDacTime appears to be wrong and thus our latency calculation fails. Instead, use the portaudio-provided latency value for WDM-KS devices. [Mod] OpenMPT: Version is now 1.22.05.03 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/include/portaudio/portaudio.vcproj trunk/OpenMPT/include/portaudio/portaudio.vcxproj trunk/OpenMPT/include/portaudio/portaudio.vcxproj.filters trunk/OpenMPT/include/portaudio/src/hostapi/wdmks/pa_win_wdmks.c trunk/OpenMPT/include/premake4.lua trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/common/versionNumber.h 2013-09-06 15:42:12 UTC (rev 2644) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 05 -#define VER_MINORMINOR 02 +#define VER_MINORMINOR 03 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/include/portaudio/portaudio.vcproj =================================================================== --- trunk/OpenMPT/include/portaudio/portaudio.vcproj 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/include/portaudio/portaudio.vcproj 2013-09-06 15:42:12 UTC (rev 2644) @@ -45,7 +45,7 @@ AdditionalOptions="/wd4018" Optimization="0" AdditionalIncludeDirectories="include;src\common;src\os\win" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -61,7 +61,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="include;src\common;src\os\win" /> <Tool @@ -124,7 +124,7 @@ AdditionalOptions="/wd4018" Optimization="0" AdditionalIncludeDirectories="include;src\common;src\os\win" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -140,7 +140,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="include;src\common;src\os\win" /> <Tool @@ -202,7 +202,7 @@ AdditionalOptions="/wd4018 /GL- /MP" Optimization="3" AdditionalIncludeDirectories="include;src\common;src\os\win" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -218,7 +218,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="include;src\common;src\os\win" /> <Tool @@ -281,7 +281,7 @@ AdditionalOptions="/wd4018 /GL- /MP" Optimization="3" AdditionalIncludeDirectories="include;src\common;src\os\win" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -297,7 +297,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="include;src\common;src\os\win" /> <Tool @@ -359,7 +359,7 @@ AdditionalOptions="/wd4018 /MP" Optimization="3" AdditionalIncludeDirectories="include;src\common;src\os\win" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -375,7 +375,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="include;src\common;src\os\win" /> <Tool @@ -438,7 +438,7 @@ AdditionalOptions="/wd4018 /MP" Optimization="3" AdditionalIncludeDirectories="include;src\common;src\os\win" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -454,7 +454,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" AdditionalIncludeDirectories="include;src\common;src\os\win" /> <Tool @@ -621,6 +621,15 @@ </File> </Filter> <Filter + Name="wdmks" + Filter="" + > + <File + RelativePath="src\hostapi\wdmks\pa_win_wdmks.c" + > + </File> + </Filter> + <Filter Name="wmme" Filter="" > Modified: trunk/OpenMPT/include/portaudio/portaudio.vcxproj =================================================================== --- trunk/OpenMPT/include/portaudio/portaudio.vcxproj 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/include/portaudio/portaudio.vcxproj 2013-09-06 15:42:12 UTC (rev 2644) @@ -114,7 +114,7 @@ <AdditionalOptions>/wd4018 %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -125,7 +125,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -142,7 +142,7 @@ <AdditionalOptions>/wd4018 %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -153,7 +153,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -170,7 +170,7 @@ <AdditionalOptions>/wd4018 /GL- /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -182,7 +182,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -201,7 +201,7 @@ <AdditionalOptions>/wd4018 /GL- /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -213,7 +213,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -232,7 +232,7 @@ <AdditionalOptions>/wd4018 /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -244,7 +244,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -263,7 +263,7 @@ <AdditionalOptions>/wd4018 /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -275,7 +275,7 @@ <CompileAs>CompileAsC</CompileAs> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=0;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PA_ENABLE_DEBUG_OUTPUT;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>include;src\common;src\os\win;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Lib> @@ -342,6 +342,8 @@ </ClCompile> <ClCompile Include="src\hostapi\wasapi\pa_win_wasapi.c"> </ClCompile> + <ClCompile Include="src\hostapi\wdmks\pa_win_wdmks.c"> + </ClCompile> <ClCompile Include="src\hostapi\wmme\pa_win_wmme.c"> </ClCompile> <ClCompile Include="src\os\win\pa_win_coinitialize.c"> Modified: trunk/OpenMPT/include/portaudio/portaudio.vcxproj.filters =================================================================== --- trunk/OpenMPT/include/portaudio/portaudio.vcxproj.filters 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/include/portaudio/portaudio.vcxproj.filters 2013-09-06 15:42:12 UTC (rev 2644) @@ -2,31 +2,34 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="src"> - <UniqueIdentifier>{E4F2B5F2-9D52-3D41-93E9-7CA32895FDDC}</UniqueIdentifier> + <UniqueIdentifier>{31590FFD-6069-2444-B1DD-1A3174BA5E09}</UniqueIdentifier> </Filter> <Filter Include="src\common"> - <UniqueIdentifier>{FBAF15AC-76C7-5949-951C-45ADA590A1EE}</UniqueIdentifier> + <UniqueIdentifier>{A2CF1912-05FB-A84D-9563-10AA371460EE}</UniqueIdentifier> </Filter> <Filter Include="src\os"> - <UniqueIdentifier>{B0C52306-B86B-D44A-9C3D-DDF918E2DF4C}</UniqueIdentifier> + <UniqueIdentifier>{8CFA8032-F6BA-3E41-A5F7-9832E3B7CC64}</UniqueIdentifier> </Filter> <Filter Include="src\os\win"> - <UniqueIdentifier>{7C9416C4-AEBE-DA44-9989-BB06779A07D3}</UniqueIdentifier> + <UniqueIdentifier>{4F9D1EA5-02AB-0B4E-92DD-B29250843AED}</UniqueIdentifier> </Filter> <Filter Include="include"> - <UniqueIdentifier>{8BAFEA97-1C36-9742-B2AF-563B5078F704}</UniqueIdentifier> + <UniqueIdentifier>{C0A38AB9-990E-0D47-A8C0-C5B8D0A82D4B}</UniqueIdentifier> </Filter> <Filter Include="src\hostapi"> - <UniqueIdentifier>{C1344C66-9A4D-EB49-B60F-268A96F71BAC}</UniqueIdentifier> + <UniqueIdentifier>{108DCE49-4917-7D44-A5FB-1F82643315AC}</UniqueIdentifier> </Filter> <Filter Include="src\hostapi\skeleton"> - <UniqueIdentifier>{C2D851D3-0D90-5340-B5CE-0C592DDD0859}</UniqueIdentifier> + <UniqueIdentifier>{39879D9A-CC57-A34E-AFC4-F83458F26F90}</UniqueIdentifier> </Filter> <Filter Include="src\hostapi\wasapi"> - <UniqueIdentifier>{E148BD30-2CA5-4949-9C79-CE6A18B252C0}</UniqueIdentifier> + <UniqueIdentifier>{4B4B2241-1E33-1945-AD6B-863F25BB9921}</UniqueIdentifier> </Filter> + <Filter Include="src\hostapi\wdmks"> + <UniqueIdentifier>{180F4AAD-30CA-2345-94C1-29E309997D2D}</UniqueIdentifier> + </Filter> <Filter Include="src\hostapi\wmme"> - <UniqueIdentifier>{59673599-0F9E-A34E-A22D-C7C499029E6D}</UniqueIdentifier> + <UniqueIdentifier>{6D1CC05F-BA9E-C345-B0EA-3FEAE27EB4B9}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> @@ -146,6 +149,9 @@ <ClCompile Include="src\hostapi\wasapi\pa_win_wasapi.c"> <Filter>src\hostapi\wasapi</Filter> </ClCompile> + <ClCompile Include="src\hostapi\wdmks\pa_win_wdmks.c"> + <Filter>src\hostapi\wdmks</Filter> + </ClCompile> <ClCompile Include="src\hostapi\wmme\pa_win_wmme.c"> <Filter>src\hostapi\wmme</Filter> </ClCompile> Modified: trunk/OpenMPT/include/portaudio/src/hostapi/wdmks/pa_win_wdmks.c =================================================================== --- trunk/OpenMPT/include/portaudio/src/hostapi/wdmks/pa_win_wdmks.c 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/include/portaudio/src/hostapi/wdmks/pa_win_wdmks.c 2013-09-06 15:42:12 UTC (rev 2644) @@ -124,6 +124,8 @@ #define EXIT_THREAD ExitThread(0) #endif +#if 0 + #ifdef _MSC_VER #define NOMMIDS #define DYNAMIC_GUID(data) {data} @@ -134,6 +136,18 @@ #define DEFINE_GUIDEX(n) DEFINE_GUID_THUNK(n, STATIC_##n) #endif +#else +// OpenMPT: +// We link against strmiids.lib. +// This defines all those GUID symbols that portaudio needs. +// So there is no need to play games with headers and macros, just use the headers as they are und use the GUIDS from the library. + +#ifdef _MSC_VER +#define DYNAMIC_GUID(data) {data} +#endif + +#endif + #include <mmreg.h> #include <ks.h> #include <ksmedia.h> Modified: trunk/OpenMPT/include/premake4.lua =================================================================== --- trunk/OpenMPT/include/premake4.lua 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/include/premake4.lua 2013-09-06 15:42:12 UTC (rev 2644) @@ -213,7 +213,7 @@ "PA_USE_DS=0", "PA_USE_WMME=1", "PA_USE_WASAPI=1", - "PA_USE_WDMKS=0", + "PA_USE_WDMKS=1", } files { "portaudio/src/common/pa_allocation.c", @@ -242,6 +242,7 @@ "portaudio/src/common/pa_util.h", "portaudio/src/hostapi/skeleton/pa_hostapi_skeleton.c", "portaudio/src/hostapi/wasapi/pa_win_wasapi.c", + "portaudio/src/hostapi/wdmks/pa_win_wdmks.c", "portaudio/src/hostapi/wmme/pa_win_wmme.c", "portaudio/src/os/win/pa_win_coinitialize.c", "portaudio/src/os/win/pa_win_coinitialize.h", Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-09-06 15:26:57 UTC (rev 2643) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-09-06 15:42:12 UTC (rev 2644) @@ -203,7 +203,15 @@ UNREFERENCED_PARAMETER(input); UNREFERENCED_PARAMETER(statusFlags); if(!output) return paAbort; - m_CurrentRealLatencyMS = static_cast<float>( timeInfo->outputBufferDacTime - timeInfo->currentTime ) * 1000.0f; + if(Pa_GetHostApiInfo(m_HostApi)->type == paWDMKS) + { + // For WDM-KS, timeInfo->outputBufferDacTime seems to contain bogus values. + // Work-around it by using the slightly less accurate per-stream latency estimation. + m_CurrentRealLatencyMS = static_cast<float>( Pa_GetStreamInfo(m_Stream)->outputLatency * 1000.0 ); + } else + { + m_CurrentRealLatencyMS = static_cast<float>( timeInfo->outputBufferDacTime - timeInfo->currentTime ) * 1000.0f; + } m_CurrentFrameBuffer = output; m_CurrentFrameCount = frameCount; SourceFillAudioBufferLocked(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-06 21:44:18
|
Revision: 2649 http://sourceforge.net/p/modplug/code/2649 Author: manxorist Date: 2013-09-06 21:44:06 +0000 (Fri, 06 Sep 2013) Log Message: ----------- [Ref] Move supported sample rates to TrackerSettings. [Ref] sounddev: Add const to CanSampleRate() . Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.h trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDevicePortAudio.h Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-09-06 21:44:06 UTC (rev 2649) @@ -26,7 +26,6 @@ #include <fstream> -extern UINT nMixingRates[NUMMIXRATE]; extern LPCSTR gszChnCfgNames[3]; @@ -210,10 +209,10 @@ SetDlgItemInt(IDC_EDIT5, loopCount, FALSE); m_SpinLoopCount.SetRange(1, int16_max); - - for (size_t i = 0; i < CountOf(nMixingRates); i++) + const std::vector<uint32> samplerates = TrackerSettings::Instance().GetSampleRates(); + for(size_t i = 0; i < samplerates.size(); i++) { - UINT n = nMixingRates[i]; + UINT n = samplerates[i]; wsprintf(s, "%d Hz", n); m_CbnSampleRate.SetItemData(m_CbnSampleRate.AddString(s), n); if (n == WaveFormat.Format.nSamplesPerSec) m_CbnSampleRate.SetCurSel(i); Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-06 21:44:06 UTC (rev 2649) @@ -78,27 +78,6 @@ END_MESSAGE_MAP() -UINT nMixingRates[NUMMIXRATE] = -{ - 16000, - 19800, - 20000, - 22050, - 24000, - 32000, - 33075, - 37800, - 40000, - 44100, - 48000, - 64000, - 88200, - 96000, - 176400, - 192000, -}; - - void COptionsSoundcard::DoDataExchange(CDataExchange* pDX) //-------------------------------------------------------- { @@ -402,11 +381,7 @@ m_CbnMixingFreq.ResetContent(); std::vector<bool> supportedRates; - std::vector<uint32> samplerates; - for(size_t i = 0; i < CountOf(nMixingRates); i++) - { - samplerates.push_back(nMixingRates[i]); - } + const std::vector<uint32> samplerates = TrackerSettings::Instance().GetSampleRates(); bool knowRates = false; { @@ -441,14 +416,14 @@ supportedRates.assign(samplerates.size(), true); } int n = 1; - for(size_t i = 0; i < CountOf(nMixingRates); i++) + for(size_t i = 0; i < samplerates.size(); i++) { if(supportedRates[i]) { - wsprintf(s, "%u Hz", nMixingRates[i]); + wsprintf(s, "%i Hz", samplerates[i]); int pos = m_CbnMixingFreq.AddString(s); - m_CbnMixingFreq.SetItemData(pos, nMixingRates[i]); - if(m_dwRate == nMixingRates[i]) n = pos; + m_CbnMixingFreq.SetItemData(pos, samplerates[i]); + if(m_dwRate == samplerates[i]) n = pos; } } m_CbnMixingFreq.SetCurSel(n); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-09-06 21:44:06 UTC (rev 2649) @@ -959,6 +959,31 @@ } +std::vector<uint32> TrackerSettings::GetSampleRates() +//--------------------------------------------------- +{ + static const uint32 samplerates [] = { + 192000, + 176400, + 96000, + 88200, + 64000, + 48000, + 44100, + 40000, + 37800, + 33075, + 32000, + 24000, + 22050, + 20000, + 19800, + 16000 + }; + return std::vector<uint32>(samplerates, samplerates + CountOf(samplerates)); +} + + //////////////////////////////////////////////////////////////////////////////// // Chords Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2013-09-06 21:44:06 UTC (rev 2649) @@ -269,6 +269,8 @@ void SetDefaultDirectory(const LPCTSTR szFilenameFrom, Directory dir, bool bStripFilename = false); LPCTSTR GetDefaultDirectory(Directory dir) const; + std::vector<uint32> GetSampleRates(); + static MPTChords &GetChords() { return Instance().Chords; } // Get settings object singleton Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-09-06 21:44:06 UTC (rev 2649) @@ -168,7 +168,7 @@ virtual int64 GetStreamPositionSamples() const { return 0; } virtual UINT GetCurrentSampleRate(UINT nDevice) { UNREFERENCED_PARAMETER(nDevice); return 0; } // Return which samplerates are actually supported by the device. Currently only implemented properly for ASIO. - virtual bool CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result) { UNREFERENCED_PARAMETER(nDevice); result.assign(samplerates.size(), true); return true; } ; + virtual bool CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result) { UNREFERENCED_PARAMETER(nDevice); result.assign(samplerates.size(), true); return true; } ; }; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-09-06 21:44:06 UTC (rev 2649) @@ -702,8 +702,8 @@ } -bool CASIODevice::CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result) -//------------------------------------------------------------------------------------------------------- +bool CASIODevice::CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result) +//-------------------------------------------------------------------------------------------------------------- { const bool wasOpen = (m_pAsioDrv != NULL); if(!wasOpen) Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2013-09-06 21:44:06 UTC (rev 2649) @@ -68,7 +68,7 @@ UINT GetNumBuffers() { return 2; } float GetCurrentRealLatencyMS() { return m_nAsioBufferLen * 2 * 1000.0f / m_Settings.Samplerate; } - bool CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result); + bool CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result); UINT GetCurrentSampleRate(UINT nDevice); public: Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-09-06 21:44:06 UTC (rev 2649) @@ -159,8 +159,8 @@ } -bool CPortaudioDevice::CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result) -//------------------------------------------------------------------------------------------------------------ +bool CPortaudioDevice::CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result) +//------------------------------------------------------------------------------------------------------------------- { result.clear(); for(UINT n=0; n<samplerates.size(); n++) Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.h 2013-09-06 18:19:26 UTC (rev 2648) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.h 2013-09-06 21:44:06 UTC (rev 2649) @@ -55,7 +55,7 @@ float GetCurrentRealLatencyMS(); bool HasGetStreamPosition() const { return false; } int64 GetStreamPositionSamples() const; - bool CanSampleRate(UINT nDevice, std::vector<uint32> &samplerates, std::vector<bool> &result); + bool CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result); int StreamCallback( const void *input, void *output, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-07 13:53:40
|
Revision: 2651 http://sourceforge.net/p/modplug/code/2651 Author: manxorist Date: 2013-09-07 13:53:32 +0000 (Sat, 07 Sep 2013) Log Message: ----------- [Ref] Move charset conversion functions to common/mptString, so that they could also be used by tracker code. Modified Paths: -------------- trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/common/mptString.h trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2013-09-07 13:24:00 UTC (rev 2650) +++ trunk/OpenMPT/common/mptString.cpp 2013-09-07 13:53:32 UTC (rev 2651) @@ -13,7 +13,11 @@ #include <vector> #include <cstdarg> +#if !defined(WIN32) +#include <iconv.h> +#endif // !WIN32 + namespace mpt { namespace String { @@ -44,4 +48,131 @@ } +#if defined(WIN32) +static UINT CharsetToCodepage(Charset charset) +{ + switch(charset) + { + case CharsetLocale: return CP_ACP; break; + case CharsetUTF8: return CP_UTF8; break; + case CharsetUS_ASCII: return 20127; break; + case CharsetISO8859_1: return 28591; break; + case CharsetISO8859_15: return 28605; break; + case CharsetCP437: return 437; break; + case CharsetWindows1252: return 1252; break; + } + return 0; +} +#else // !WIN32 +static const char * CharsetToString(Charset charset) +{ + switch(charset) + { + case CharsetLocale: return "char"; break; + case CharsetUTF8: return "UTF-8"; break; + case CharsetUS_ASCII: return "ASCII"; break; + case CharsetISO8859_1: return "ISO-8859-1"; break; + case CharsetISO8859_15: return "ISO-8859-15"; break; + case CharsetCP437: return "CP437"; break; + case CharsetWindows1252: return "CP1252"; break; + } + return 0; +} +#endif // WIN32 + + +std::string Encode(const std::wstring &src, Charset charset) +{ + #if defined(WIN32) + const UINT codepage = CharsetToCodepage(charset); + int required_size = WideCharToMultiByte(codepage, 0, src.c_str(), -1, nullptr, 0, nullptr, nullptr); + if(required_size <= 0) + { + return std::string(); + } + std::vector<CHAR> encoded_string(required_size); + WideCharToMultiByte(codepage, 0, src.c_str(), -1, &encoded_string[0], encoded_string.size(), nullptr, nullptr); + return &encoded_string[0]; + #else // !WIN32 + iconv_t conv = iconv_t(); + conv = iconv_open(CharsetToString(charset), "wchar_t"); + std::vector<wchar_t> wide_string(src.c_str(), src.c_str() + src.length() + 1); + std::vector<char> encoded_string(wide_string.size() * 8); // large enough + char * inbuf = (char*)&wide_string[0]; + size_t inbytesleft = wide_string.size() * sizeof(wchar_t); + char * outbuf = &encoded_string[0]; + size_t outbytesleft = encoded_string.size(); + if(iconv(conv, &inbuf, &inbytesleft, &outbuf, &outbytesleft) == (size_t)-1) + { + iconv_close(conv); + conv = iconv_t(); + return std::string(); + } + iconv_close(conv); + conv = iconv_t(); + return &encoded_string[0]; + #endif // WIN32 +} + + +std::wstring Decode(const std::string &src, Charset charset) +{ + #if defined(WIN32) + const UINT codepage = CharsetToCodepage(charset); + int required_size = MultiByteToWideChar(codepage, 0, src.c_str(), -1, nullptr, 0); + if(required_size <= 0) + { + return std::wstring(); + } + std::vector<WCHAR> decoded_string(required_size); + MultiByteToWideChar(codepage, 0, src.c_str(), -1, &decoded_string[0], decoded_string.size()); + return &decoded_string[0]; + #else // !WIN32 + iconv_t conv = iconv_t(); + conv = iconv_open("wchar_t", CharsetToString(charset)); + std::vector<char> encoded_string(src.c_str(), src.c_str() + src.length() + 1); + std::vector<wchar_t> wide_string(encoded_string.size() * 8); // large enough + char * inbuf = &encoded_string[0]; + size_t inbytesleft = encoded_string.size(); + char * outbuf = (char*)&wide_string[0]; + size_t outbytesleft = wide_string.size() * sizeof(wchar_t); + if(iconv(conv, &inbuf, &inbytesleft, &outbuf, &outbytesleft) == (size_t)-1) + { + iconv_close(conv); + conv = iconv_t(); + return std::wstring(); + } + iconv_close(conv); + conv = iconv_t(); + return &wide_string[0]; + #endif // WIN32 +} + + +std::string Convert(const std::string &src, Charset from, Charset to) +{ + #if defined(WIN32) + return Encode(Decode(src, from), to); + #else // !WIN32 + iconv_t conv = iconv_t(); + conv = iconv_open(CharsetToString(to), CharsetToString(from)); + std::vector<char> src_string(src.c_str(), src.c_str() + src.length() + 1); + std::vector<char> dst_string(src_string.size() * 8); // large enough + char * inbuf = &src_string[0]; + size_t inbytesleft = src_string.size(); + char * outbuf = &dst_string[0]; + size_t outbytesleft = dst_string.size(); + if(iconv(conv, &inbuf, &inbytesleft, &outbuf, &outbytesleft) == (size_t)-1) + { + iconv_close(conv); + conv = iconv_t(); + return std::string(); + } + iconv_close(conv); + conv = iconv_t(); + return &dst_string[0]; + #endif // WIN32 +} + + } } // namespace mpt::String Modified: trunk/OpenMPT/common/mptString.h =================================================================== --- trunk/OpenMPT/common/mptString.h 2013-09-07 13:24:00 UTC (rev 2650) +++ trunk/OpenMPT/common/mptString.h 2013-09-07 13:53:32 UTC (rev 2651) @@ -134,6 +134,32 @@ } +enum Charset { + CharsetLocale, + + CharsetUTF8, + + CharsetUS_ASCII, + + CharsetISO8859_1, + CharsetISO8859_15, + + CharsetCP437, + + CharsetWindows1252, +}; + + +namespace String { + +std::string Encode(const std::wstring &src, Charset charset); +std::wstring Decode(const std::string &src, Charset charset); + +std::string Convert(const std::string &src, Charset from, Charset to); + +} // namespace String + + } // namespace mpt Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-07 13:24:00 UTC (rev 2650) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-09-07 13:53:32 UTC (rev 2651) @@ -22,10 +22,6 @@ #include <cstdlib> #include <cstring> -#if !defined(WIN32) -#include <iconv.h> -#endif // !WIN32 - #include "soundlib/Sndfile.h" #include "soundlib/AudioReadTarget.h" #include "soundlib/FileReader.h" @@ -154,58 +150,19 @@ } std::string module_impl::mod_string_to_utf8( const std::string & encoded ) const { - std::string charset = m_sndFile->GetCharset().second; - #if defined(WIN32) - std::transform( charset.begin(), charset.end(), charset.begin(), tolower ); - UINT codepage = 0; - if ( charset == "" ) { - codepage = 20127; // us ascii fallback - } else if ( charset == "windows-1252" ) { - codepage = 1252; - } else if ( charset == "iso-8859-1" ) { - codepage = 28591; - } else if ( charset == "utf-8" ) { - codepage = 65001; - } else if ( charset == "us-ascii" ) { - codepage = 20127; - } else if ( charset == "cp437" ) { - codepage = 437; - } else { - codepage = 20127; // us ascii fallback - } - int required_size = 0; - required_size = MultiByteToWideChar( codepage, 0, encoded.c_str(), -1, NULL, 0 ); - if ( required_size <= 0 ) { - return std::string(); - } - std::vector<WCHAR> unicode_string( required_size ); - MultiByteToWideChar( codepage, 0, encoded.data(), -1, &unicode_string[0], unicode_string.size() ); - required_size = WideCharToMultiByte( CP_UTF8, 0, &unicode_string[0], -1, NULL, 0, NULL, NULL ); - if ( required_size <= 0 ) { - return std::string(); - } - std::vector<CHAR> utf8_string( required_size ); - WideCharToMultiByte( CP_UTF8, 0, &unicode_string[0], -1, &utf8_string[0], utf8_string.size(), NULL, NULL ); - return &utf8_string[0]; - #else - iconv_t conv = iconv_t(); - conv = iconv_open( "UTF-8", charset.c_str() ); - std::vector<char> encoded_string( encoded.c_str(), encoded.c_str() + encoded.length() + 1 ); - std::vector<char> utf8_string( encoded_string.size() * 8 ); // large enough - char * inbuf = &encoded_string[0]; - size_t inbytesleft = encoded_string.size(); - char * outbuf = &utf8_string[0]; - size_t outbytesleft = utf8_string.size(); - if ( iconv( conv, &inbuf, &inbytesleft, &outbuf, &outbytesleft ) == (size_t)-1 ) { - iconv_close( conv ); - conv = iconv_t(); - return std::string(); - } - std::string result = &utf8_string[0]; - iconv_close( conv ); - conv = iconv_t(); - return result; - #endif + std::string encoding = m_sndFile->GetCharset().second; + std::transform( encoding.begin(), encoding.end(), encoding.begin(), tolower ); + mpt::Charset charset = mpt::CharsetUS_ASCII; + if ( encoding == "" ) { charset = mpt::CharsetUS_ASCII; } // fallback + else if ( encoding == "utf-8" ) { charset = mpt::CharsetUTF8; } + else if ( encoding == "ascii" ) { charset = mpt::CharsetUS_ASCII; } + else if ( encoding == "us-ascii" ) { charset = mpt::CharsetUS_ASCII; } + else if ( encoding == "iso-8859-1" ) { charset = mpt::CharsetISO8859_1; } + else if ( encoding == "iso-8859-15" ) { charset = mpt::CharsetISO8859_15; } + else if ( encoding == "cp437" ) { charset = mpt::CharsetCP437; } + else if ( encoding == "windows-1252" ) { charset = mpt::CharsetWindows1252; } + else { charset = mpt::CharsetUS_ASCII; } // fallback + return mpt::String::Convert( encoded, charset, mpt::CharsetUTF8 ); } void module_impl::apply_mixer_settings( std::int32_t samplerate, int channels ) { if ( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-09 10:17:25
|
Revision: 2669 http://sourceforge.net/p/modplug/code/2669 Author: manxorist Date: 2013-09-09 10:17:13 +0000 (Mon, 09 Sep 2013) Log Message: ----------- [Ref] libopenmpt: Build with UNICODE on windows. [Fix] in_openmpt: Correct charset handling. [Fix] Make testcases compile without and with UNICODE. [Fix] xmp-openmpt: Correct charset handling in aboud dialog. [Ref] xmp-openmpt: Assume UNICODE. [Ref] in_openmpt: Assume UNICODE. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-09-09 10:14:49 UTC (rev 2668) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-09-09 10:17:13 UTC (rev 2669) @@ -50,58 +50,58 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugStatic|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugStatic|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>false</WholeProgramOptimization> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>false</WholeProgramOptimization> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>false</WholeProgramOptimization> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>false</WholeProgramOptimization> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>false</WholeProgramOptimization> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>false</WholeProgramOptimization> - <CharacterSet>NotSet</CharacterSet> + <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp 2013-09-09 10:14:49 UTC (rev 2668) +++ trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp 2013-09-09 10:17:13 UTC (rev 2669) @@ -75,9 +75,9 @@ int samplerate; int channels; std::string cached_filename; - std::string cached_title; + std::wstring cached_title; int cached_length; - std::string cached_infotext; + std::wstring cached_infotext; std::int64_t decode_position_frames; openmpt::module * mod; HANDLE PlayThread; @@ -100,9 +100,9 @@ samplerate = settings.samplerate; channels = settings.channels; cached_filename = ""; - cached_title = ""; + cached_title = std::wstring(); cached_length = 0; - cached_infotext = ""; + cached_infotext = std::wstring(); decode_position_frames = 0; mod = 0; PlayThread = 0; @@ -135,13 +135,13 @@ static DWORD WINAPI DecodeThread( LPVOID ); -static std::string generate_infotext( const std::string & filename, const openmpt::module & mod ) { - std::ostringstream str; - str << "filename: " << filename << std::endl; - str << "duration: " << mod.get_duration_seconds() << "seconds" << std::endl; +static std::wstring generate_infotext( const std::string & filename, const openmpt::module & mod ) { + std::wostringstream str; + str << L"filename: " << StringDecode( filename, CP_ACP ) << std::endl; + str << L"duration: " << mod.get_duration_seconds() << L"seconds" << std::endl; std::vector<std::string> metadatakeys = mod.get_metadata_keys(); for ( std::vector<std::string>::iterator key = metadatakeys.begin(); key != metadatakeys.end(); ++key ) { - str << *key << ": " << mod.get_metadata(*key) << std::endl; + str << StringDecode( *key, CP_UTF8 ) << L": " << StringDecode( mod.get_metadata(*key), CP_UTF8 ) << std::endl; } return str.str(); } @@ -151,7 +151,7 @@ openmpt::settings::edit( self->settings, hwndParent, SHORT_TITLE ); apply_options(); } else { - MessageBox( hwndParent, "libopenmpt_settings.dll failed to load. Please check if it is in the same folder as in_openmpt.dll and that .NET framework v4.0 is installed.", SHORT_TITLE, MB_ICONERROR ); + MessageBox( hwndParent, TEXT("libopenmpt_settings.dll failed to load. Please check if it is in the same folder as in_openmpt.dll and that .NET framework v4.0 is installed."), TEXT(SHORT_TITLE), MB_ICONERROR ); } } @@ -164,17 +164,17 @@ about << openmpt::string::get( openmpt::string::contact ) << std::endl; about << std::endl; about << "Show full credits?" << std::endl; - if ( MessageBox( hwndParent, StringEncode( StringDecode( about.str(), CP_UTF8 ), CP_ACP ).c_str(), SHORT_TITLE, MB_ICONINFORMATION | MB_YESNOCANCEL | MB_DEFBUTTON1 ) != IDYES ) { + if ( MessageBox( hwndParent, StringDecode( about.str(), CP_UTF8 ).c_str(), TEXT(SHORT_TITLE), MB_ICONINFORMATION | MB_YESNOCANCEL | MB_DEFBUTTON1 ) != IDYES ) { return; } std::ostringstream credits; credits << openmpt::string::get( openmpt::string::credits ); - MessageBox( hwndParent, StringEncode( StringDecode( credits.str(), CP_UTF8 ), CP_ACP ).c_str(), SHORT_TITLE, MB_ICONINFORMATION ); + MessageBox( hwndParent, StringDecode( credits.str(), CP_UTF8 ).c_str(), TEXT(SHORT_TITLE), MB_ICONINFORMATION ); } static void init() { if ( !settings_dll ) { - settings_dll = LoadLibrary( "libopenmpt_settings.dll" ); + settings_dll = LoadLibrary( TEXT("libopenmpt_settings.dll") ); } if ( !self ) { self = new self_winamp_t(); @@ -206,7 +206,7 @@ std::ifstream s( fn, std::ios::binary ); self->mod = new openmpt::module( s ); self->cached_filename = fn; - self->cached_title = self->mod->get_metadata( "title" ); + self->cached_title = StringDecode( self->mod->get_metadata( "title" ), CP_UTF8 ); self->cached_length = static_cast<int>( self->mod->get_duration_seconds() * 1000.0 ); self->cached_infotext = generate_infotext( self->cached_filename, *self->mod ); apply_options(); @@ -285,11 +285,11 @@ try { std::ifstream s( fn, std::ios::binary ); openmpt::module mod( s ); - MessageBox( hWndParent, generate_infotext( fn, mod ).c_str(), SHORT_TITLE, 0 ); + MessageBox( hWndParent, generate_infotext( fn, mod ).c_str(), TEXT(SHORT_TITLE), 0 ); } catch ( ... ) { } } else { - MessageBox( hWndParent, self->cached_infotext.c_str(), SHORT_TITLE, 0 ); + MessageBox( hWndParent, self->cached_infotext.c_str(), TEXT(SHORT_TITLE), 0 ); } return 0; } @@ -300,7 +300,7 @@ *length_in_ms = self->cached_length; } if ( title ) { - strcpy( title, self->cached_title.c_str() ); + strcpy( title, StringEncode( self->cached_title, CP_ACP ).c_str() ); } } else { try { @@ -310,7 +310,7 @@ *length_in_ms = static_cast<int>( mod.get_duration_seconds() * 1000.0 ); } if ( title ) { - strcpy( title, mod.get_metadata("title").c_str() ); + strcpy( title, StringEncode( StringDecode( mod.get_metadata("title"), CP_UTF8 ), CP_ACP ).c_str() ); } } catch ( ... ) { } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-09-09 10:14:49 UTC (rev 2668) +++ trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-09-09 10:17:13 UTC (rev 2669) @@ -264,12 +264,12 @@ about << openmpt::string::get( openmpt::string::contact ) << std::endl; about << std::endl; about << "Show full credits?" << std::endl; - if ( MessageBox( win, StringEncode( StringDecode( about.str(), CP_UTF8 ), CP_ACP ).c_str(), SHORT_TITLE, MB_ICONINFORMATION | MB_YESNOCANCEL | MB_DEFBUTTON1 ) != IDYES ) { + if ( MessageBox( win, StringDecode( about.str(), CP_UTF8 ).c_str(), TEXT(SHORT_TITLE), MB_ICONINFORMATION | MB_YESNOCANCEL | MB_DEFBUTTON1 ) != IDYES ) { return; } std::ostringstream credits; credits << openmpt::string::get( openmpt::string::credits ); - MessageBox( win, StringEncode( StringDecode( credits.str(), CP_UTF8 ), CP_ACP ).c_str(), SHORT_TITLE, MB_ICONINFORMATION ); + MessageBox( win, StringDecode( credits.str(), CP_UTF8 ).c_str(), TEXT(SHORT_TITLE), MB_ICONINFORMATION ); } static void WINAPI openmpt_Config( HWND win ) { @@ -277,7 +277,7 @@ openmpt::settings::edit( self->settings, win, SHORT_TITLE ); apply_and_save_options(); } else { - MessageBox( win, "libopenmpt_settings.dll failed to load. Please check if it is in the same folder as xmp-openmpt.dll and that .NET framework v4.0 is installed.", SHORT_TITLE, MB_ICONERROR ); + MessageBox( win, TEXT("libopenmpt_settings.dll failed to load. Please check if it is in the same folder as xmp-openmpt.dll and that .NET framework v4.0 is installed."), TEXT(SHORT_TITLE), MB_ICONERROR ); } } @@ -955,7 +955,7 @@ } else { xmpin.exts = xmp_openmpt_default_exts; } - settings_dll = LoadLibrary( "libopenmpt_settings.dll" ); + settings_dll = LoadLibrary( TEXT("libopenmpt_settings.dll") ); self = new self_xmplay_t(); } Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2013-09-09 10:14:49 UTC (rev 2668) +++ trunk/OpenMPT/test/test.cpp 2013-09-09 10:17:13 UTC (rev 2669) @@ -483,21 +483,21 @@ VERIFY_EQUAL(ModCommand::IsPcNote(NOTE_PC), true); VERIFY_EQUAL(ModCommand::IsPcNote(NOTE_PCS), true); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".mod")), MOD_TYPE_MOD); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("mod")), MOD_TYPE_MOD); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".s3m")), MOD_TYPE_S3M); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("s3m")), MOD_TYPE_S3M); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".xm")), MOD_TYPE_XM); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("xm")), MOD_TYPE_XM); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".it")), MOD_TYPE_IT); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("it")), MOD_TYPE_IT); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".itp")), MOD_TYPE_IT); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("itp")), MOD_TYPE_IT); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("mptm")), MOD_TYPE_MPT); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("invalidExtension")), MOD_TYPE_NONE); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("ita")), MOD_TYPE_NONE); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("s2m")), MOD_TYPE_NONE); - VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("")), MOD_TYPE_NONE); + VERIFY_EQUAL(CModSpecifications::ExtensionToType(".mod"), MOD_TYPE_MOD); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("mod"), MOD_TYPE_MOD); + VERIFY_EQUAL(CModSpecifications::ExtensionToType(".s3m"), MOD_TYPE_S3M); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("s3m"), MOD_TYPE_S3M); + VERIFY_EQUAL(CModSpecifications::ExtensionToType(".xm"), MOD_TYPE_XM); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("xm"), MOD_TYPE_XM); + VERIFY_EQUAL(CModSpecifications::ExtensionToType(".it"), MOD_TYPE_IT); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("it"), MOD_TYPE_IT); + VERIFY_EQUAL(CModSpecifications::ExtensionToType(".itp"), MOD_TYPE_IT); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("itp"), MOD_TYPE_IT); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("mptm"), MOD_TYPE_MPT); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("invalidExtension"), MOD_TYPE_NONE); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("ita"), MOD_TYPE_NONE); + VERIFY_EQUAL(CModSpecifications::ExtensionToType("s2m"), MOD_TYPE_NONE); + VERIFY_EQUAL(CModSpecifications::ExtensionToType(""), MOD_TYPE_NONE); VERIFY_EQUAL( Util::Round(1.99), 2.0 ); VERIFY_EQUAL( Util::Round(1.5), 2.0 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-09 14:05:08
|
Revision: 2676 http://sourceforge.net/p/modplug/code/2676 Author: manxorist Date: 2013-09-09 14:05:01 +0000 (Mon, 09 Sep 2013) Log Message: ----------- [Ref] Fix some 64bit warnings. Modified Paths: -------------- trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/soundlib/Dither.cpp Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2013-09-09 13:59:02 UTC (rev 2675) +++ trunk/OpenMPT/common/mptString.cpp 2013-09-09 14:05:01 UTC (rev 2676) @@ -91,7 +91,7 @@ return std::string(); } std::vector<CHAR> encoded_string(required_size); - WideCharToMultiByte(codepage, 0, src.c_str(), -1, &encoded_string[0], encoded_string.size(), nullptr, nullptr); + WideCharToMultiByte(codepage, 0, src.c_str(), -1, &encoded_string[0], required_size, nullptr, nullptr); return &encoded_string[0]; #else // !WIN32 iconv_t conv = iconv_t(); @@ -125,7 +125,7 @@ return std::wstring(); } std::vector<WCHAR> decoded_string(required_size); - MultiByteToWideChar(codepage, 0, src.c_str(), -1, &decoded_string[0], decoded_string.size()); + MultiByteToWideChar(codepage, 0, src.c_str(), -1, &decoded_string[0], required_size); return &decoded_string[0]; #else // !WIN32 iconv_t conv = iconv_t(); Modified: trunk/OpenMPT/soundlib/Dither.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dither.cpp 2013-09-09 13:59:02 UTC (rev 2675) +++ trunk/OpenMPT/soundlib/Dither.cpp 2013-09-09 14:05:01 UTC (rev 2676) @@ -87,8 +87,8 @@ return (int32)b; } -static void C_Dither(int *pBuffer, UINT nSamples, UINT nBits, DitherModPlugState *state) -//-------------------------------------------------------------------------------------- +static void C_Dither(int *pBuffer, std::size_t count, UINT nBits, DitherModPlugState *state) +//------------------------------------------------------------------------------------------ { if(nBits + MIXING_ATTENUATION + 1 >= 32) //if(nBits>16) { @@ -101,7 +101,7 @@ uint32 a = state ? state->rng_a : global_a; uint32 b = state ? state->rng_b : global_b; - while(nSamples--) + while(count--) { *pBuffer += dither_rand(a, b) >> (nBits + MIXING_ATTENUATION + 1); pBuffer++; @@ -112,13 +112,13 @@ } -static void Dither_ModPlug(int *pBuffer, UINT nSamples, UINT nChannels, UINT nBits, DitherModPlugState &state) -//------------------------------------------------------------------------------------------------------------ +static void Dither_ModPlug(int *pBuffer, std::size_t count, std::size_t channels, UINT nBits, DitherModPlugState &state) +//---------------------------------------------------------------------------------------------------------------------- { #ifdef ENABLE_X86 - X86_Dither(pBuffer, nSamples * nChannels, nBits, &state); + X86_Dither(pBuffer, count * channels, nBits, &state); #else // !ENABLE_X86 - C_Dither(pBuffer, nSamples * nChannels, nBits, &state); + C_Dither(pBuffer, count * channels, nBits, &state); #endif // ENABLE_X86 } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-09 16:45:01
|
Revision: 2682 http://sourceforge.net/p/modplug/code/2682 Author: manxorist Date: 2013-09-09 16:44:47 +0000 (Mon, 09 Sep 2013) Log Message: ----------- Merged revision(s) 2653-2654, 2660, 2664, 2678, 2681 from branches/manx/lossy-export: [Imp] mod2wav: Use a common dialog for wav and compressed exporting. [New] mod2wav: Allow all the filtering options available for wav export also for lossy export. [New] mod2wav: Support normalizing compressed outputs. [New] mod2wav: Support tagging wav files. [Ref] mod2wav: Rewrite MP3 export code via BladeEnc and Windows ACM APIs, implementing a clean codec interface. [New] mod2wav: Add MP3 export using native libmp3lame interface. [Imp] mod2wav: Be explicit to the user about which MP3 codec is used when exporting. [New] mod2wav: Add FLAC export. [Mod] mod2wav: Avoid fiddling with sample preamp when exporting. [Mod] Remove /noacm command line option. All supported windows versions have the required ACM version available. [Ref] Support writing to std::ostream in WavWriter. [Ref] Cleanup .wav and .mp3 tagging code. [Mod] Rename file export menu entries. ........ [New] mod2wav: Support exporting to Ogg Vorbis encoded files using externally-supplied vorbis and ogg DLLs. [New] mod2wav: Support exporting to IETF Opus encoded files using externally-supplied opus and ogg DLLs. [Var] Add headers from libogg v1.3.1 [Var] Add headers from libvorbis v1.3.3 [Var] Add headers from libopus v1.1-beta [Var] Add opus_header.[ch] from opus-tools v0.1.6 ........ [Ref] When rendering a song, always set mixer setting MaxMixChannels to MAX_CHANNELS instead of checking at every occasion if we are actually rendering. ........ [Fix] mod2wav: Write file tags in proper character encoding. ........ [Fix] mod2wav: Re-add genre list from lame mp3 codec. ........ [Ref] mod2wav: Cleanup codec naming. ........ Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/mod2wave.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/SampleFormat.h trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/WAVTools.cpp trunk/OpenMPT/soundlib/WAVTools.h Added Paths: ----------- trunk/OpenMPT/include/ogg/ trunk/OpenMPT/include/opus/ trunk/OpenMPT/include/vorbis/ trunk/OpenMPT/mptrack/StreamEncoder.cpp trunk/OpenMPT/mptrack/StreamEncoder.h trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp trunk/OpenMPT/mptrack/StreamEncoderFLAC.h trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp trunk/OpenMPT/mptrack/StreamEncoderMP3.h trunk/OpenMPT/mptrack/StreamEncoderOpus.cpp trunk/OpenMPT/mptrack/StreamEncoderOpus.h trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp trunk/OpenMPT/mptrack/StreamEncoderVorbis.h trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp trunk/OpenMPT/mptrack/StreamEncoderWAV.h trunk/OpenMPT/soundlib/Tagging.cpp trunk/OpenMPT/soundlib/Tagging.h Removed Paths: ------------- trunk/OpenMPT/mptrack/ACMConvert.cpp trunk/OpenMPT/mptrack/ACMConvert.h trunk/OpenMPT/mptrack/tagging.cpp trunk/OpenMPT/mptrack/tagging.h Property Changed: ---------------- trunk/OpenMPT/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT 2013-09-09 16:44:47 UTC (rev 2682) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -2,6 +2,8 ## /branches/manx/gcc-fixes:2018-2022,2024-2048,2052-2071,2075-2077,2080,2087-2089 /branches/manx/header-dependencies-cleanups:1394-1397,1401-1402,1405-1406 /branches/manx/instrument-fields-fixes:2203-2238 +/branches/manx/lossy-export:2653-2654,2660,2664,2678,2681 +/branches/manx/lossy-export-xiph:2663,2677,2680 /branches/manx/mptstring-stdstring-support:2204,2208,2212,2214,2217,2220,2224,2259,2261-2262,2264,2267 /branches/manx/nonglobal-mixer:1715-1841 /branches/manx/premake:2606,2609-2610,2614,2616,2621,2624,2641 \ No newline at end of property Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-09-09 16:44:47 UTC (rev 2682) @@ -464,6 +464,7 @@ <ClInclude Include="..\soundlib\Snd_defs.h" /> <ClInclude Include="..\soundlib\SoundFilePlayConfig.h" /> <ClInclude Include="..\soundlib\Tables.h" /> + <ClInclude Include="..\soundlib\Tagging.h" /> <ClInclude Include="..\soundlib\tuning.h" /> <ClInclude Include="..\soundlib\tuningbase.h" /> <ClInclude Include="..\soundlib\tuningcollection.h" /> @@ -551,6 +552,7 @@ <ClCompile Include="..\soundlib\Snd_fx.cpp" /> <ClCompile Include="..\soundlib\SoundFilePlayConfig.cpp" /> <ClCompile Include="..\soundlib\Tables.cpp" /> + <ClCompile Include="..\soundlib\Tagging.cpp" /> <ClCompile Include="..\soundlib\tuning.cpp" /> <ClCompile Include="..\soundlib\tuningbase.cpp" /> <ClCompile Include="..\soundlib\tuningCollection.cpp" /> Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-09-09 16:44:47 UTC (rev 2682) @@ -245,6 +245,9 @@ <ClInclude Include="..\soundlib\SampleFormat.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> + <ClInclude Include="..\soundlib\Tagging.h"> + <Filter>Header Files\soundlib</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> @@ -502,5 +505,8 @@ <ClCompile Include="..\soundlib\MixerLoops.cpp"> <Filter>Source Files\soundlib</Filter> </ClCompile> + <ClCompile Include="..\soundlib\Tagging.cpp"> + <Filter>Source Files\soundlib</Filter> + </ClCompile> </ItemGroup> </Project> \ No newline at end of file Deleted: trunk/OpenMPT/mptrack/ACMConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ACMConvert.cpp 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/mptrack/ACMConvert.cpp 2013-09-09 16:44:47 UTC (rev 2682) @@ -1,532 +0,0 @@ -/* - * ACMConvert.cpp - * -------------- - * Purpose: MPEG Layer-3 Functions through ACM. - * Notes : Access to LAMEenc and BLADEenc is emulated through the ACM interface. - * Authors: Olivier Lapicque - * OpenMPT Devs - * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. - */ - - -#include "stdafx.h" -#include <bladeenc/bladedll.h> -#include "Mptrack.h" -#include "ACMConvert.h" - - -typedef struct BLADEENCSTREAMINFO -{ - BE_CONFIG beCfg; - LONGLONG dummy; - DWORD dwInputSamples; - DWORD dwOutputSamples; - HBE_STREAM hBeStream; - SHORT *pPCMBuffer; - DWORD dwReadPos; -} BLADEENCSTREAMINFO, *PBLADEENCSTREAMINFO; - -static PBLADEENCSTREAMINFO gpbeBladeCfg = NULL; -static PBLADEENCSTREAMINFO gpbeLameCfg = NULL; -BOOL ACMConvert::layer3Present = FALSE; - - -BOOL ACMConvert::InitializeACM(BOOL bNoAcm) -//----------------------------------------- -{ - DWORD (ACMAPI *pfnAcmGetVersion)(void); - DWORD dwVersion; - UINT fuErrorMode; - BOOL bOk = FALSE; - - fuErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX); - try { - m_hBladeEnc = LoadLibrary(TEXT("BLADEENC.DLL")); - m_hLameEnc = LoadLibrary(TEXT("LAME_ENC.DLL")); - } catch(...) {} - if (!bNoAcm) - { - try { - m_hACMInst = LoadLibrary(TEXT("MSACM32.DLL")); - } catch(...) - { - m_hACMInst = NULL; - } - } - SetErrorMode(fuErrorMode); - if (m_hBladeEnc != NULL) - { - BEVERSION pfnBeVersion = (BEVERSION)GetProcAddress(m_hBladeEnc, TEXT_BEVERSION); - if (!pfnBeVersion) - { - FreeLibrary(m_hBladeEnc); - m_hBladeEnc = NULL; - } else - { - layer3Present = TRUE; - bOk = TRUE; - } - } - if (m_hLameEnc != NULL) - { - BEVERSION pfnBeVersion = (BEVERSION)GetProcAddress(m_hLameEnc, TEXT_BEVERSION); - if (!pfnBeVersion) - { - FreeLibrary(m_hLameEnc); - m_hLameEnc = NULL; - } else - { - layer3Present = TRUE; - bOk = TRUE; - } - } - if ((m_hACMInst < (HINSTANCE)HINSTANCE_ERROR) || (!m_hACMInst)) - { - m_hACMInst = NULL; - return bOk; - } - try { - *(FARPROC *)&pfnAcmGetVersion = GetProcAddress(m_hACMInst, "acmGetVersion"); - dwVersion = 0; - if (pfnAcmGetVersion) dwVersion = pfnAcmGetVersion(); - if (HIWORD(dwVersion) < 0x0200) - { - FreeLibrary(m_hACMInst); - m_hACMInst = NULL; - return bOk; - } - // Load Function Pointers - m_pfnAcmFormatEnum = (PFNACMFORMATENUM)GetProcAddress(m_hACMInst, "acmFormatEnumA"); - // Enumerate formats - if (m_pfnAcmFormatEnum) - { - ACMFORMATDETAILS afd; - BYTE wfx[256]; - WAVEFORMATEX *pwfx = (WAVEFORMATEX *)&wfx; - - MemsetZero(afd); - MemsetZero(*pwfx); - afd.cbStruct = sizeof(ACMFORMATDETAILS); - afd.dwFormatTag = WAVE_FORMAT_PCM; - afd.pwfx = pwfx; - afd.cbwfx = sizeof(wfx); - pwfx->wFormatTag = WAVE_FORMAT_PCM; - pwfx->nChannels = 2; - pwfx->nSamplesPerSec = 44100; - pwfx->wBitsPerSample = 16; - pwfx->nBlockAlign = (WORD)((pwfx->nChannels * pwfx->wBitsPerSample) / 8); - pwfx->nAvgBytesPerSec = pwfx->nSamplesPerSec * pwfx->nBlockAlign; - m_pfnAcmFormatEnum(NULL, &afd, AcmFormatEnumCB, NULL, ACM_FORMATENUMF_CONVERT); - bOk = TRUE; - } - } catch(...) - { - // nothing - } - return bOk; -} - - -BOOL ACMConvert::UninitializeACM() -//-------------------------------- -{ - if (m_hACMInst) - { - FreeLibrary(m_hACMInst); - m_hACMInst = NULL; - } - if (m_hLameEnc) - { - FreeLibrary(m_hLameEnc); - m_hLameEnc = NULL; - } - if (m_hBladeEnc) - { - FreeLibrary(m_hBladeEnc); - m_hBladeEnc = NULL; - } - layer3Present = FALSE; - return TRUE; -} - - -MMRESULT ACMConvert::AcmFormatEnum(HACMDRIVER had, LPACMFORMATDETAILSA pafd, ACMFORMATENUMCBA fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum) -//-------------------------------------------------------------------------------------------------------------------------------------------- -{ - MMRESULT err = MMSYSERR_INVALPARAM; - if ((m_hBladeEnc) || (m_hLameEnc)) - { - HACMDRIVER hBlade = (HACMDRIVER)&m_hBladeEnc; - HACMDRIVER hLame = (HACMDRIVER)&m_hLameEnc; - if (((had == hBlade) || (had == hLame) || (had == NULL)) && (pafd) && (fnCallback) - && (fdwEnum & ACM_FORMATENUMF_CONVERT) && (pafd->dwFormatTag == WAVE_FORMAT_PCM)) - { - ACMFORMATDETAILS afd; - MPEGLAYER3WAVEFORMAT wfx; - - afd.dwFormatIndex = 0; - for (UINT iFmt=0; iFmt<0x40; iFmt++) - { - afd.cbStruct = sizeof(afd); - afd.dwFormatTag = WAVE_FORMAT_MPEGLAYER3; - afd.fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; - afd.pwfx = (LPWAVEFORMATEX)&wfx; - afd.cbwfx = sizeof(wfx); - wfx.wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3; - wfx.wfx.nChannels = (WORD)((iFmt & 0x20) ? 1 : 2); - wfx.wfx.nSamplesPerSec = 0; - wfx.wfx.nBlockAlign = 1; - wfx.wfx.wBitsPerSample = 0; - wfx.wfx.cbSize = MPEGLAYER3_WFX_EXTRA_BYTES; - wfx.wID = MPEGLAYER3_ID_MPEG; - wfx.fdwFlags = MPEGLAYER3_FLAG_PADDING_ISO; - wfx.nBlockSize = 384; - wfx.nFramesPerBlock = 1; - wfx.nCodecDelay = 1000; - switch((iFmt >> 3) & 0x03) - { - case 0x00: wfx.wfx.nSamplesPerSec = 48000; break; - case 0x01: wfx.wfx.nSamplesPerSec = 44100; break; - case 0x02: wfx.wfx.nSamplesPerSec = 32000; break; - } - switch(iFmt & 7) - { - case 5: wfx.wfx.nAvgBytesPerSec = 320/8; break; - case 4: wfx.wfx.nAvgBytesPerSec = 64/8; break; - case 3: wfx.wfx.nAvgBytesPerSec = 96/8; break; - case 2: wfx.wfx.nAvgBytesPerSec = 128/8; break; - case 1: if (wfx.wfx.nChannels == 2) { wfx.wfx.nAvgBytesPerSec = 192/8; break; } - case 0: if (wfx.wfx.nChannels == 2) { wfx.wfx.nAvgBytesPerSec = 256/8; break; } - default: wfx.wfx.nSamplesPerSec = 0; - } - wsprintf(afd.szFormat, "%dkbps, %dHz, %s", wfx.wfx.nAvgBytesPerSec*8, wfx.wfx.nSamplesPerSec, (wfx.wfx.nChannels == 2) ? "stereo" : "mono"); - if (wfx.wfx.nSamplesPerSec) - { - if (m_hBladeEnc) fnCallback((HACMDRIVERID)hBlade, &afd, dwInstance, ACMDRIVERDETAILS_SUPPORTF_CODEC); - if (m_hLameEnc) fnCallback((HACMDRIVERID)hLame, &afd, dwInstance, ACMDRIVERDETAILS_SUPPORTF_CODEC); - afd.dwFormatIndex++; - } - } - err = MMSYSERR_NOERROR; - } - } - if (m_pfnAcmFormatEnum) - { - err = m_pfnAcmFormatEnum(had, pafd, fnCallback, dwInstance, fdwEnum); - } - return err; -} - - -BOOL ACMConvert::AcmFormatEnumCB(HACMDRIVERID, LPACMFORMATDETAILS pafd, DWORD_PTR, DWORD fdwSupport) -//-------------------------------------------------------------------------------------------------- -{ - if ((pafd) && (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC)) - { - if (pafd->dwFormatTag == WAVE_FORMAT_MPEGLAYER3) layer3Present = TRUE; - } - return TRUE; -} - - -MMRESULT ACMConvert::AcmDriverOpen(LPHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen) -//-------------------------------------------------------------------------------------- -{ - if ((m_hBladeEnc) && (hadid == (HACMDRIVERID)&m_hBladeEnc)) - { - *phad = (HACMDRIVER)&m_hBladeEnc; - return MMSYSERR_NOERROR; - } - if ((m_hLameEnc) && (hadid == (HACMDRIVERID)&m_hLameEnc)) - { - *phad = (HACMDRIVER)&m_hLameEnc; - return MMSYSERR_NOERROR; - } - if (m_hACMInst) - { - PFNACMDRIVEROPEN pfnAcmDriverOpen = (PFNACMDRIVEROPEN)GetProcAddress(m_hACMInst, "acmDriverOpen"); - if (pfnAcmDriverOpen) return pfnAcmDriverOpen(phad, hadid, fdwOpen); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmDriverClose(HACMDRIVER had, DWORD fdwClose) -//----------------------------------------------------------------- -{ - if ((m_hBladeEnc) && (had == (HACMDRIVER)&m_hBladeEnc)) - { - return MMSYSERR_NOERROR; - } - if ((m_hLameEnc) && (had == (HACMDRIVER)&m_hLameEnc)) - { - return MMSYSERR_NOERROR; - } - if (m_hACMInst) - { - PFNACMDRIVERCLOSE pfnAcmDriverClose = (PFNACMDRIVERCLOSE)GetProcAddress(m_hACMInst, "acmDriverClose"); - if (pfnAcmDriverClose) return pfnAcmDriverClose(had, fdwClose); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmDriverDetails(HACMDRIVERID hadid, LPACMDRIVERDETAILS padd, DWORD fdwDetails) -//-------------------------------------------------------------------------------------------------- -{ - if (((m_hBladeEnc) && (hadid == (HACMDRIVERID)(&m_hBladeEnc))) - || ((m_hLameEnc) && (hadid == (HACMDRIVERID)(&m_hLameEnc)))) - { - if (!padd) return MMSYSERR_INVALPARAM; - padd->cbStruct = sizeof(ACMDRIVERDETAILS); - padd->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; - padd->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED; - padd->wMid = 0; - padd->wPid = 0; - padd->vdwACM = 0x04020000; - padd->vdwDriver = 0x04020000; - padd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; - padd->cFormatTags = 1; - padd->cFilterTags = 0; - padd->hicon = NULL; - strcpy(padd->szShortName, (hadid == (HACMDRIVERID)(&m_hBladeEnc)) ? "BladeEnc MP3" : "LAME Encoder"); - strcpy(padd->szLongName, padd->szShortName); - padd->szCopyright[0] = 0; - padd->szLicensing[0] = 0; - padd->szFeatures[0] = 0; - return MMSYSERR_NOERROR; - } - if (m_hACMInst) - { - PFNACMDRIVERDETAILS pfnAcmDriverDetails = (PFNACMDRIVERDETAILS)GetProcAddress(m_hACMInst, "acmDriverDetailsA"); - if (pfnAcmDriverDetails) return pfnAcmDriverDetails(hadid, padd, fdwDetails); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmStreamOpen( - LPHACMSTREAM phas, // pointer to stream handle - HACMDRIVER had, // optional driver handle - LPWAVEFORMATEX pwfxSrc, // source format to convert - LPWAVEFORMATEX pwfxDst, // required destination format - LPWAVEFILTER pwfltr, // optional filter - DWORD_PTR dwCallback, // callback - DWORD_PTR dwInstance, // callback instance data - DWORD fdwOpen) // ACM_STREAMOPENF_* and CALLBACK_* -//-------------------------------------------------------------------------- -{ - PBLADEENCSTREAMINFO *ppbeCfg = NULL; - HINSTANCE hLib = NULL; - - if ((m_hBladeEnc) && (had == (HACMDRIVER)&m_hBladeEnc)) - { - ppbeCfg = &gpbeBladeCfg; - hLib = m_hBladeEnc; - } - if ((m_hLameEnc) && (had == (HACMDRIVER)&m_hLameEnc)) - { - ppbeCfg = &gpbeLameCfg; - hLib = m_hLameEnc; - } - if ((ppbeCfg) && (hLib)) - { - BEINITSTREAM pfnbeInitStream = (BEINITSTREAM)GetProcAddress(hLib, TEXT_BEINITSTREAM); - if (!pfnbeInitStream) return MMSYSERR_INVALPARAM; - PBLADEENCSTREAMINFO pbeCfg = new BLADEENCSTREAMINFO; - if ((pbeCfg) && (pwfxSrc) && (pwfxDst) && (pwfxSrc->nChannels == pwfxDst->nChannels) - && (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM) && (pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3) - && (pwfxSrc->wBitsPerSample == 16)) - { - pbeCfg->dwInputSamples = 2048; - pbeCfg->dwOutputSamples = 2048; - pbeCfg->beCfg.dwConfig = BE_CONFIG_MP3; - pbeCfg->beCfg.format.mp3.dwSampleRate = pwfxDst->nSamplesPerSec; // 48000, 44100 and 32000 allowed - pbeCfg->beCfg.format.mp3.byMode = (BYTE)((pwfxSrc->nChannels == 2) ? BE_MP3_MODE_STEREO : BE_MP3_MODE_MONO); - pbeCfg->beCfg.format.mp3.wBitrate = (WORD)(pwfxDst->nAvgBytesPerSec * 8); // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed - pbeCfg->beCfg.format.mp3.bPrivate = FALSE; - pbeCfg->beCfg.format.mp3.bCRC = FALSE; - pbeCfg->beCfg.format.mp3.bCopyright = FALSE; - pbeCfg->beCfg.format.mp3.bOriginal = TRUE; - pbeCfg->hBeStream = NULL; - if (pfnbeInitStream(&pbeCfg->beCfg, &pbeCfg->dwInputSamples, &pbeCfg->dwOutputSamples, &pbeCfg->hBeStream) == BE_ERR_SUCCESSFUL) - { - *phas = (HACMSTREAM)had; - *ppbeCfg = pbeCfg; - pbeCfg->pPCMBuffer = (SHORT *)GlobalAllocPtr(GHND, pbeCfg->dwInputSamples * sizeof(SHORT)); - pbeCfg->dwReadPos = 0; - return MMSYSERR_NOERROR; - } - } - if (pbeCfg) delete pbeCfg; - return MMSYSERR_INVALPARAM; - } - if (m_hACMInst) - { - PFNACMSTREAMOPEN pfnAcmStreamOpen = (PFNACMSTREAMOPEN)GetProcAddress(m_hACMInst, "acmStreamOpen"); - if (pfnAcmStreamOpen) return pfnAcmStreamOpen(phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmStreamClose(HACMSTREAM has, DWORD fdwClose) -//----------------------------------------------------------------- -{ - if (((m_hBladeEnc) && (has == (HACMSTREAM)&m_hBladeEnc)) - || ((m_hLameEnc) && (has == (HACMSTREAM)&m_hLameEnc))) - { - HINSTANCE hLib = *(HINSTANCE *)has; - PBLADEENCSTREAMINFO pbeCfg = (has == (HACMSTREAM)&m_hBladeEnc) ? gpbeBladeCfg : gpbeLameCfg; - BECLOSESTREAM pfnbeCloseStream = (BECLOSESTREAM)GetProcAddress(hLib, TEXT_BECLOSESTREAM); - if ((pbeCfg) && (pfnbeCloseStream)) - { - pfnbeCloseStream(pbeCfg->hBeStream); - if (pbeCfg->pPCMBuffer) - { - GlobalFreePtr(pbeCfg->pPCMBuffer); - pbeCfg->pPCMBuffer = NULL; - } - delete pbeCfg; - pbeCfg = NULL; - return MMSYSERR_NOERROR; - } - return MMSYSERR_INVALPARAM; - } - if (m_hACMInst) - { - PFNACMSTREAMCLOSE pfnAcmStreamClose = (PFNACMSTREAMCLOSE)GetProcAddress(m_hACMInst, "acmStreamClose"); - if (pfnAcmStreamClose) return pfnAcmStreamClose(has, fdwClose); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize) -//------------------------------------------------------------------------------------------------------ -{ - if (((m_hBladeEnc) && (has == (HACMSTREAM)&m_hBladeEnc)) - || ((m_hLameEnc) && (has == (HACMSTREAM)&m_hLameEnc))) - { - PBLADEENCSTREAMINFO pbeCfg = (has == (HACMSTREAM)&m_hBladeEnc) ? gpbeBladeCfg : gpbeLameCfg; - - if ((pbeCfg) && (pdwOutputBytes)) - { - if (fdwSize & ACM_STREAMSIZEF_DESTINATION) - { - *pdwOutputBytes = pbeCfg->dwOutputSamples * sizeof(short); - } else - if (fdwSize & ACM_STREAMSIZEF_SOURCE) - { - *pdwOutputBytes = pbeCfg->dwInputSamples * sizeof(short); - } - return MMSYSERR_NOERROR; - } - return MMSYSERR_INVALPARAM; - } - if (m_hACMInst) - { - if (fdwSize & ACM_STREAMSIZEF_DESTINATION) // Why does acmStreamSize return ACMERR_NOTPOSSIBLE in this case? - return MMSYSERR_NOERROR; - PFNACMSTREAMSIZE pfnAcmStreamSize = (PFNACMSTREAMSIZE)GetProcAddress(m_hACMInst, "acmStreamSize"); - if (pfnAcmStreamSize) return pfnAcmStreamSize(has, cbInput, pdwOutputBytes, fdwSize); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmStreamPrepareHeader(HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwPrepare) -//--------------------------------------------------------------------------------------------------- -{ - if (((m_hBladeEnc) && (has == (HACMSTREAM)&m_hBladeEnc)) - || ((m_hLameEnc) && (has == (HACMSTREAM)&m_hLameEnc))) - { - pash->fdwStatus = ACMSTREAMHEADER_STATUSF_PREPARED; - return MMSYSERR_NOERROR; - } - if (m_hACMInst) - { - PFNACMSTREAMCONVERT pfnAcmStreamPrepareHeader = (PFNACMSTREAMCONVERT)GetProcAddress(m_hACMInst, "acmStreamPrepareHeader"); - if (pfnAcmStreamPrepareHeader) return pfnAcmStreamPrepareHeader(has, pash, fdwPrepare); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmStreamUnprepareHeader(HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwUnprepare) -//------------------------------------------------------------------------------------------------------- -{ - if (((m_hBladeEnc) && (has == (HACMSTREAM)&m_hBladeEnc)) - || ((m_hLameEnc) && (has == (HACMSTREAM)&m_hLameEnc))) - { - pash->fdwStatus &= ~ACMSTREAMHEADER_STATUSF_PREPARED; - return MMSYSERR_NOERROR; - } - if (m_hACMInst) - { - PFNACMSTREAMCONVERT pfnAcmStreamUnprepareHeader = (PFNACMSTREAMCONVERT)GetProcAddress(m_hACMInst, "acmStreamUnprepareHeader"); - if (pfnAcmStreamUnprepareHeader) return pfnAcmStreamUnprepareHeader(has, pash, fdwUnprepare); - } - return MMSYSERR_INVALPARAM; -} - - -MMRESULT ACMConvert::AcmStreamConvert(HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwConvert) -//--------------------------------------------------------------------------------------------- -{ - static BEENCODECHUNK pfnbeEncodeChunk = NULL; - static BEDEINITSTREAM pfnbeDeinitStream = NULL; - static HINSTANCE hInstEncode = NULL; - - if (((m_hBladeEnc) && (has == (HACMSTREAM)&m_hBladeEnc)) - || ((m_hLameEnc) && (has == (HACMSTREAM)&m_hLameEnc))) - { - PBLADEENCSTREAMINFO pbeCfg = (has == (HACMSTREAM)&m_hBladeEnc) ? gpbeBladeCfg : gpbeLameCfg; - HINSTANCE hLib = *(HINSTANCE *)has; - - if (hInstEncode != hLib) - { - pfnbeEncodeChunk = (BEENCODECHUNK)GetProcAddress(hLib, TEXT_BEENCODECHUNK); - pfnbeDeinitStream = (BEDEINITSTREAM)GetProcAddress(hLib, TEXT_BEDEINITSTREAM); - hInstEncode = hLib; - } - pash->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE; - if (fdwConvert & ACM_STREAMCONVERTF_END) - { - if ((pfnbeDeinitStream) && (pbeCfg)) - { - pfnbeDeinitStream(pbeCfg->hBeStream, pash->pbDst, &pash->cbDstLengthUsed); - return MMSYSERR_NOERROR; - } - } else - { - if ((pfnbeEncodeChunk) && (pbeCfg)) - { - DWORD dwBytesLeft = pbeCfg->dwInputSamples*2 - pbeCfg->dwReadPos; - if (!dwBytesLeft) - { - dwBytesLeft = pbeCfg->dwInputSamples*2; - pbeCfg->dwReadPos = 0; - } - if (dwBytesLeft > pash->cbSrcLength) dwBytesLeft = pash->cbSrcLength; - memcpy(&pbeCfg->pPCMBuffer[pbeCfg->dwReadPos/2], pash->pbSrc, dwBytesLeft); - pbeCfg->dwReadPos += dwBytesLeft; - pash->cbSrcLengthUsed = dwBytesLeft; - pash->cbDstLengthUsed = 0; - if (pbeCfg->dwReadPos == pbeCfg->dwInputSamples*2) - { - if (pfnbeEncodeChunk(pbeCfg->hBeStream, pbeCfg->dwInputSamples, pbeCfg->pPCMBuffer, pash->pbDst, &pash->cbDstLengthUsed) != 0) return MMSYSERR_INVALPARAM; - pbeCfg->dwReadPos = 0; - } - return MMSYSERR_NOERROR; - } - } - return MMSYSERR_INVALPARAM; - } - if (m_hACMInst) - { - PFNACMSTREAMCONVERT pfnAcmStreamConvert = (PFNACMSTREAMCONVERT)GetProcAddress(m_hACMInst, "acmStreamConvert"); - if (pfnAcmStreamConvert) return pfnAcmStreamConvert(has, pash, fdwConvert); - } - return MMSYSERR_INVALPARAM; -} Deleted: trunk/OpenMPT/mptrack/ACMConvert.h =================================================================== --- trunk/OpenMPT/mptrack/ACMConvert.h 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/mptrack/ACMConvert.h 2013-09-09 16:44:47 UTC (rev 2682) @@ -1,71 +0,0 @@ -/* - * ACMConvert.h - * ------------ - * Purpose: MPEG Layer-3 Functions through ACM. - * Notes : Access to LAMEenc and BLADEenc is emulated through the ACM interface. - * Authors: Olivier Lapicque - * OpenMPT Devs - * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. - */ - - -#pragma once - -///////////////////////////////////////////////////////////////////////////// -// ACM Functions (for dynamic linking) - -typedef VOID (ACMAPI *PFNACMMETRICS)(HACMOBJ, UINT, LPVOID); -typedef MMRESULT (ACMAPI *PFNACMFORMATENUM)(HACMDRIVER, LPACMFORMATDETAILSA, ACMFORMATENUMCBA, DWORD_PTR dwInstance, DWORD fdwEnum); -typedef MMRESULT (ACMAPI *PFNACMDRIVEROPEN)(LPHACMDRIVER, HACMDRIVERID, DWORD); -typedef MMRESULT (ACMAPI *PFNACMDRIVERCLOSE)(HACMDRIVER, DWORD); -typedef MMRESULT (ACMAPI *PFNACMSTREAMOPEN)(LPHACMSTREAM, HACMDRIVER, LPWAVEFORMATEX, LPWAVEFORMATEX, LPWAVEFILTER, DWORD_PTR, DWORD_PTR, DWORD); -typedef MMRESULT (ACMAPI *PFNACMSTREAMCLOSE)(HACMSTREAM, DWORD); -typedef MMRESULT (ACMAPI *PFNACMSTREAMSIZE)(HACMSTREAM, DWORD, LPDWORD, DWORD); -typedef MMRESULT (ACMAPI *PFNACMSTREAMCONVERT)(HACMSTREAM, LPACMSTREAMHEADER, DWORD); -typedef MMRESULT (ACMAPI *PFNACMDRIVERDETAILS)(HACMDRIVERID, LPACMDRIVERDETAILS, DWORD); - - -//============== -class ACMConvert -//============== -{ -protected: - HINSTANCE m_hACMInst; - HINSTANCE m_hBladeEnc, m_hLameEnc; - PFNACMFORMATENUM m_pfnAcmFormatEnum; - static BOOL layer3Present; - -private: - BOOL InitializeACM(BOOL bNoAcm = FALSE); - BOOL UninitializeACM(); -public: - MMRESULT AcmFormatEnum(HACMDRIVER had, LPACMFORMATDETAILSA pafd, ACMFORMATENUMCBA fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum); - MMRESULT AcmDriverOpen(LPHACMDRIVER, HACMDRIVERID, DWORD); - MMRESULT AcmDriverDetails(HACMDRIVERID hadid, LPACMDRIVERDETAILS padd, DWORD fdwDetails); - MMRESULT AcmDriverClose(HACMDRIVER, DWORD); - MMRESULT AcmStreamOpen(LPHACMSTREAM, HACMDRIVER, LPWAVEFORMATEX, LPWAVEFORMATEX, LPWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen); - MMRESULT AcmStreamClose(HACMSTREAM, DWORD); - MMRESULT AcmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize); - MMRESULT AcmStreamPrepareHeader(HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwPrepare); - MMRESULT AcmStreamUnprepareHeader(HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwUnprepare); - MMRESULT AcmStreamConvert(HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwConvert); - BOOL IsLayer3Present() const { return layer3Present; }; - - ACMConvert(bool noACM) - { - layer3Present = FALSE; - m_hBladeEnc = NULL; - m_hLameEnc = NULL; - m_hACMInst = NULL; - m_pfnAcmFormatEnum = NULL; - InitializeACM(noACM); - } - ~ACMConvert() - { - UninitializeACM(); - } - -protected: - static BOOL CALLBACK AcmFormatEnumCB(HACMDRIVERID, LPACMFORMATDETAILS, DWORD_PTR, DWORD); - -}; Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2013-09-09 16:44:47 UTC (rev 2682) @@ -433,8 +433,8 @@ DefineKeyCommand(kcFileClose, 1348, _T("File/Close")); DefineKeyCommand(kcFileSave, 1349, _T("File/Save")); DefineKeyCommand(kcFileSaveAs, 1350, _T("File/Save As")); - DefineKeyCommand(kcFileSaveAsWave, 1351, _T("File/Export as Wave")); - DefineKeyCommand(kcFileSaveAsMP3, 1352, _T("File/Export as MP3")); + DefineKeyCommand(kcFileSaveAsWave, 1351, _T("File/Export as lossless (Wave, FLAC)")); + DefineKeyCommand(kcFileSaveAsMP3, 1352, _T("File/Export as lossy (Opus, Vorbis, MP3")); DefineKeyCommand(kcFileSaveMidi, 1353, _T("File/Export as MIDI")); DefineKeyCommand(kcFileImportMidiLib, 1354, _T("File/Import MIDI Library")); DefineKeyCommand(kcFileAddSoundBank, 1355, _T("File/Add Sound Bank")); Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2013-09-09 16:44:47 UTC (rev 2682) @@ -502,8 +502,8 @@ case ID_FILE_SAVE: s="&Save\t"; c = kcFileSave; break; case ID_FILE_SAVE_AS: s="Save &As...\t"; c = kcFileSaveAs; break; case ID_FILE_SAVEASTEMPLATE:s="Sa&ve as Template\t"; c = kcFileSaveTemplate; break; - case ID_FILE_SAVEASWAVE: s="Export as &Wave...\t"; c = kcFileSaveAsWave; break; - case ID_FILE_SAVEASMP3: s="Export as M&P3...\t"; c = kcFileSaveAsMP3; break; + case ID_FILE_SAVEASWAVE: s="Export as lossless (&Wave, FLAC)...\t"; c = kcFileSaveAsWave; break; + case ID_FILE_SAVEASMP3: s="Export as lossy (Opus, Vorbis, M&P3)...\t"; c = kcFileSaveAsMP3; break; case ID_FILE_SAVEMIDI: s="Export as M&IDI...\t"; c = kcFileSaveMidi; break; case ID_FILE_SAVECOMPAT: s="Compatibility &Export...\t"; c = kcFileExportCompat; break; case ID_IMPORT_MIDILIB: s="Import &MIDI Library...\t"; c = kcFileImportMidiLib; break; Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-09-09 15:37:16 UTC (rev 2681) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-09-09 16:44:47 UTC (rev 2682) @@ -18,8 +18,8 @@ #include "mod2wave.h" #include "Wav.h" #include "WAVTools.h" +#include "../common/mptString.h" #include "../common/version.h" -#include "ACMConvert.h" #include "../soundlib/MixerLoops.h" #include "../soundlib/Dither.h" #include "../soundlib/AudioReadTarget.h" @@ -28,7 +28,6 @@ extern LPCSTR gszChnCfgNames[3]; - static CSoundFile::samplecount_t ReadInterleaved(CSoundFile &sndFile, void *outputBuffer, CSoundFile::samplecount_t count, SampleFormat sampleFormat, Dither &dither) //------------------------------------------------------------------------------------------------------------------------------------------------------------------- { @@ -80,54 +79,6 @@ return 0; } - -static const GUID guid_MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}; -static const GUID guid_MEDIASUBTYPE_IEEE_FLOAT = {0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ID3v1 Genres - -static const char *id3v1GenreNames[] = -{ - "Blues", "Classic Rock", "Country", "Dance", - "Disco", "Funk", "Grunge", "Hip-Hop", - "Jazz", "Metal", "New Age", "Oldies", - "Other", "Pop", "R&B", "Rap", - "Reggae", "Rock", "Techno", "Industrial", - "Alternative", "Ska", "Death Metal", "Pranks", - "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", - "Vocal", "Jazz+Funk", "Fusion", "Trance", - "Classical", "Instrumental", "Acid", "House", - "Game", "Sound Clip", "Gospel", "Noise", - "Alt. Rock", "Bass", "Soul", "Punk", - "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", - "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", - "Electronic", "Pop-Folk", "Eurodance", "Dream", - "Southern Rock", "Comedy", "Cult", "Gangsta", - "Top 40", "Christian Rap", "Pop/Funk", "Jungle", - "Native American", "Cabaret", "New Wave", "Psychadelic", - "Rave", "Showtunes", "Trailer", "Lo-Fi", - "Tribal", "Acid Punk", "Acid Jazz", "Polka", - "Retro", "Musical", "Rock & Roll", "Hard Rock", - "Folk", "Folk-Rock", "National Folk", "Swing", - "Fast Fusion", "Bebob", "Latin", "Revival", - "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", - "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", - "Big Band", "Chorus", "Easy Listening", "Acoustic", - "Humour", "Speech", "Chanson", "Opera", - "Chamber Music", "Sonata", "Symphony", "Booty Bass", - "Primus", "Porn Groove", "Satire", "Slow Jam", - "Club", "Tango", "Samba", "Folklore", - "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", - "Duet", "Punk Rock", "Drum Solo", "A Capella", - "Euro-House", "Dance Hall", "Goa", "Drum & Bass", - "Club House", "Hardcore", "Terror", "Indie", - "BritPop", "Negerpunk", "Polsk Punk", "Beat", - "Christian Gangsta Rap","Heavy Metal", "Black Metal", "Crossover", - "Contemporary Christian", "Christian Rock", "Merengue", "Salsa", - "Thrash Metal", "Anime", "JPop", "Synthpop" -}; - /////////////////////////////////////////////////// // CWaveConvert - setup for converting a wave file @@ -139,15 +90,22 @@ ON_COMMAND(IDC_RADIO1, UpdateDialog) ON_COMMAND(IDC_RADIO2, UpdateDialog) ON_COMMAND(IDC_PLAYEROPTIONS, OnPlayerOptions) //rewbs.resamplerConf + ON_CBN_SELCHANGE(IDC_COMBO5, OnFileTypeChanged) + ON_CBN_SELCHANGE(IDC_COMBO1, OnSamplerateChanged) + ON_CBN_SELCHANGE(IDC_COMBO4, OnChannelsChanged) ON_CBN_SELCHANGE(IDC_COMBO2, OnFormatChanged) END_MESSAGE_MAP() -CWaveConvert::CWaveConvert(CWnd *parent, ORDERINDEX minOrder, ORDERINDEX maxOrder, ORDERINDEX numOrders) : CDialog(IDD_WAVECONVERT, parent) -//----------------------------------------------------------------------------------------------------------------------------------------- +CWaveConvert::CWaveConvert(CWnd *parent, ORDERINDEX minOrder, ORDERINDEX maxOrder, ORDERINDEX numOrders, CSoundFile *sndfile, std::size_t defaultEncoder, const std::vector<EncoderFactoryBase*> &encFactories) +//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + : CDialog(IDD_WAVECONVERT, parent) + , m_Settings(defaultEncoder, encFactories) { + ASSERT(!encFactories.empty()); + encTraits = m_Settings.GetTraits(); + m_pSndFile = sndfile; m_bGivePlugsIdleTime = false; - m_bNormalize = false; m_bHighQuality = false; m_bSelectPlay = false; if(minOrder != ORDERINDEX_INVALID && maxOrder != ORDERINDEX_INVALID) @@ -165,13 +123,6 @@ m_dwFileLimit = 0; m_dwSongLimit = 0; - MemsetZero(WaveFormat); - WaveFormat.Format.wFormatTag = WAVE_FORMAT_PCM; - WaveFormat.Format.nChannels = 2; - WaveFormat.Format.nSamplesPerSec = 44100; - WaveFormat.Format.wBitsPerSample = 16; - WaveFormat.Format.nBlockAlign = (WaveFormat.Format.wBitsPerSample * WaveFormat.Format.nChannels) / 8; - WaveFormat.Format.nAvgBytesPerSec = WaveFormat.Format.nSamplesPerSec * WaveFormat.Format.nBlockAlign; } @@ -179,23 +130,31 @@ //--------------------------------------------------- { CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_COMBO5, m_CbnFileType); DDX_Control(pDX, IDC_COMBO1, m_CbnSampleRate); + DDX_Control(pDX, IDC_COMBO4, m_CbnChannels); DDX_Control(pDX, IDC_COMBO2, m_CbnSampleFormat); DDX_Control(pDX, IDC_SPIN3, m_SpinMinOrder); DDX_Control(pDX, IDC_SPIN4, m_SpinMaxOrder); DDX_Control(pDX, IDC_SPIN5, m_SpinLoopCount); + + DDX_Control(pDX, IDC_COMBO3, m_CbnGenre); + DDX_Control(pDX, IDC_EDIT11, m_EditTitle); + DDX_Control(pDX, IDC_EDIT6, m_EditAuthor); + DDX_Control(pDX, IDC_EDIT7, m_EditAlbum); + DDX_Control(pDX, IDC_EDIT8, m_EditURL); + DDX_Control(pDX, IDC_EDIT9, m_EditYear); + + DDX_Control(pDX, IDC_EDIT10, m_EditInfo); } BOOL CWaveConvert::OnInitDialog() //------------------------------- { - CHAR s[128]; - CDialog::OnInitDialog(); CheckRadioButton(IDC_RADIO1, IDC_RADIO2, m_bSelectPlay ? IDC_RADIO2 : IDC_RADIO1); - CheckDlgButton(IDC_CHECK3, MF_CHECKED); // HQ resampling CheckDlgButton(IDC_CHECK5, MF_UNCHECKED); // rewbs.NoNormalize CheckDlgButton(IDC_CHECK4, MF_UNCHECKED); @@ -209,41 +168,240 @@ SetDlgItemInt(IDC_EDIT5, loopCount, FALSE); m_SpinLoopCount.SetRange(1, int16_max); - const std::vector<uint32> samplerates = TrackerSettings::Instance().GetSampleRates(); - for(size_t i = 0; i < samplerates.size(); i++) + FillFileTypes(); + FillSamplerates(); + FillChannels(); + FillFormats(); + + SetDlgItemText(IDC_EDIT11, m_pSndFile->GetTitle().c_str()); + m_EditYear.SetLimitText(4); + CTime tTime = CTime::GetCurrentTime(); + m_EditYear.SetWindowText(tTime.Format("%Y")); + + FillTags(); + + FillInfo(); + + UpdateDialog(); + return TRUE; +} + + +void CWaveConvert::FillTags() +//--------------------------- +{ + const bool canTags = encTraits->canTags; + + CheckDlgButton(IDC_CHECK7, canTags?m_Settings.EncoderSettings.Tags?TRUE:FALSE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK7), canTags?TRUE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_COMBO3), canTags?TRUE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT11), canTags?TRUE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT6), canTags?TRUE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT7), canTags?TRUE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT8), canTags?TRUE:FALSE); + ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT9), canTags?TRUE:FALSE); + + m_CbnGenre.ResetContent(); + if(!encTraits->genres.empty()) { - UINT n = samplerates[i]; - wsprintf(s, "%d Hz", n); - m_CbnSampleRate.SetItemData(m_CbnSampleRate.AddString(s), n); - if (n == WaveFormat.Format.nSamplesPerSec) m_CbnSampleRate.SetCurSel(i); + for(std::vector<std::string>::const_iterator genre = encTraits->genres.begin(); genre != encTraits->genres.end(); ++genre) + { + m_CbnGenre.AddString((*genre).c_str()); + } } - for (UINT j=0; j<3*4; j++) +} + + +void CWaveConvert::FillInfo() +//--------------------------- +{ + + std::string info; + info += "Format: "; + info += encTraits->fileDescription; + info += "\r\n"; + info += "Encoder: "; + info += encTraits->encoderName; + info += "\r\n"; + info += mpt::String::Replace(encTraits->description, "\n", "\r\n"); + SetDlgItemText(IDC_EDIT10, info.c_str()); +} + + +void CWaveConvert::FillFileTypes() +//-------------------------------- +{ + m_CbnFileType.ResetContent(); + int sel = 0; + for(std::size_t i = 0; i < m_Settings.EncoderFactories.size(); ++i) { - UINT n = 3*4-1-j; - UINT nBits = 8 * (1 + n % 4); - UINT nChannels = 1 << (n/4); - if ((nBits >= 16) || (nChannels <= 2)) + const Encoder::Traits &encTraits = m_Settings.EncoderFactories[i]->GetTraits(); + int ndx = m_CbnFileType.AddString(encTraits.fileShortDescription.c_str()); + m_CbnFileType.SetItemData(ndx, i); + } + m_CbnFileType.SetCurSel(sel); +} + + +void CWaveConvert::FillSamplerates() +//---------------------------------- +{ + m_CbnSampleRate.CComboBox::ResetContent(); + int sel = 0; + for(std::vector<uint32>::const_iterator it = encTraits->samplerates.begin(); it != encTraits->samplerates.end(); ++it) + { + uint32 samplerate = *it; + int ndx = m_CbnSampleRate.AddString(mpt::String::Format("%d Hz", samplerate).c_str()); + m_CbnSampleRate.SetItemData(ndx, samplerate); + if(samplerate == m_Settings.SampleRate) { - wsprintf(s, "%s, %d-Bit", gszChnCfgNames[n/4], nBits); - UINT ndx = m_CbnSampleFormat.AddString(s); - m_CbnSampleFormat.SetItemData(ndx, (nChannels<<8)|nBits); - if ((nBits == WaveFormat.Format.wBitsPerSample) && (nChannels == WaveFormat.Format.nChannels)) + sel = ndx; + } + } + m_CbnSampleRate.SetCurSel(sel); +} + + +void CWaveConvert::FillChannels() +//------------------------------- +{ + m_CbnChannels.CComboBox::ResetContent(); + int sel = 0; + for(int channels = 4; channels >= 1; channels /= 2) + { + if(channels > encTraits->maxChannels) + { + continue; + } + int ndx = m_CbnChannels.AddString(gszChnCfgNames[(channels+2)/2-1]); + m_CbnChannels.SetItemData(ndx, channels); + if(channels == m_Settings.Channels) + { + sel = ndx; + } + } + m_CbnChannels.SetCurSel(sel); +} + + +void CWaveConvert::FillFormats() +//------------------------------ +{ + m_CbnSampleFormat.CComboBox::ResetContent(); + int sel = 0; + DWORD dwSamplerate = m_CbnSampleRate.GetItemData(m_CbnSampleRate.GetCurSel()); + INT nChannels = m_CbnChannels.GetItemData(m_CbnChannels.GetCurSel()); + if(encTraits->modes & Encoder::ModeQuality) + { + for(int quality = 100; quality >= 0; quality -= 10) + { + int ndx = m_CbnSampleFormat.AddString(m_Settings.GetEncoderFactory()->DescribeQuality(quality * 0.01f).c_str()); + m_CbnSampleFormat.SetItemData(ndx, (Encoder::ModeQuality<<24) | (quality<<0)); + if(m_Settings.EncoderSettings.Mode == Encoder::ModeQuality && Util::Round<int>(m_Settings.EncoderSettings.Quality*100.0f) == quality) { - m_CbnSampleFormat.SetCurSel(ndx); + sel = ndx; } } } + if(encTraits->modes & Encoder::ModeVBR) + { + for(int bitrate = encTraits->bitrates.size()-1; bitrate >= 0; --bitrate) + { + int ndx = m_CbnSampleFormat.AddString(mpt::String::Format("VBR %i kbit", encTraits->bitrates[bitrate]).c_str()); + m_CbnSampleFormat.SetItemData(ndx, (Encoder::ModeVBR<<24) | (encTraits->bitrates[bitrate]<<0)); + if(m_Settings.EncoderSettings.Mode == Encoder::ModeVBR && static_cast<int>(m_Settings.EncoderSettings.Bitrate) == encTraits->bitrates[bitrate]) + { + sel = ndx; + } + } + } + if(encTraits->modes & Encoder::ModeABR) + { + for(int bitrate = encTraits->bitrates.size()-1; bitrate >= 0; --bitrate) + { + int ndx = m_CbnSampleFormat.AddString(mpt::String::Format("ABR %i kbit", encTraits->bitrates[bitrate]).c_str()); + m_CbnSampleFormat.SetItemData(ndx, (Encoder::ModeABR<<24) | (encTraits->bitrates[bitrate]<<0)); + if(m_Settings.EncoderSettings.Mode == Encoder::ModeABR && static_cast<int>(m_Settings.EncoderSettings.Bitrate) == encTraits->bitrates[bitrate]) + { + sel = ndx; + } + } + } + if(encTraits->modes & Encoder::ModeCBR) + { + for(int bitrate = encTraits->bitrates.size()-1; bitrate >= 0; --bitrate) + { + int ndx = m_CbnSampleFormat.AddString(mpt::String::Format("CBR %i kbit", encTraits->bitrates[bitrate]).c_str()); + m_CbnSampleFormat.SetItemData(ndx, (Encoder::ModeCBR<<24) | (encTraits->bitrates[bitrate]<<0)); + if(m_Settings.EncoderSettings.Mode == Encoder::ModeCBR && static_cast<int>(m_Settings.EncoderSettings.Bitrate) == encTraits->bitrates[bitrate]) + { + sel = ndx; + } + } + } + if(encTraits->modes & Encoder::ModeEnumerated) + { + for(std::size_t i = 0; i < encTraits->formats.size(); ++i) + { + const Encoder::Format &format = encTraits->formats[i]; + if(format.Samplerate != (int)dwSamplerate || format.Channels != nChannels) + { + continue; + } + if(i > 0xffff) + { + // too may formats + break; + } + int ndx = m_CbnSampleFormat.AddString(format.Description.c_str()); + m_CbnSampleFormat.SetItemData(ndx, i & 0xffff); + if(m_Settings.EncoderSettings.Mode & Encoder::ModeEnumerated && (int)i == encTraits->defaultFormat) + { + sel = ndx; + } else if(m_Settings.EncoderSettings.Mode & Encoder::ModeEnumerated && format.Bitrate > 0 && m_Settings.EncoderSettings.Bitrate == format.Bitrate) + { + sel = ndx; + } + } + } + m_CbnSampleFormat.SetCurSel(sel); +} - UpdateDialog(); - return TRUE; + +void CWaveConvert::OnFileTypeChanged() +//------------------------------------ +{ + DWORD dwFileType = m_CbnFileType.GetItemData(m_CbnFileType.GetCurSel()); + m_Settings.SelectEncoder(dwFileType); + encTraits = m_Settings.GetTraits(); + FillSamplerates(); + FillChannels(); + FillFormats(); + FillTags(); + FillInfo(); } +void CWaveConvert::OnSamplerateChanged() +//-------------------------------------- +{ + //DWORD dwSamplerate = m_CbnSampleRate.GetItemData(m_CbnSampleRate.GetCurSel()); + FillFormats(); +} + + +void CWaveConvert::OnChannelsChanged() +//------------------------------------ +{ + //UINT nChannels = m_CbnChannels.GetItemData(m_CbnChannels.GetCurSel()); + FillFormats(); +} + + void CWaveConvert::OnFormatChanged() //---------------------------------- { - DWORD dwFormat = m_CbnSampleFormat.GetItemData(m_CbnSampleFormat.GetCurSel()); - (void)dwFormat; + //DWORD dwFormat = m_CbnSampleFormat.GetItemData(m_CbnSampleFormat.GetCurSel()); } @@ -328,8 +486,7 @@ m_nMaxOrder = static_cast<ORDERINDEX>(GetDlgItemInt(IDC_EDIT4, NULL, FALSE)); loopCount = static_cast<uint16>(GetDlgItemInt(IDC_EDIT5, NULL, FALSE)); if (m_nMaxOrder < m_nMinOrder) m_bSelectPlay = false; - //m_bHighQuality = IsDlgButtonChecked(IDC_CHECK3) != BST_UNCHECKED; //rewbs.resamplerConf - we don't want this anymore. - m_bNormalize = IsDlgButtonChecked(IDC_CHECK5) != BST_UNCHECKED; + m_Settings.Normalize = IsDlgButtonChecked(IDC_CHECK5) != BST_UNCHECKED; m_bGivePlugsIdleTime = IsDlgButtonChecked(IDC_GIVEPLUGSIDLETIME) != BST_UNCHECKED; if (m_bGivePlugsIdleTime) { @@ -344,295 +501,126 @@ m_bChannelMode = IsDlgButtonChecked(IDC_CHECK4) != BST_UNCHECKED; m_bInstrumentMode= IsDlgButtonChecked(IDC_CHECK6) != BST_UNCHECKED; - // WaveFormatEx + m_Settings.SampleRate = m_CbnSampleRate.GetItemData(m_CbnSampleRate.GetCurSel()); + m_Settings.Channels = (uint16)m_CbnChannels.GetItemData(m_CbnChannels.GetCurSel()); DWORD dwFormat = m_CbnSampleFormat.GetItemData(m_CbnSampleFormat.GetCurSel()); - WaveFormat.Format.wFormatTag = WAVE_FORMAT_PCM; - WaveFormat.Format.nSamplesPerSec = m_CbnSampleRate.GetItemData(m_CbnSampleRate.GetCurSel()); - if (WaveFormat.Format.nSamplesPerSec < 11025) WaveFormat.Format.nSamplesPerSec = 11025; - if (WaveFormat.Format.nSamplesPerSec > 192000) WaveFormat.Format.nSamplesPerSec = 192000; - WaveFormat.Format.nChannels = (WORD)(dwFormat >> 8); - if ((WaveFormat.Format.nChannels != 1) && (WaveFormat.Format.nChannels != 4)) WaveFormat.Format.nChannels = 2; - WaveFormat.Format.wBitsPerSample = (WORD)(dwFormat & 0xFF); - if ((WaveFormat.Format.wBitsPerSample != 8) && (WaveFormat.Format.wBitsPerSample != 24) && (WaveFormat.Format.wBitsPerSample != 32)) WaveFormat.Format.wBitsPerSample = 16; - - WaveFormat.Format.nBlockAlign = (WaveFormat.Format.wBitsPerSample * WaveFormat.Format.nChannels) / 8; - WaveFormat.Format.nAvgBytesPerSec = WaveFormat.Format.nSamplesPerSec * WaveFormat.Format.nBlockAlign; - WaveFormat.Format.cbSize = 0; - // Mono/Stereo 32-bit floating-point - if ((WaveFormat.Format.wBitsPerSample == 32) && (WaveFormat.Format.nChannels <= 2)) + if(encTraits->modes & Encoder::ModeEnumerated) { - WaveFormat.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; + int format = (int)((dwFormat >> 0) & 0xffff); + if(encTraits->formats[format].Sampleformat == SampleFormatInvalid) + { + m_Settings.FinalSampleFormat = SampleFormatFloat32; + } else + { + m_Settings.FinalSampleFormat = encTraits->formats[format].Sampleformat; + } + m_Settings.EncoderSettings.Format = format; + m_Settings.EncoderSettings.Mode = encTraits->defaultMode; + m_Settings.EncoderSettings.Bitrate = encTraits->defaultBitrate; + m_Settings.EncoderSettings.Quality = encTraits->defaultQuality; } else - // MultiChannel configuration - if ((WaveFormat.Format.wBitsPerSample == 32) || (WaveFormat.Format.nChannels > 2)) { - WaveFormat.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; - WaveFormat.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); - WaveFormat.Samples.wValidBitsPerSample = WaveFormat.Format.wBitsPerSample; - switch(WaveFormat.Format.nChannels) - { - case 1: WaveFormat.dwChannelMask = 0x0004; break; // FRONT_CENTER - case 2: WaveFormat.dwChannelMask = 0x0003; break; // FRONT_LEFT | FRONT_RIGHT - case 3: WaveFormat.dwChannelMask = 0x0103; break; // FRONT_LEFT|FRONT_RIGHT|BACK_CENTER - case 4: WaveFormat.dwChannelMask = 0x0033; break; // FRONT_LEFT|FRONT_RIGHT|BACK_LEFT|BACK_RIGHT - default: WaveFormat.dwChannelMask = 0; break; - } - WaveFormat.SubFormat = guid_MEDIASUBTYPE_PCM; + m_Settings.FinalSampleFormat = SampleFormatFloat32; + Encoder::Mode mode = (Encoder::Mode)((dwFormat >> 24) & 0xff); + int quality = (int)((dwFormat >> 0) & 0xff); + int bitrate = (int)((dwFormat >> 0) & 0xffff); + m_Settings.EncoderSettings.Mode = mode; + m_Settings.EncoderSettings.Bitrate = bitrate; + m_Settings.EncoderSettings.Quality = static_cast<float>(quality) * 0.01f; + m_Settings.EncoderSettings.Format = -1; } - CDialog::OnOK(); -} + + { + m_Settings.EncoderSettings.Tags = IsDlgButtonChecked(IDC_CHECK7) ? true : false; -///////////////////////////////////////////////////////////////////////////////////////// -// CLayer3Convert: Converting to MPEG Layer 3 + m_Settings.Tags = FileTags(); -BEGIN_MESSAGE_MAP(CLayer3Convert, CDialog) - ON_COMMAND(IDC_CHECK1, OnCheck1) - ON_COMMAND(IDC_CHECK2, OnCheck2) - ON_CBN_SELCHANGE(IDC_COMBO2, UpdateDialog) -END_MESSAGE_MAP() + if(m_Settings.EncoderSettings.Tags) + { + CString tmp; + m_EditTitle.GetWindowText(tmp); + m_Settings.Tags.title = mpt::String::Decode(tmp.GetString(), mpt::CharsetLocale); -void CLayer3Convert::DoDataExchange(CDataExchange* pDX) -//----------------------------------------------------- -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(COptionsPlayer) - DDX_Control(pDX, IDC_COMBO1, m_CbnFormat); - DDX_Control(pDX, IDC_COMBO2, m_CbnDriver); - DDX_Control(pDX, IDC_COMBO3, m_CbnGenre); - DDX_Control(pDX, IDC_EDIT3, m_EditAuthor); - DDX_Control(pDX, IDC_EDIT4, m_EditURL); - DDX_Control(pDX, IDC_EDIT5, m_EditAlbum); - DDX_Control(pDX, IDC_EDIT6, m_EditYear); - //}}AFX_DATA_MAP -} + m_EditAuthor.GetWindowText(tmp); + m_Settings.Tags.artist = mpt::String::Decode(tmp.GetString(), mpt::CharsetLocale); + m_EditAlbum.GetWindowText(tmp); + m_Settings.Tags.album = mpt::String::Decode(tmp.GetString(), mpt::CharsetLocale); -BOOL CLayer3Convert::OnInitDialog() -//--------------------------------- -{ - ACMFORMATDETAILS afd; - BYTE wfx[256]; - WAVEFORMATEX *pwfx = (WAVEFORMATEX *)&wfx; - - CDialog::OnInitDialog(); - Drivers[0] = 0; - m_bInitialFound = FALSE; - m_bDriversEnumerated = FALSE; - m_nNumFormats = 0; - m_nNumDrivers = 0; - MemsetZero(afd); - MemsetZero(*pwfx); - afd.cbStruct = sizeof(ACMFORMATDETAILS); - afd.dwFormatTag = WAVE_FORMAT_PCM; - afd.pwfx = pwfx; - afd.cbwfx = sizeof(wfx); - pwfx->wFormatTag = WAVE_FORMAT_PCM; - pwfx->nChannels = 2; - pwfx->nSamplesPerSec = 44100; - pwfx->wBitsPerSample = 16; - pwfx->nBlockAlign = (pwfx->nChannels * pwfx->wBitsPerSample) / 8; - pwfx->nAvgBytesPerSec = pwfx->nSamplesPerSec * pwfx->nBlockAlign; - acmConvert.AcmFormatEnum(NULL, &afd, AcmFormatEnumCB, (DWORD)this, ACM_FORMATENUMF_CONVERT); - m_bDriversEnumerated = TRUE; - m_CbnDriver.SetCurSel(m_nDriverIndex); - if (m_bSaveInfoField) CheckDlgButton(IDC_CHECK3, MF_CHECKED); - for(size_t iGnr = 0; iGnr < CountOf(id3v1GenreNames); iGnr++) - { - m_CbnGenre.SetItemData(m_CbnGenre.AddString(id3v1GenreNames[iGnr]), iGnr); - } + m_EditURL.GetWindowText(tmp); + m_Settings.Tags.url = mpt::String::Decode(tmp.GetString(), mpt::CharsetLocale); - m_EditYear.SetLimitText(4); - CTime tTime = CTime::GetCurrentTime(); - m_EditYear.SetWindowText(tTime.Format("%Y")); - UpdateDialog(); - return TRUE; -} + m_CbnGenre.GetWindowText(tmp); + m_Settings.Tags.genre = mpt::String::Decode(tmp.GetString(), mpt::CharsetLocale); + m_EditYear.GetWindowText(tmp); + m_Settings.Tags.year = mpt::String::Decode(tmp.GetString(), mpt::CharsetLocale); + if(m_Settings.Tags.year == L"0") + { + m_Settings.Tags.year = std::wstring(); + } -VOID CLayer3Convert::UpdateDialog() -//--------------------------------- -{ - ACMFORMATDETAILS afd; - BYTE wfx[256]; - WAVEFORMATEX *pwfx = (WAVEFORMATEX *)&wfx; - - m_CbnFormat.ResetContent(); - m_nNumFormats = 0; - m_nFormatIndex = 0; - m_nDriverIndex = m_CbnDriver.GetItemData(m_CbnDriver.GetCurSel()); - m_bInitialFound = FALSE; - if (m_nDriverIndex >= m_nNumDrivers) m_nDriverIndex = 0; - MemsetZero(afd); - MemsetZero(wfx); - afd.cbStruct = sizeof(ACMFORMATDETAILS); - afd.dwFormatTag = WAVE_FORMAT_PCM; - afd.pwfx = pwfx; - afd.cbwfx = sizeof(wfx); - pwfx->wFormatTag = WAVE_FORMAT_PCM; - pwfx->nChannels = 2; - pwfx->nSamplesPerSec = 44100; - pwfx->wBitsPerSample = 16; - pwfx->nBlockAlign = pwfx->nChannels * pwfx->wBitsPerSample / 8; - pwfx->nAvgBytesPerSec = pwfx->nSamplesPerSec * pwfx->nBlockAlign; - acmConvert.AcmFormatEnum(NULL, &afd, AcmFormatEnumCB, (DWORD_PTR)this, ACM_FORMATENUMF_CONVERT); - m_CbnFormat.SetCurSel(m_nFormatIndex); -} + if(!m_pSndFile->songMessage.empty()) + { + m_Settings.Tags.comments = mpt::String::Decode(m_pSndFile->songMessage, mpt::CharsetLocale); + } + m_Settings.Tags.bpm = mpt::String::Decode(mpt::String::Format("%d", (int)m_pSndFile->GetCurrentBPM()), mpt::CharsetLocale); -void CLayer3Convert::GetFormat(PMPEGLAYER3WAVEFORMAT pwfx, HACMDRIVERID *phadid) -//------------------------------------------------------------------------------ -{ - *pwfx = Formats[m_nFormatIndex]; - *phadid = Drivers[m_nDriverIndex]; -} + } + } -BOOL CLayer3Convert::AcmFormatEnumCB(HACMDRIVERID hdid, LPACMFORMATDETAILS pafd, DWORD_PTR dwInstance, DWORD fdwSupport) -//---------------------------------------------------------------------------------------------------------------------- -{ - if (dwInstance) - { - CLayer3Convert *that = ((CLayer3Convert *)dwInstance); - if (that->m_bDriversEnumerated) - return ((CLayer3Convert *)dwInstance)->FormatEnumCB(hdid, pafd, fdwSupport); - else - return ((CLayer3Convert *)dwInstance)->DriverEnumCB(hdid, pafd, fdwSupport); - } - return FALSE; + CDialog::OnOK(); } -BOOL CLayer3Convert::DriverEnumCB(HACMDRIVERID hdid, LPACMFORMATDETAILS pafd, DWORD fdwSupport) -//--------------------------------------------------------------------------------------------- +void CWaveConvertSettings::SelectEncoder(std::size_t index) +//--------------------------------------------------------- { - if ((pafd) && (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) - && (pafd->dwFormatTag == WAVE_FORMAT_MPEGLAYER3) && (m_nNumDrivers < MAX_DRIVERS)) - { - ACMDRIVERDETAILS add; - for (UINT i=0; i<m_nNumDrivers; i++) - { - if (Drivers[i] == hdid) return TRUE; - } - MemsetZero(add); - add.cbStruct = sizeof(add); - if (acmConvert.AcmDriverDetails(hdid, &add, 0L) == MMSYSERR_NOERROR) - { - Drivers[m_nNumDrivers] = hdid; - CHAR *pszName = ((add.szLongName[0]) && (strlen(add.szLongName) < 40)) ? add.szLongName : add.szShortName; - m_CbnDriver.SetItemData( m_CbnDriver.AddString(pszName), m_nNumDrivers); - m_nNumDrivers++; - } - } - return TRUE; + ASSERT(!EncoderFactories.empty()); + ASSERT(index < EncoderFactories.size()); + EncoderIndex = index; + const Encoder::Traits *encTraits = GetTraits(); + EncoderSettings.Mode = encTraits->defaultMode; + EncoderSettings.Bitrate = encTraits->defaultBitrate; + EncoderSettings.Quality = encTraits->defaultQuality; } -BOOL CLayer3Convert::FormatEnumCB(HACMDRIVERID hdid, LPACMFORMATDETAILS pafd, DWORD fdwSupport) -//--------------------------------------------------------------------------------------------- +EncoderFactoryBase *CWaveConvertSettings::GetEncoderFactory() const +//-------------------------------------------------------------- { - if ((pafd) && (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) - && (hdid == Drivers[m_nDriverIndex]) - && (pafd->dwFormatTag == WAVE_FORMAT_MPEGLAYER3) && (pafd->pwfx) - && (pafd->cbwfx >= sizeof(MPEGLAYER3WAVEFORMAT)) - && (pafd->pwfx->wFormatTag == WAVE_FORMAT_MPEGLAYER3) - && (pafd->pwfx->cbSize == sizeof(MPEGLAYER3WAVEFORMAT)-sizeof(WAVEFORMATEX)) - && (pafd->pwfx->nSamplesPerSec >= 11025) - && (pafd->pwfx->nChannels >= 1) - && (pafd->pwfx->nChannels <= 2) - && (m_nNumFormats < MAX_FORMATS)) - { - PMPEGLAYER3WAVEFORMAT pmwf = (PMPEGLAYER3WAVEFORMAT)pafd->pwfx; - Formats[m_nNumFormats] = *pmwf; - if ((!m_bInitialFound) && (pmwf->wfx.nSamplesPerSec == 44100) && (pmwf->wfx.nChannels == 2)) - { - m_nFormatIndex = m_nNumFormats; - m_bInitialFound = TRUE; - } - m_CbnFormat.SetItemData( m_CbnFormat.AddString(pafd->szFormat), m_nNumFormats); - m_nNumFormats++; - } - return (m_nNumFormats < MAX_FORMATS) ? TRUE : FALSE; + ASSERT(!EncoderFactories.empty()); + return EncoderFactories[EncoderIndex]; } -void CLayer3Convert::OnCheck1() -//----------------------------- +const Encoder::Traits *CWaveConvertSettings::GetTraits() const +//------------------------------------------------------------ { - if (IsDlgButtonChecked(IDC_CHECK1)) - { - m_dwFileLimit = GetDlgItemInt(IDC_EDIT1, NULL, FALSE); - if (!m_dwFileLimit) - { - m_dwFileLimit = 1000; - SetDlgItemText(IDC_EDIT1, "1000"); - } - } else m_dwFileLimit = 0; + ASSERT(!EncoderFactories.empty()); + return &EncoderFactories[EncoderIndex]->GetTraits(); } -void CLayer3Convert::OnCheck2() -//----------------------------- +CWaveConvertSettings::CWaveConvertSettings(std::size_t defaultEncoder, const std::vector<EncoderFactoryBase*> &encFactories) +//-------------------------------------------------------------------------------------------------------------------------- + : EncoderFactories(encFactories) + , EncoderIndex(defaultEncoder) + , Normalize(false) + , SampleRate(44100) + , Channels(2) + , FinalSampleFormat(SampleFormatInt16) + , EncoderSettings(true, Encoder::ModeCBR, 256, 0.8f, -1) { - if (IsDlgButtonChecked(IDC_CHECK2)) - { - m_dwSongLimit = GetDlgItemInt(IDC_EDIT2, NULL, FALSE); - if (!m_dwSongLimit) - { - m_dwSongLimit = 600; - SetDlgItemText(IDC_EDIT2, "600"); - } - } else m_dwSongLimit = 0; + SelectEncoder(EncoderIndex); } -void CLayer3Convert::OnOK() -//------------------------- -{ - CHAR sText[256] = ""; - - if (m_dwFileLimit) m_dwFileLimit = GetDlgItemInt(IDC_EDIT1, NULL, FALSE); - if (m_dwSongLimit) m_dwSongLimit = GetDlgItemInt(IDC_EDIT2, NULL, FALSE); - m_nFormatIndex = m_CbnFormat.GetItemData(m_CbnFormat.GetCurSel()); - m_nDriverIndex = m_CbnDriver.GetItemData(m_CbnDriver.GetCurSel()); - m_bSaveInfoField = IsDlgButtonChecked(IDC_CHECK3); - - m_FileTags.title = m_pSndFile->GetTitle(); - - m_EditAuthor.GetWindowText(sText, sizeof(sText)); - m_FileTags.artist = sText; - - m_EditURL.GetWindowText(sText, sizeof(sText)); - m_FileTags.url = sText; - - m_EditAlbum.GetWindowText(sText, sizeof(sText)); - m_FileTags.album = sText; - - m_EditYear.GetWindowText(sText, MIN(5, sizeof(sText))); - m_FileTags.year = sText; - if(m_FileTags.year == "0") - m_FileTags.year = ""; - - m_CbnGenre.GetWindowText(sText, sizeof(sText)); - m_FileTags.genre = sText; - - if(!m_pSndFile->songMessage.empty()) - { - m_FileTags.comments = m_pSndFile->songMessage.GetFormatted(SongMessage::leLF); - } - else - { - m_FileTags.comments = ""; - } - - wsprintf(sText, "%d", (int)m_pSndFile->GetCurrentBPM()); - m_FileTags.bpm = sText; - - CDialog::OnOK(); -} - ///////////////////////////////////////////////////////////////////////////////////////// // CDoWaveConvert: save a mod as a wave file @@ -650,15 +638,13 @@ } -#define WAVECONVERTBUFSIZE MIXBUFFERSIZE //Going over MIXBUFFERSIZE can kill VSTPlugs - - void CDoWaveConvert::OnButton1() //------------------------------ { static char buffer[MIXBUFFERSIZE * 4 * 4]; // channels * sizeof(biggestsample) static float floatbuffer[MIXBUFFERSIZE ... [truncated message content] |
From: <man...@us...> - 2013-09-14 16:25:11
|
Revision: 2706 http://sourceforge.net/p/modplug/code/2706 Author: manxorist Date: 2013-09-14 16:24:56 +0000 (Sat, 14 Sep 2013) Log Message: ----------- [Fix] sounddev: Fix deadlock when using WDM-KS with low latencies on some drivers (via portaudio update). [Fix] sounddev: Fix stratup crash on wine (via portaudio update). Merged revision(s) 2694-2705 from branches/manx/portaudio: [Var] Update portaudio to version svn-r1910 as of 2013-09-09. [Var] portaudio: Improve documentation of local portaudio modifications. [Fix] VS2008 projects need ksguid.lib and ksuser.lib . [Fix] sounddev: Portaudio encodes device names in UTF8 now, convert them accordingly. ........ Revision Links: -------------- http://sourceforge.net/p/modplug/code/1910 Modified Paths: -------------- trunk/OpenMPT/include/portaudio/CMakeLists.txt trunk/OpenMPT/include/portaudio/Doxyfile trunk/OpenMPT/include/portaudio/Doxyfile.developer trunk/OpenMPT/include/portaudio/OpenMPT.txt trunk/OpenMPT/include/portaudio/build/msvc/portaudio.def trunk/OpenMPT/include/portaudio/cmake_support/options_cmake.h.in trunk/OpenMPT/include/portaudio/configure trunk/OpenMPT/include/portaudio/configure.in trunk/OpenMPT/include/portaudio/doc/src/mainpage.dox trunk/OpenMPT/include/portaudio/examples/pa_devs.c trunk/OpenMPT/include/portaudio/examples/paex_write_sine.c trunk/OpenMPT/include/portaudio/include/pa_mac_core.h trunk/OpenMPT/include/portaudio/include/pa_win_ds.h trunk/OpenMPT/include/portaudio/include/portaudio.h trunk/OpenMPT/include/portaudio/pablio/README.txt trunk/OpenMPT/include/portaudio/pablio/pablio.h trunk/OpenMPT/include/portaudio/portaudio.vcproj trunk/OpenMPT/include/portaudio/portaudio.vcxproj trunk/OpenMPT/include/portaudio/portaudio.vcxproj.filters trunk/OpenMPT/include/portaudio/qa/loopback/README.txt trunk/OpenMPT/include/portaudio/qa/loopback/src/audio_analyzer.c trunk/OpenMPT/include/portaudio/qa/loopback/src/paqa.c trunk/OpenMPT/include/portaudio/qa/paqa_latency.c trunk/OpenMPT/include/portaudio/src/common/pa_front.c trunk/OpenMPT/include/portaudio/src/common/pa_hostapi.h trunk/OpenMPT/include/portaudio/src/common/pa_process.c trunk/OpenMPT/include/portaudio/src/common/pa_ringbuffer.h trunk/OpenMPT/include/portaudio/src/common/pa_trace.c trunk/OpenMPT/include/portaudio/src/common/pa_trace.h trunk/OpenMPT/include/portaudio/src/hostapi/alsa/pa_linux_alsa.c trunk/OpenMPT/include/portaudio/src/hostapi/asio/pa_asio.cpp trunk/OpenMPT/include/portaudio/src/hostapi/coreaudio/pa_mac_core.c trunk/OpenMPT/include/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c trunk/OpenMPT/include/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h trunk/OpenMPT/include/portaudio/src/hostapi/dsound/pa_win_ds.c trunk/OpenMPT/include/portaudio/src/hostapi/oss/pa_unix_oss.c trunk/OpenMPT/include/portaudio/src/hostapi/wasapi/mingw-include/ksmedia.h trunk/OpenMPT/include/portaudio/src/hostapi/wasapi/pa_win_wasapi.c trunk/OpenMPT/include/portaudio/src/hostapi/wdmks/pa_win_wdmks.c trunk/OpenMPT/include/portaudio/src/hostapi/wdmks/readme.txt trunk/OpenMPT/include/portaudio/src/hostapi/wmme/pa_win_wmme.c trunk/OpenMPT/include/portaudio/src/os/win/pa_win_waveformat.c trunk/OpenMPT/include/portaudio/src/os/win/pa_win_wdmks_utils.c trunk/OpenMPT/include/portaudio/src/os/win/pa_x86_plain_converters.c trunk/OpenMPT/include/portaudio/test/patest_wire.c trunk/OpenMPT/include/portaudio/testcvs/changeme.txt trunk/OpenMPT/include/premake4.lua trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp Added Paths: ----------- trunk/OpenMPT/include/portaudio/bindings/java/ trunk/OpenMPT/include/portaudio/doc/src/tutorial/ trunk/OpenMPT/include/portaudio/examples/CMakeLists.txt trunk/OpenMPT/include/portaudio/examples/paex_ocean_shore.c trunk/OpenMPT/include/portaudio/examples/paex_record_file.c trunk/OpenMPT/include/portaudio/examples/paex_sine_c++.cpp trunk/OpenMPT/include/portaudio/include/pa_win_wdmks.h trunk/OpenMPT/include/portaudio/test/CMakeLists.txt trunk/OpenMPT/include/portaudio/test/patest_dsound_find_best_latency_params.c trunk/OpenMPT/include/portaudio/test/patest_dsound_low_level_latency_params.c Property Changed: ---------------- trunk/OpenMPT/ trunk/OpenMPT/include/portaudio/bindings/java/c/ trunk/OpenMPT/include/portaudio/bindings/java/c/build/ trunk/OpenMPT/include/portaudio/bindings/java/c/build/vs2010/ trunk/OpenMPT/include/portaudio/bindings/java/c/build/vs2010/PortAudioJNI/ trunk/OpenMPT/include/portaudio/bindings/java/c/src/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/jtests/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/jtests/com/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/jtests/com/portaudio/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/src/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/src/com/ trunk/OpenMPT/include/portaudio/bindings/java/jportaudio/src/com/portaudio/ trunk/OpenMPT/include/portaudio/bindings/java/scripts/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT 2013-09-14 16:24:56 UTC (rev 2706) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -6,6 +6,7 ## /branches/manx/lossy-export-xiph:2663,2677,2680 /branches/manx/mptstring-stdstring-support:2204,2208,2212,2214,2217,2220,2224,2259,2261-2262,2264,2267 /branches/manx/nonglobal-mixer:1715-1841 +/branches/manx/portaudio:2694-2705 /branches/manx/premake:2606,2609-2610,2614,2616,2621,2624,2641 /branches/manx/profiler:1813 /branches/manx/project-files-cleanups:1378-1382 \ No newline at end of property Modified: trunk/OpenMPT/include/portaudio/CMakeLists.txt =================================================================== --- trunk/OpenMPT/include/portaudio/CMakeLists.txt 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/CMakeLists.txt 2013-09-14 16:24:56 UTC (rev 2706) @@ -7,17 +7,27 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF) IF(CMAKE_CL_64) SET(TARGET_POSTFIX x64) +IF(PA_CONFIG_LIB_OUTPUT_PATH) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/x64) +ENDIF(PA_CONFIG_LIB_OUTPUT_PATH) ELSE(CMAKE_CL_64) SET(TARGET_POSTFIX x86) +IF(PA_CONFIG_LIB_OUTPUT_PATH) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32) +ENDIF(PA_CONFIG_LIB_OUTPUT_PATH) ENDIF(CMAKE_CL_64) +OPTION(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF) +IF(PA_ENABLE_DEBUG_OUTPUT) +ADD_DEFINITIONS(-DPA_ENABLE_DEBUG_OUTPUT) +ENDIF(PA_ENABLE_DEBUG_OUTPUT) + IF(WIN32 AND MSVC) -OPTION(PORTAUDIO_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON) -IF(PORTAUDIO_DLL_LINK_WITH_STATIC_RUNTIME) +OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON) +IF(PA_DLL_LINK_WITH_STATIC_RUNTIME) FOREACH(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO @@ -27,12 +37,12 @@ STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") ENDIF(${flag_var} MATCHES "/MD") ENDFOREACH(flag_var) -ENDIF(PORTAUDIO_DLL_LINK_WITH_STATIC_RUNTIME) +ENDIF(PA_DLL_LINK_WITH_STATIC_RUNTIME) ENDIF(WIN32 AND MSVC) IF(WIN32) -OPTION(PORTAUDIO_UNICODE_BUILD "Enable Portaudio Unicode build" ON) +OPTION(PA_UNICODE_BUILD "Enable Portaudio Unicode build" ON) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_support) # Try to find DirectX SDK @@ -42,67 +52,57 @@ FIND_PACKAGE(ASIOSDK) IF(ASIOSDK_FOUND) -OPTION(PORTAUDIO_ENABLE_ASIO "Enable support for ASIO" ON) +OPTION(PA_USE_ASIO "Enable support for ASIO" ON) ELSE(ASIOSDK_FOUND) -OPTION(PORTAUDIO_ENABLE_ASIO "Enable support for ASIO" OFF) +OPTION(PA_USE_ASIO "Enable support for ASIO" OFF) ENDIF(ASIOSDK_FOUND) IF(DXSDK_FOUND) -OPTION(PORTAUDIO_ENABLE_DSOUND "Enable support for DirectSound" ON) +OPTION(PA_USE_DS "Enable support for DirectSound" ON) ELSE(DXSDK_FOUND) -OPTION(PORTAUDIO_ENABLE_DSOUND "Enable support for DirectSound" OFF) +OPTION(PA_USE_DS "Enable support for DirectSound" OFF) ENDIF(DXSDK_FOUND) -OPTION(PORTAUDIO_ENABLE_WMME "Enable support for MME" ON) -OPTION(PORTAUDIO_ENABLE_WASAPI "Enable support for WASAPI" ON) -OPTION(PORTAUDIO_ENABLE_WDMKS "Enable support for WDMKS" ON) -OPTION(PORTAUDIO_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON) -MARK_AS_ADVANCED(PORTAUDIO_USE_WDMKS_DEVICE_INFO) -IF(PORTAUDIO_ENABLE_DSOUND) -OPTION(PORTAUDIO_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON) -MARK_AS_ADVANCED(PORTAUDIO_USE_DIRECTSOUNDFULLDUPLEXCREATE) -ENDIF(PORTAUDIO_ENABLE_DSOUND) +OPTION(PA_USE_WMME "Enable support for MME" ON) +OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON) +OPTION(PA_USE_WDMKS "Enable support for WDMKS" ON) +OPTION(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON) +MARK_AS_ADVANCED(PA_USE_WDMKS_DEVICE_INFO) +IF(PA_USE_DS) +OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON) +MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE) +ENDIF(PA_USE_DS) ENDIF(WIN32) -MACRO(SET_HEADER_OPTION OPTION_NAME OPTION_VALUE) - IF(${OPTION_NAME}) - SET(${OPTION_VALUE} "1") - ELSE(${OPTION_NAME}) - SET(${OPTION_VALUE} "0") - ENDIF(${OPTION_NAME}) -ENDMACRO(SET_HEADER_OPTION) - -SET_HEADER_OPTION(PORTAUDIO_ENABLE_ASIO PA_ENABLE_ASIO) -SET_HEADER_OPTION(PORTAUDIO_ENABLE_DSOUND PA_ENABLE_DSOUND) -SET_HEADER_OPTION(PORTAUDIO_ENABLE_WMME PA_ENABLE_WMME) -SET_HEADER_OPTION(PORTAUDIO_ENABLE_WASAPI PA_ENABLE_WASAPI) -SET_HEADER_OPTION(PORTAUDIO_ENABLE_WDMKS PA_ENABLE_WDMKS) - # Set variables for DEF file expansion -IF(NOT PORTAUDIO_ENABLE_ASIO) +IF(NOT PA_USE_ASIO) SET(DEF_EXCLUDE_ASIO_SYMBOLS ";") -ENDIF(NOT PORTAUDIO_ENABLE_ASIO) +ENDIF(NOT PA_USE_ASIO) -IF(NOT PORTAUDIO_ENABLE_WASAPI) +IF(NOT PA_USE_WASAPI) SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";") -ENDIF(NOT PORTAUDIO_ENABLE_WASAPI) +ENDIF(NOT PA_USE_WASAPI) -IF(PORTAUDIO_USE_WDMKS_DEVICE_INFO) +IF(PA_USE_WDMKS_DEVICE_INFO) ADD_DEFINITIONS(-DPAWIN_USE_WDMKS_DEVICE_INFO) -ENDIF(PORTAUDIO_USE_WDMKS_DEVICE_INFO) +ENDIF(PA_USE_WDMKS_DEVICE_INFO) -IF(PORTAUDIO_USE_DIRECTSOUNDFULLDUPLEXCREATE) +IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE) ADD_DEFINITIONS(-DPAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE) -ENDIF(PORTAUDIO_USE_DIRECTSOUNDFULLDUPLEXCREATE) +ENDIF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE) ####################################### IF(WIN32) INCLUDE_DIRECTORIES(src/os/win) ENDIF(WIN32) -IF(PORTAUDIO_ENABLE_ASIO) +IF(PA_USE_ASIO) INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/common) INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host) INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host/pc) +SET(PA_ASIO_INCLUDES + include/pa_asio.h +) + SET(PA_ASIO_SOURCES src/hostapi/asio/pa_asio.cpp ) @@ -120,13 +120,14 @@ SOURCE_GROUP("hostapi\\ASIO\\ASIOSDK" FILES ${PA_ASIOSDK_SOURCES} ) -ENDIF(PORTAUDIO_ENABLE_ASIO) +ENDIF(PA_USE_ASIO) -IF(PORTAUDIO_ENABLE_DSOUND) +IF(PA_USE_DS) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(src/os/win) SET(PA_DS_INCLUDES + include/pa_win_ds.h src/hostapi/dsound/pa_win_ds_dynlink.h ) @@ -139,9 +140,14 @@ ${PA_DS_INCLUDES} ${PA_DS_SOURCES} ) -ENDIF(PORTAUDIO_ENABLE_DSOUND) +ENDIF(PA_USE_DS) -IF(PORTAUDIO_ENABLE_WMME) +IF(PA_USE_WMME) + +SET(PA_WMME_INCLUDES + include/pa_win_wmme.h +) + SET(PA_WMME_SOURCES src/hostapi/wmme/pa_win_wmme.c ) @@ -149,9 +155,14 @@ SOURCE_GROUP("hostapi\\wmme" FILES ${PA_WMME_SOURCES} ) -ENDIF(PORTAUDIO_ENABLE_WMME) +ENDIF(PA_USE_WMME) -IF(PORTAUDIO_ENABLE_WASAPI) +IF(PA_USE_WASAPI) + +SET(PA_WASAPI_INCLUDES + include/pa_win_wasapi.h +) + SET(PA_WASAPI_SOURCES src/hostapi/wasapi/pa_win_wasapi.c ) @@ -159,9 +170,14 @@ SOURCE_GROUP("hostapi\\wasapi" FILES ${PA_WASAPI_SOURCES} ) -ENDIF(PORTAUDIO_ENABLE_WASAPI) +ENDIF(PA_USE_WASAPI) -IF(PORTAUDIO_ENABLE_WDMKS) +IF(PA_USE_WDMKS) + +SET(PA_WDMKS_INCLUDES + include/pa_win_wdmks.h +) + SET(PA_WDMKS_SOURCES src/hostapi/wdmks/pa_win_wdmks.c ) @@ -169,7 +185,7 @@ SOURCE_GROUP("hostapi\\wdmks" FILES ${PA_WDMKS_SOURCES} ) -ENDIF(PORTAUDIO_ENABLE_WDMKS) +ENDIF(PA_USE_WDMKS) SET(PA_SKELETON_SOURCES src/hostapi/skeleton/pa_hostapi_skeleton.c @@ -182,10 +198,11 @@ IF(WIN32) SET(PA_INCLUDES include/portaudio.h - include/pa_asio.h - include/pa_win_ds.h - include/pa_win_wasapi.h - include/pa_win_wmme.h + ${PA_ASIO_INCLUDES} + ${PA_DS_INCLUDES} + ${PA_WMME_INCLUDES} + ${PA_WASAPI_INCLUDES} + ${PA_WDMKS_INCLUDES} ) ENDIF(WIN32) @@ -269,13 +286,13 @@ ${PA_PLATFORM_SOURCES} ) -IF(PORTAUDIO_UNICODE_BUILD) +IF(PA_UNICODE_BUILD) SET_SOURCE_FILES_PROPERTIES( ${SOURCES_LESS_ASIO_SDK} PROPERTIES COMPILE_DEFINITIONS "UNICODE;_UNICODE" ) -ENDIF(PORTAUDIO_UNICODE_BUILD) +ENDIF(PA_UNICODE_BUILD) ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} @@ -302,26 +319,31 @@ IF(WIN32) # If we use DirectSound, we need this for the library to be found (if not in VS project settings) -IF(PORTAUDIO_ENABLE_DSOUND AND DXSDK_FOUND) +IF(PA_USE_DS AND DXSDK_FOUND) TARGET_LINK_LIBRARIES(portaudio ${DXSDK_DSOUND_LIBRARY}) -ENDIF(PORTAUDIO_ENABLE_DSOUND AND DXSDK_FOUND) +ENDIF(PA_USE_DS AND DXSDK_FOUND) # If we use WDM/KS we need setupapi.lib -IF(PORTAUDIO_ENABLE_WDMKS) +IF(PA_USE_WDMKS) TARGET_LINK_LIBRARIES(portaudio setupapi) -ENDIF(PORTAUDIO_ENABLE_WDMKS) +ENDIF(PA_USE_WDMKS) SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX}) SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX}) ENDIF(WIN32) -OPTION(PORTAUDIO_BUILD_TESTS "Include test projects" OFF) -MARK_AS_ADVANCED(PORTAUDIO_BUILD_TESTS) +OPTION(PA_BUILD_TESTS "Include test projects" OFF) +OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF) # Prepared for inclusion of test files -IF(PORTAUDIO_BUILD_TESTS) +IF(PA_BUILD_TESTS) SUBDIRS(test) -ENDIF(PORTAUDIO_BUILD_TESTS) +ENDIF(PA_BUILD_TESTS) +# Prepared for inclusion of test files +IF(PA_BUILD_EXAMPLES) +SUBDIRS(examples) +ENDIF(PA_BUILD_EXAMPLES) + ################################# Modified: trunk/OpenMPT/include/portaudio/Doxyfile =================================================================== --- trunk/OpenMPT/include/portaudio/Doxyfile 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/Doxyfile 2013-09-14 16:24:56 UTC (rev 2706) @@ -84,10 +84,12 @@ #--------------------------------------------------------------------------- INPUT = doc/src \ include \ + bindings/java \ examples FILE_PATTERNS = *.h \ *.c \ *.cpp \ + *.java \ *.dox RECURSIVE = YES EXCLUDE = src/hostapi/wasapi/mingw-include Modified: trunk/OpenMPT/include/portaudio/Doxyfile.developer =================================================================== --- trunk/OpenMPT/include/portaudio/Doxyfile.developer 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/Doxyfile.developer 2013-09-14 16:24:56 UTC (rev 2706) @@ -84,6 +84,7 @@ #--------------------------------------------------------------------------- INPUT = doc/src \ include \ + bindings/java \ examples \ src \ test \ @@ -91,6 +92,7 @@ FILE_PATTERNS = *.h \ *.c \ *.cpp \ + *.java \ *.dox RECURSIVE = YES EXCLUDE = src/hostapi/wasapi/mingw-include Modified: trunk/OpenMPT/include/portaudio/OpenMPT.txt =================================================================== --- trunk/OpenMPT/include/portaudio/OpenMPT.txt 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/OpenMPT.txt 2013-09-14 16:24:56 UTC (rev 2706) @@ -1,2 +1,5 @@ -For building, premake4 is used to generate Visual Studio project files. -See ../premake4.lua for details. + - Portaudio version svn-r1910 as of 2013-09-07. + - A small modification to portaudio code has been made in src/hostapi/wdmks/pa_win_wdmks.c + to facilitate linking against strmiids.lib . Look for "OpenMPT" there. + - For building, premake4 is used to generate Visual Studio project files. + See ../premake4.lua for details. Index: trunk/OpenMPT/include/portaudio/bindings/java =================================================================== --- branches/manx/portaudio/include/portaudio/bindings/java 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/bindings/java 2013-09-14 16:24:56 UTC (rev 2706) Property changes on: trunk/OpenMPT/include/portaudio/bindings/java ___________________________________________________________________ Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Modified: trunk/OpenMPT/include/portaudio/build/msvc/portaudio.def =================================================================== --- trunk/OpenMPT/include/portaudio/build/msvc/portaudio.def 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/build/msvc/portaudio.def 2013-09-14 16:24:56 UTC (rev 2706) @@ -35,11 +35,11 @@ Pa_GetStreamWriteAvailable @32 Pa_GetSampleSize @33 Pa_Sleep @34 -;PaAsio_GetAvailableBufferSizes @50 -;PaAsio_ShowControlPanel @51 +PaAsio_GetAvailableBufferSizes @50 +PaAsio_ShowControlPanel @51 PaUtil_InitializeX86PlainConverters @52 -;PaAsio_GetInputChannelName @53 -;PaAsio_GetOutputChannelName @54 +PaAsio_GetInputChannelName @53 +PaAsio_GetOutputChannelName @54 PaUtil_SetDebugPrintFunction @55 PaWasapi_GetDeviceDefaultFormat @56 PaWasapi_GetDeviceRole @57 Modified: trunk/OpenMPT/include/portaudio/cmake_support/options_cmake.h.in =================================================================== --- trunk/OpenMPT/include/portaudio/cmake_support/options_cmake.h.in 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/cmake_support/options_cmake.h.in 2013-09-14 16:24:56 UTC (rev 2706) @@ -21,11 +21,11 @@ #error "This header needs to be included before pa_hostapi.h!!" #endif -#define PA_USE_ASIO @PA_ENABLE_ASIO@ -#define PA_USE_DS @PA_ENABLE_DSOUND@ -#define PA_USE_WMME @PA_ENABLE_WMME@ -#define PA_USE_WASAPI @PA_ENABLE_WASAPI@ -#define PA_USE_WDMKS @PA_ENABLE_WDMKS@ +#cmakedefine01 PA_USE_ASIO +#cmakedefine01 PA_USE_DS +#cmakedefine01 PA_USE_WMME +#cmakedefine01 PA_USE_WASAPI +#cmakedefine01 PA_USE_WDMKS #else #error "Platform currently not supported by CMake script" #endif Modified: trunk/OpenMPT/include/portaudio/configure =================================================================== --- trunk/OpenMPT/include/portaudio/configure 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/configure 2013-09-14 16:24:56 UTC (rev 2706) @@ -15769,23 +15769,61 @@ LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" if test "x$enable_mac_universal" = "xyes" ; then - if [ -d /Developer/SDKs/MacOSX10.5.sdk ] ; then - mac_version_min="-mmacosx-version-min=10.3" - mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk" - elif [ -d /Developer/SDKs/MacOSX10.6.sdk ] ; then - mac_version_min="-mmacosx-version-min=10.4" - mac_arches="-arch i386 -arch x86_64" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.6.sdk" - elif [ -d /Developer/SDKs/MacOSX10.7.sdk ] ; then - mac_version_min="-mmacosx-version-min=10.4" - mac_arches="-arch i386 -arch x86_64" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.7.sdk" - else - mac_version_min="-mmacosx-version-min=10.3" - mac_arches="-arch i386 -arch ppc" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" - fi + case "xcodebuild -version | sed -n 's/Xcode \(.*\)/\1/p'" in + + 12*|3.0|3.1) + if [ -d /Developer/SDKs/MacOSX10.5.sdk ] ; then + mac_version_min="-mmacosx-version-min=10.3" + mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk" + else + mac_version_min="-mmacosx-version-min=10.3" + mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" + fi + ;; + + *) + if xcodebuild -version -sdk macosx10.5 Path >/dev/null 2>&1 ; then + mac_version_min="-mmacosx-version-min=10.3" + mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.5 Path`" + elif xcodebuild -version -sdk macosx10.6 Path >/dev/null 2>&1 ; then + mac_version_min="-mmacosx-version-min=10.4" + mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.6 Path`" + elif xcodebuild -version -sdk macosx10.7 Path >/dev/null 2>&1 ; then + mac_version_min="-mmacosx-version-min=10.4" + mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.7 Path`" + else + as_fn_error $? "Couldn't find 10.5, 10.6, or 10.7 SDK" "$LINENO" 5 + fi + esac + + mac_arches="" + for arch in i386 x86_64 ppc ppc64 + do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -arch $arch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + if [ -z "$mac_arches" ] ; then + mac_arches="-arch $arch" + else + mac_arches="$mac_arches -arch $arch" + fi + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + done else mac_arches="" mac_sysroot="" @@ -15807,7 +15845,7 @@ if [ "x$with_directx" = "xyes" ]; then DXDIR="$with_dxdir" add_objects src/hostapi/dsound/pa_win_ds.o src/hostapi/dsound/pa_win_ds_dynlink.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o - LIBS="-lwinmm -lm -ldsound -lole32" + LIBS="${LIBS} -lwinmm -lm -ldsound -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" @@ -15817,7 +15855,7 @@ if [ "x$with_asio" = "xyes" ]; then ASIODIR="$with_asiodir" add_objects src/hostapi/asio/pa_asio.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o - LIBS="-lwinmm -lm -lole32 -luuid" + LIBS="${LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid" CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -UPA_USE_ASIO -DPA_USE_ASIO=1 -DWINDOWS" @@ -15828,8 +15866,8 @@ if [ "x$with_wdmks" = "xyes" ]; then DXDIR="$with_dxdir" - add_objects src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o - LIBS="-lwinmm -lm -luuid -lsetupapi -lole32" + add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o + LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" @@ -15838,14 +15876,14 @@ if [ "x$with_wmme" = "xyes" ]; then add_objects src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o - LIBS="-lwinmm -lm -lole32 -luuid" + LIBS="${LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm" CFLAGS="$CFLAGS -UPA_USE_WMME -DPA_USE_WMME=1" fi if [ "x$with_wasapi" = "xyes" ]; then add_objects src/hostapi/wasapi/pa_win_wasapi.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o - LIBS="-lwinmm -lm -lole32 -luuid" + LIBS="${LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm -lole32" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1" fi Modified: trunk/OpenMPT/include/portaudio/configure.in =================================================================== --- trunk/OpenMPT/include/portaudio/configure.in 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/configure.in 2013-09-14 16:24:56 UTC (rev 2706) @@ -208,23 +208,63 @@ LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" if test "x$enable_mac_universal" = "xyes" ; then - if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then - mac_version_min="-mmacosx-version-min=10.3" - mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk" - elif [[ -d /Developer/SDKs/MacOSX10.6.sdk ]] ; then - mac_version_min="-mmacosx-version-min=10.4" - mac_arches="-arch i386 -arch x86_64" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.6.sdk" - elif [[ -d /Developer/SDKs/MacOSX10.7.sdk ]] ; then - mac_version_min="-mmacosx-version-min=10.4" - mac_arches="-arch i386 -arch x86_64" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.7.sdk" - else - mac_version_min="-mmacosx-version-min=10.3" - mac_arches="-arch i386 -arch ppc" - mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" - fi + case `xcodebuild -version | sed -n 's/Xcode \(.*\)/\1/p'` in + + [12]*|3.0|3.1) + dnl In pre-3.2 versions of Xcode, xcodebuild doesn't + dnl support -sdk, so we can't use that to look for + dnl SDKs. However, in those versions of Xcode, the + dnl SDKs are under /Developer/SDKs, so we can just look + dnl there. Also, we assume they had no SDKs later + dnl than 10.5, as 3.2 was the version that came with + dnl 10.6, at least if the Wikipedia page for Xcode + dnl is to be believed. + if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then + mac_version_min="-mmacosx-version-min=10.3" + mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk" + else + mac_version_min="-mmacosx-version-min=10.3" + mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" + fi + ;; + + *) + dnl In 3.2 and later, xcodebuild supports -sdk, and, in + dnl 4.3 and later, the SDKs aren't under /Developer/SDKs + dnl as there *is* no /Developer, so we use -sdk to check + dnl what SDKs are available and to get the full path of + dnl the SDKs. + if xcodebuild -version -sdk macosx10.5 Path >/dev/null 2>&1 ; then + mac_version_min="-mmacosx-version-min=10.3" + mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.5 Path`" + elif xcodebuild -version -sdk macosx10.6 Path >/dev/null 2>&1 ; then + mac_version_min="-mmacosx-version-min=10.4" + mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.6 Path`" + elif xcodebuild -version -sdk macosx10.7 Path >/dev/null 2>&1 ; then + mac_version_min="-mmacosx-version-min=10.4" + mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.7 Path`" + else + AC_MSG_ERROR([Couldn't find 10.5, 10.6, or 10.7 SDK]) + fi + esac + + dnl Pick which architectures to build for based on what + dnl the compiler supports. + mac_arches="" + for arch in i386 x86_64 ppc ppc64 + do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -arch $arch" + AC_TRY_COMPILE([], [return 0;], + [ + if [[ -z "$mac_arches" ]] ; then + mac_arches="-arch $arch" + else + mac_arches="$mac_arches -arch $arch" + fi + ]) + CFLAGS="$save_CFLAGS" + done else mac_arches="" mac_sysroot="" @@ -247,7 +287,7 @@ if [[ "x$with_directx" = "xyes" ]]; then DXDIR="$with_dxdir" add_objects src/hostapi/dsound/pa_win_ds.o src/hostapi/dsound/pa_win_ds_dynlink.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o - LIBS="-lwinmm -lm -ldsound -lole32" + LIBS="${LIBS} -lwinmm -lm -ldsound -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" @@ -257,7 +297,7 @@ if [[ "x$with_asio" = "xyes" ]]; then ASIODIR="$with_asiodir" add_objects src/hostapi/asio/pa_asio.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o - LIBS="-lwinmm -lm -lole32 -luuid" + LIBS="${LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid" CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -UPA_USE_ASIO -DPA_USE_ASIO=1 -DWINDOWS" @@ -272,8 +312,8 @@ if [[ "x$with_wdmks" = "xyes" ]]; then DXDIR="$with_dxdir" - add_objects src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o - LIBS="-lwinmm -lm -luuid -lsetupapi -lole32" + add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o + LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32" DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" @@ -282,14 +322,14 @@ if [[ "x$with_wmme" = "xyes" ]]; then add_objects src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o - LIBS="-lwinmm -lm -lole32 -luuid" + LIBS="${LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm" CFLAGS="$CFLAGS -UPA_USE_WMME -DPA_USE_WMME=1" fi if [[ "x$with_wasapi" = "xyes" ]]; then add_objects src/hostapi/wasapi/pa_win_wasapi.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o - LIBS="-lwinmm -lm -lole32 -luuid" + LIBS="${LIBS} -lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm -lole32" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1" fi Modified: trunk/OpenMPT/include/portaudio/doc/src/mainpage.dox =================================================================== --- trunk/OpenMPT/include/portaudio/doc/src/mainpage.dox 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/doc/src/mainpage.dox 2013-09-14 16:24:56 UTC (rev 2706) @@ -3,15 +3,15 @@ @section overview Overview -PortAudio is a cross-platform, open-source C language library for real-time audio input and output. The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including C++, C#, Python, PureBasic, FreePascal and Lazarus. +PortAudio is a cross-platform, open-source C language library for real-time audio input and output. +The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including @ref java_binding "Java", C++, C#, Python, PureBasic, FreePascal and Lazarus. - @section start_here Start here - @ref api_overview<br> A top-down view of the PortAudio API, its capabilities, functions and data structures -- <a href="http://www.portaudio.com/trac/wiki/TutorialDir/TutorialStart">PortAudio Tutorials</a><br> +- @ref tutorial_start<br> Get started writing code with PortAudio tutorials - @ref examples_src "Examples"<br> @@ -36,8 +36,10 @@ - <a href="http://music.columbia.edu/mailman/listinfo/portaudio/">Our mailing list for users and developers</a><br> -- <a href="http://www.portaudio.com/trac">The PortAudio wiki</a> +- <a href="http://www.assembla.com/spaces/portaudio/wiki">The PortAudio wiki</a> +- @ref java_binding<br> +Documentation for the Java JNI interface to PortAudio @section developer_resources Developer Resources @@ -45,11 +47,11 @@ - @ref srcguide @endif -- <a href="http://www.portaudio.com/trac">Our Trac wiki and issue tracking system</a> +- <a href="http://www.assembla.com/spaces/portaudio/wiki">Our wiki and issue tracking system</a> - <a href="http://www.portaudio.com/docs/proposals/014-StyleGuide.html">Coding guidelines</a> -If you're interested in helping out with PortAudio development we're more than happy for you to be involved. Just drop by the PortAudio mailing list and ask how you can help. Or <a href="http://www.portaudio.com/trac/report/3">check out the starter tickets in Trac</a>. +If you're interested in helping out with PortAudio development we're more than happy for you to be involved. Just drop by the PortAudio mailing list and ask how you can help. Or <a href="http://www.assembla.com/spaces/portaudio/tickets">check out the starter tickets</a>. @section older_api_versions Older API Versions Index: trunk/OpenMPT/include/portaudio/doc/src/tutorial =================================================================== --- branches/manx/portaudio/include/portaudio/doc/src/tutorial 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/doc/src/tutorial 2013-09-14 16:24:56 UTC (rev 2706) Property changes on: trunk/OpenMPT/include/portaudio/doc/src/tutorial ___________________________________________________________________ Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Copied: trunk/OpenMPT/include/portaudio/examples/CMakeLists.txt (from rev 2705, branches/manx/portaudio/include/portaudio/examples/CMakeLists.txt) =================================================================== --- trunk/OpenMPT/include/portaudio/examples/CMakeLists.txt (rev 0) +++ trunk/OpenMPT/include/portaudio/examples/CMakeLists.txt 2013-09-14 16:24:56 UTC (rev 2706) @@ -0,0 +1,27 @@ +# Example projects + +MACRO(ADD_EXAMPLE appl_name) + ADD_EXECUTABLE(${appl_name} "${appl_name}.c") + TARGET_LINK_LIBRARIES(${appl_name} portaudio_static) +ENDMACRO(ADD_EXAMPLE) + +MACRO(ADD_EXAMPLE_CPP appl_name) + ADD_EXECUTABLE(${appl_name} "${appl_name}.cpp") + TARGET_LINK_LIBRARIES(${appl_name} portaudio_static) +ENDMACRO(ADD_EXAMPLE_CPP) + +ADD_EXAMPLE(pa_devs) +ADD_EXAMPLE(pa_fuzz) +ADD_EXAMPLE(paex_mono_asio_channel_select) +ADD_EXAMPLE(paex_ocean_shore) +ADD_EXAMPLE(paex_pink) +ADD_EXAMPLE(paex_read_write_wire) +ADD_EXAMPLE(paex_record) +ADD_EXAMPLE(paex_record_file) +ADD_EXAMPLE(paex_saw) +ADD_EXAMPLE(paex_sine) +ADD_EXAMPLE_CPP(paex_sine_c++) +ADD_EXAMPLE(paex_wmme_ac3) +ADD_EXAMPLE(paex_wmme_surround) +ADD_EXAMPLE(paex_write_sine) +ADD_EXAMPLE(paex_write_sine_nonint) Modified: trunk/OpenMPT/include/portaudio/examples/pa_devs.c =================================================================== --- trunk/OpenMPT/include/portaudio/examples/pa_devs.c 2013-09-14 16:16:13 UTC (rev 2705) +++ trunk/OpenMPT/include/portaudio/examples/pa_devs.c 2013-09-14 16:24:56 UTC (rev 2706) @@ -7,7 +7,7 @@ ASIO support. */ /* - * $Id: pa_devs.c 1752 2011-09-08 03:21:55Z philburk $ + * $Id: pa_devs.c 1891 2013-05-05 14:00:02Z rbencina $ * * This program uses the PortAudio Portable Audio Library. * For more information see: http://www.portaudio.com @@ -49,6 +49,8 @@ #include "portaudio.h" #ifdef WIN32 +#include <windows.h> + #if PA_USE_ASIO #include "pa_asio.h" #endif @@ -105,7 +107,12 @@ PaError err; - Pa_Initialize(); + err = Pa_Initialize(); + if( err != paNoError ) + { + printf( "ERROR: Pa_Initialize returned 0x%x\n", err ); + goto error; + } printf( "PortAudio version number = %d\nPortAudio version text = '%s'\n", Pa_GetVersion(), Pa_GetVersionText() ); @@ -157,7 +164,15 @@ printf( " ]\n" ); /* print device info fields */ +#ifdef WIN32 + { /* Use wide char on windows, so we can show UTF-8 encoded device names */ + wchar_t wideName[MAX_PATH]; + MultiByteToWideChar(CP_UTF8, 0, deviceInfo->name, -1, wideName, MAX_PATH-1); + wprintf( L"Name = %s\n", wideName ); + } +#else printf( "Name = %s\n", deviceInfo->name ); +#endif printf( "Host API = %s\n", Pa_GetHostApiInfo( deviceInfo->hostApi )->name ); printf( "Max inputs = %d", deviceInfo->maxInputChannels ); printf( ", Max outputs = %d\n", deviceInfo->maxOutputChannels ); @@ -232,7 +247,6 @@ error: Pa_Terminate(); - fprintf( stderr, "An error occured while using the portaudio stream\n" ); fprintf( stderr, "Error number: %d\n", err ); fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); return err; Copied: trunk/OpenMPT/include/portaudio/examples/paex_ocean_shore.c (from rev 2705, branches/manx/portaudio/include/portaudio/examples/paex_ocean_shore.c) =================================================================== --- trunk/OpenMPT/include/portaudio/examples/paex_ocean_shore.c (rev 0) +++ trunk/OpenMPT/include/portaudio/examples/paex_ocean_shore.c 2013-09-14 16:24:56 UTC (rev 2706) @@ -0,0 +1,533 @@ +/** @file paex_ocean_shore.c + @ingroup examples_src + @brief Generate Pink Noise using Gardner method, and make "waves". Provides an example of how to + post stuff to/from the audio callback using lock-free FIFOs implemented by the PA ringbuffer. + + Optimization suggested by James McCartney uses a tree + to select which random value to replace. +<pre> + x x x x x x x x x x x x x x x x + x x x x x x x x + x x x x + x x + x +</pre> + Tree is generated by counting trailing zeros in an increasing index. + When the index is zero, no random number is selected. + + @author Phil Burk http://www.softsynth.com + Robert Bielik +*/ +/* + * $Id: paex_ocean_shore.c 1816 2012-02-22 12:20:26Z robiwan $ + * + * This program uses the PortAudio Portable Audio Library. + * For more information see: http://www.portaudio.com + * Copyright (c) 1999-2000 Ross Bencina and Phil Burk + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * The text above constitutes the entire PortAudio license; however, + * the PortAudio community also makes the following non-binding requests: + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the + * license above. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <time.h> + +#include "portaudio.h" +#include "pa_ringbuffer.h" +#include "pa_util.h" + +#define PINK_MAX_RANDOM_ROWS (30) +#define PINK_RANDOM_BITS (24) +#define PINK_RANDOM_SHIFT ((sizeof(long)*8)-PINK_RANDOM_BITS) + +typedef struct +{ + long pink_Rows[PINK_MAX_RANDOM_ROWS]; + long pink_RunningSum; /* Used to optimize summing of generators. */ + int pink_Index; /* Incremented each sample. */ + int pink_IndexMask; /* Index wrapped by ANDing with this mask. */ + float pink_Scalar; /* Used to scale within range of -1.0 to +1.0 */ +} +PinkNoise; + +typedef struct +{ + float bq_b0; + float bq_b1; + float bq_b2; + float bq_a1; + float bq_a2; +} BiQuad; + +typedef enum +{ + State_kAttack, + State_kPreDecay, + State_kDecay, + State_kCnt, +} EnvState; + +typedef struct +{ + PinkNoise wave_left; + PinkNoise wave_right; + + BiQuad wave_bq_coeffs; + float wave_bq_left[2]; + float wave_bq_right[2]; + + EnvState wave_envelope_state; + float wave_envelope_level; + float wave_envelope_max_level; + float wave_pan_left; + float wave_pan_right; + float wave_attack_incr; + float wave_decay_incr; + +} OceanWave; + +/* Prototypes */ +static unsigned long GenerateRandomNumber( void ); +void InitializePinkNoise( PinkNoise *pink, int numRows ); +float GeneratePinkNoise( PinkNoise *pink ); +unsigned GenerateWave( OceanWave* wave, float* output, unsigned noOfFrames); + +/************************************************************/ +/* Calculate pseudo-random 32 bit number based on linear congruential method. */ +static unsigned long GenerateRandomNumber( void ) +{ + /* Change this seed for different random sequences. */ + static unsigned long randSeed = 22222; + randSeed = (randSeed * 196314165) + 907633515; + return randSeed; +} + +/************************************************************/ +/* Setup PinkNoise structure for N rows of generators. */ +void InitializePinkNoise( PinkNoise *pink, int numRows ) +{ + int i; + long pmax; + pink->pink_Index = 0; + pink->pink_IndexMask = (1<<numRows) - 1; + /* Calculate maximum possible signed random value. Extra 1 for white noise always added. */ + pmax = (numRows + 1) * (1<<(PINK_RANDOM_BITS-1)); + pink->pink_Scalar = 1.0f / pmax; + /* Initialize rows. */ + for( i=0; i<numRows; i++ ) pink->pink_Rows[i] = 0; + pink->pink_RunningSum = 0; +} + +/* Generate Pink noise values between -1.0 and +1.0 */ +float GeneratePinkNoise( PinkNoise *pink ) +{ + long newRandom; + long sum; + float output; + /* Increment and mask index. */ + pink->pink_Index = (pink->pink_Index + 1) & pink->pink_IndexMask; + /* If index is zero, don't update any random values. */ + if( pink->pink_Index != 0 ) + { + /* Determine how many trailing zeros in PinkIndex. */ + /* This algorithm will hang if n==0 so test first. */ + int numZeros = 0; + int n = pink->pink_Index; + while( (n & 1) == 0 ) + { + n = n >> 1; + numZeros++; + } + /* Replace the indexed ROWS random value. + * Subtract and add back to RunningSum instead of adding all the random + * values together. Only one changes each time. + */ + pink->pink_RunningSum -= pink->pink_Rows[numZeros]; + newRandom = ((long)GenerateRandomNumber()) >> PINK_RANDOM_SHIFT; + pink->pink_RunningSum += newRandom; + pink->pink_Rows[numZeros] = newRandom; + } + + /* Add extra white noise value. */ + newRandom = ((long)GenerateRandomNumber()) >> PINK_RANDOM_SHIFT; + sum = pink->pink_RunningSum + newRandom; + /* Scale to range of -1.0 to 0.9999. */ + output = pink->pink_Scalar * sum; + return output; +} + +float ProcessBiquad(const BiQuad* coeffs, float* memory, float input) +{ + float w = input - coeffs->bq_a1 * memory[0] - coeffs->bq_a2 * memory[1]; + float out = coeffs->bq_b1 * memory[0] + coeffs->bq_b2 * memory[1] + coeffs->bq_b0 * w; + memory[1] = memory[0]; + memory[0] = w; + return out; +} + +static const float one_over_2Q_LP = 0.3f; +static const float one_over_2Q_HP = 1.0f; + +unsigned GenerateWave( OceanWave* wave, float* output, unsigned noOfFrames ) +{ + unsigned retval=0,i; + float targetLevel, levelIncr, currentLevel; + switch (wave->wave_envelope_state) + { + case State_kAttack: + targetLevel = noOfFrames * wave->wave_attack_incr + wave->wave_envelope_level; + if (targetLevel >= wave->wave_envelope_max_level) + { + /* Go to decay state */ + wave->wave_envelope_state = State_kPreDecay; + targetLevel = wave->wave_envelope_max_level; + } + /* Calculate lowpass biquad coeffs + + alpha = sin(w0)/(2*Q) + + b0 = (1 - cos(w0))/2 + b1 = 1 - cos(w0) + b2 = (1 - cos(w0))/2 + a0 = 1 + alpha + a1 = -2*cos(w0) + a2 = 1 - alpha + + w0 = [0 - pi[ + */ + { + const float w0 = 3.141592654f * targetLevel / wave->wave_envelope_max_level; + const float alpha = sinf(w0) * one_over_2Q_LP; + const float cosw0 = cosf(w0); + const float a0_fact = 1.0f / (1.0f + alpha); + wave->wave_bq_coeffs.bq_b1 = (1.0f - cosw0) * a0_fact; + wave->wave_bq_coeffs.bq_b0 = wave->wave_bq_coeffs.bq_b1 * 0.5f; + wave->wave_bq_coeffs.bq_b2 = wave->wave_bq_coeffs.bq_b0; + wave->wave_bq_coeffs.bq_a2 = (1.0f - alpha) * a0_fact; + wave->wave_bq_coeffs.bq_a1 = -2.0f * cosw0 * a0_fact; + } + break; + + case State_kPreDecay: + /* Reset biquad state */ + memset(wave->wave_bq_left, 0, 2 * sizeof(float)); + memset(wave->wave_bq_right, 0, 2 * sizeof(float)); + wave->wave_envelope_state = State_kDecay; + + /* Deliberate fall-through */ + + case State_kDecay: + targetLevel = noOfFrames * wave->wave_decay_incr + wave->wave_envelope_level; + if (targetLevel < 0.001f) + { + /* < -60 dB, we're done */ + wave->wave_envelope_state = 3; + retval = 1; + } + /* Calculate highpass biquad coeffs + + alpha = sin(w0)/(2*Q) + + b0 = (1 + cos(w0))/2 + b1 = -(1 + cos(w0)) + b2 = (1 + cos(w0))/2 + a0 = 1 + alpha + a1 = -2*cos(w0) + a2 = 1 - alpha + + w0 = [0 - pi/2[ + */ + { + const float v = targetLevel / wave->wave_envelope_max_level; + const float w0 = 1.5707963f * (1.0f - (v*v)); + const float alpha = sinf(w0) * one_over_2Q_HP; + const float cosw0 = cosf(w0); + const float a0_fact = 1.0f / (1.0f + alpha); + wave->wave_bq_coeffs.bq_b1 = (float)(- (1 + cosw0) * a0_fact); + wave->wave_bq_coeffs.bq_b0 = -wave->wave_bq_coeffs.bq_b1 * 0.5f; + wave->wave_bq_coeffs.bq_b2 = wave->wave_bq_coeffs.bq_b0; + wave->wave_bq_coeffs.bq_a2 = (float)((1.0 - alpha) * a0_fact); + wave->wave_bq_coeffs.bq_a1 = (float)(-2.0 * cosw0 * a0_fact); + } + break; + + default: + break; + } + + currentLevel = wave->wave_envelope_level; + wave->wave_envelope_level = targetLevel; + levelIncr = (targetLevel - currentLevel) / noOfFrames; + + for (i = 0; i < noOfFrames; ++i, currentLevel += levelIncr) + { + (*output++) += ProcessBiquad(&wave->wave_bq_coeffs, wave->wave_bq_left, (GeneratePinkNoise(&wave->wave_left))) * currentLevel * wave->wave_pan_left; + (*output++) += ProcessBiquad(&wave->wave_bq_coeffs, wave->wave_bq_right, (GeneratePinkNoise(&wave->wave_right))) * currentLevel * wave->wave_pan_right; + } + + return retval; +} + + +/*******************************************************************/ + +/* Context for callback routine. */ +typedef struct +{ + OceanWave* waves[16]; /* Maximum 16 waves */ + unsigned noOfActiveWaves; + + /* Ring buffer (FIFO) for "communicating" towards audio callback */ + PaUtilRingBuffer rBufToRT; + void* rBufToRTData; + + /* Ring buffer (FIFO) for "communicating" from audio callback */ + PaUtilRingBuffer rBufFromRT; + void* rBufFromRTData; +} +paTestData; + +/* This routine will be called by the PortAudio engine when audio is needed. +** It may called at interrupt level on some machines so don't do anything +** that could mess up the system like calling malloc() or free(). +*/ +static int patestCallback(const void* inputBuffer, + void* outputBuffer, + unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo* timeInfo, + PaStreamCallbackFlags statusFlags, + void* userData) +{ + int i; + paTestData *data = (paTestData*)userData; + float *out = (float*)outputBuffer; + (void) inputBuffer; /* Prevent "unused variable" warnings. */ + + /* Reset output data first */ + memset(out, 0, framesPerBuffer * 2 * sizeof(float)); + + for (i = 0; i < 16; ++i) + { + /* Consume the input queue */ + if (data->waves[i] == 0 && PaUtil_GetRingBufferReadAvailable(&data->rBufToRT)) + { + OceanWave* ptr = 0; + PaUtil_ReadRingBuffer(&data->rBufToRT, &ptr, 1); + data->waves[i] = ptr; + } + + if (data->waves[i] != 0) + { + if (GenerateWave(data->waves[i], out, framesPerBuffer)) + { + /* If wave is "done", post it back to the main thread for deletion */ + PaUtil_WriteRingBuffer(&data->rBufFromRT, &data->waves[i], 1); + data->waves[i] = 0; + } + } + } + return paContinue; +} + +#define NEW_ROW_SIZE (12 + (8*rand())/RAND_MAX) + +OceanWave* InitializeWave(double SR, float attackInSeconds, float maxLevel, float positionLeftRight) +{ + OceanWave* wave = NULL; + static unsigned lastNoOfRows = 12; + unsigned newNoOfRows; + + wave = (OceanWave*)PaUtil_AllocateMemory(sizeof(OceanWave)); + if (wave != NULL) + { + InitializePinkNoise(&wave->wave_left, lastNoOfRows); + while ((newNoOfRows = NEW_ROW_SIZE) == lastNoOfRows); + InitializePinkNoise(&wave->wave_right, newNoOfRows); + lastNoOfRows = newNoOfRows; + + wave->wave_envelope_state = State_kAttack; + wave->wave_envelope_level = 0.f; + wave->wave_envelope_max_level = maxLevel; + wave->wave_attack_incr = wave->wave_envelope_max_level / (attackInSeconds * (float)SR); + wave->wave_decay_incr = - wave->wave_envelope_max_level / (attackInSeconds * 4 * (float)SR); + + wave->wave_pan_left = sqrtf(1.0 - positionLeftRight); + wave->wave_pan_right = sqrtf(positionLeftRight); + } + return wave; +} + +static float GenerateFloatRandom(float minValue, float maxValue) +{ + return minValue + ((maxValue - minValue) * rand()) / RAND_MAX; +} + +/*******************************************************************/ +int main(void); +int main(void) +{ + PaStream* stream; + PaError err; + paTestData data = {0}; + PaStreamParameters outputParameters; + double tstamp; + double tstart; + double tdelta = 0; + static const double SR = 44100.0; + static const int FPB = 128; /* Frames per buffer: 2.9 ms buffers. */ + + /* Initialize communication buffers (queues) */ + data.rBufToRTData = PaUtil_AllocateMemory(sizeof(OceanWave*) * 256); + if (data.rBufToRTData == NULL) + { + return 1; + } + PaUtil_InitializeRingBuffer(&data.rBufToRT, sizeof(OceanWave*), 256, data.rBufToRTData); + + data.rBufFromRTData = PaUtil_AllocateMemory(sizeof(OceanWave*) * 256); + if (data.rBufFromRTData == NULL) + { + return 1; + } + PaUtil_InitializeRingBuffer(&data.rBufFromRT, sizeof(OceanWave*), 256, data.rBufFromRTData); + + err = Pa_Initialize(); + if( err != paNoError ) goto error; + + /* Open a stereo PortAudio stream so we can hear the result. */ + outputParameters.device = Pa_GetDefaultOutputDevice(); /* Take the default output device. */ + if (outputParameters.device == paNoDevice) { + fprintf(stderr,"Error: No default output device.\n"); + goto error; + } + outputParameters.channelCount = 2; /* Stereo output, most likely supported. */ + outputParameters.hostApiSpecificStreamInfo = NULL; + outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output. */ + outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; + err = Pa_OpenStream(&stream, + NULL, /* No input. */ + &outputParameters, + SR, /* Sample rate. */ + FPB, /* Frames per buffer. */ + paDitherOff, /* Clip but don't dither */ + patestCallback, + &data); + if( err != paNoError ) goto error; + + err = Pa_StartStream( stream ); + if( err != paNoError ) goto error; + + printf("Stereo \"ocean waves\" for one minute...\n"); + + tstart = PaUtil_GetTime(); + tstamp = tstart; + srand( (unsigned)time(NULL) ); + + while( ( err = Pa_IsStreamActive( stream ) ) == 1 ) + { + const double tcurrent = PaUtil_GetTime(); + + /* Delete "waves" that the callback is finished with */ + while (PaUtil_GetRingBufferReadAvailable(&data.rBufFromRT) > 0) + { + OceanWave* ptr = 0; + PaUtil_ReadRingBuffer(&data.rBufFromRT, &ptr, 1); + if (ptr != 0) + { + printf("Wave is deleted...\n"); + PaUtil_FreeMemory(ptr); + --data.noOfActiveWaves; + } + } + + if (tcurrent - tstart < 60.0) /* Only start new "waves" during one minute */ + { + if (tcurrent >= tstamp) + { + double tdelta = GenerateFloatRandom(1.0f, 4.0f); + tstamp += tdelta; + + if (data.noOfActiveWaves<16) + { + const float attackTime = GenerateFloatRandom(2.0f, 6.0f); + const float level = GenerateFloatRandom(0.1f, 1.0f); + const float pos = GenerateFloatRandom(0.0f, 1.0f); + OceanWave* p = InitializeWave(SR, attackTime, level, pos); + if (p != NULL) + { + /* Post wave to audio callback */ + PaUtil_WriteRingBuffer(&data.rBufToRT, &p, 1); + ++data.noOfActiveWaves; + + printf("Starting wave at level = %.2f, attack = %.2lf, pos = %.2lf\n", level, attackTime, pos); + } + } + } + } + else + { + if (data.noOfActiveWaves == 0) + { + printf("All waves finished!\n"); + break; + } + } + + Pa_Sleep(100); + } + if( err < 0 ) goto error; + + err = Pa_CloseStream( stream ); + if( err != paNoError ) goto error; + + if (data.rBufToRTData) + { + PaUtil_FreeMemory(data.rBufToRTData); + } + if (data.rBufFromRTData) + { + PaUtil_FreeMemory(data.rBufFromRTData); + } + + Pa_Sleep(1000); + + Pa_Terminate(); + return 0; + +e... [truncated message content] |
From: <sag...@us...> - 2013-09-20 18:09:36
|
Revision: 2725 http://sourceforge.net/p/modplug/code/2725 Author: saga-games Date: 2013-09-20 18:09:28 +0000 (Fri, 20 Sep 2013) Log Message: ----------- [Fix] Loading MPTM files made with older versions of OpenMPT could trash PC some note parameters. [Mod] OpenMPT: Version is now 1.22.05.04 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-09-19 23:28:26 UTC (rev 2724) +++ trunk/OpenMPT/common/versionNumber.h 2013-09-20 18:09:28 UTC (rev 2725) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 05 -#define VER_MINORMINOR 03 +#define VER_MINORMINOR 04 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-09-19 23:28:26 UTC (rev 2724) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-09-20 18:09:28 UTC (rev 2725) @@ -2117,6 +2117,11 @@ void operator()(ModCommand& m) { + if(m.IsPcNote()) + { + return; + } + if(sndFile.m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 17, 03, 02) || (!sndFile.IsCompatibleMode(TRK_ALLTRACKERS) && sndFile.m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00))) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-27 01:36:58
|
Revision: 2777 http://sourceforge.net/p/modplug/code/2777 Author: manxorist Date: 2013-09-27 01:36:48 +0000 (Fri, 27 Sep 2013) Log Message: ----------- [Mod] in_openmpt: Require a more modern winamp SDK. [Fix] in_openmpt: Fix unicode handling. Modified Paths: -------------- trunk/OpenMPT/include/readme.txt trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp Modified: trunk/OpenMPT/include/readme.txt =================================================================== --- trunk/OpenMPT/include/readme.txt 2013-09-27 01:05:23 UTC (rev 2776) +++ trunk/OpenMPT/include/readme.txt 2013-09-27 01:36:48 UTC (rev 2777) @@ -18,10 +18,10 @@ Please visit http://www.steinberg.net/en/company/developer.html to download the SDK. -Winamp2 SDK +Winamp5 SDK =========== -To build libopenmpt as a winamp2 input plugin, copy the winamp2 SDK headers to -include/winamp/. +To build libopenmpt as a winamp input plugin, copy the headers in Winamp/ +from WA5.55_SDK.exe to include/winamp/. Use #define NO_WINAMP in common/BuildSettings.h to disable. xmplay input SDK Modified: trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp 2013-09-27 01:05:23 UTC (rev 2776) +++ trunk/OpenMPT/libopenmpt/libopenmpt_winamp.cpp 2013-09-27 01:36:48 UTC (rev 2777) @@ -25,7 +25,9 @@ #define NOMINMAX #include <windows.h> +#define UNICODE_INPUT_PLUGIN #include "winamp/IN2.H" +#include "winamp/wa_ipc.h" #include <algorithm> #include <fstream> @@ -38,7 +40,6 @@ #define WINAMP_DSP_HEADROOM_FACTOR 2 #define WINAMP_BUFFER_SIZE_FRAMES 576 -#define WM_WA_MPEG_EOF (WM_USER+2) #define WM_OPENMPT_SEEK (WM_USER+3) #define SHORT_TITLE "in_openmpt" @@ -76,7 +77,7 @@ openmpt::settings::settings settings; int samplerate; int channels; - std::string cached_filename; + std::wstring cached_filename; std::wstring cached_title; int cached_length; std::wstring cached_infotext; @@ -101,7 +102,7 @@ filetypes_string.push_back('\0'); samplerate = settings.samplerate; channels = settings.channels; - cached_filename = ""; + cached_filename = std::wstring(); cached_title = std::wstring(); cached_length = 0; cached_infotext = std::wstring(); @@ -135,9 +136,9 @@ static DWORD WINAPI DecodeThread( LPVOID ); -static std::wstring generate_infotext( const std::string & filename, const openmpt::module & mod ) { +static std::wstring generate_infotext( const std::wstring & filename, const openmpt::module & mod ) { std::wostringstream str; - str << L"filename: " << StringDecode( filename, CP_ACP ) << std::endl; + str << L"filename: " << filename << std::endl; str << L"duration: " << mod.get_duration_seconds() << L"seconds" << std::endl; std::vector<std::string> metadatakeys = mod.get_metadata_keys(); for ( std::vector<std::string>::iterator key = metadatakeys.begin(); key != metadatakeys.end(); ++key ) { @@ -196,11 +197,11 @@ } } -static int isourfile( char * fn ) { +static int isourfile( const in_char * fn ) { return 0; } -static int play( char * fn ) { +static int play( const in_char * fn ) { if ( !fn ) { return -1; } @@ -282,8 +283,8 @@ inmod.outMod->SetPan( pan ); } -static int infobox( char * fn, HWND hWndParent ) { - if ( fn && fn[0] != '\0' && self->cached_filename != std::string(fn) ) { +static int infobox( const in_char * fn, HWND hWndParent ) { + if ( fn && fn[0] != '\0' && self->cached_filename != std::wstring(fn) ) { try { std::ifstream s( fn, std::ios::binary ); openmpt::module mod( s ); @@ -296,13 +297,17 @@ return 0; } -static void getfileinfo( char * filename, char * title, int * length_in_ms ) { +static void getfileinfo( const in_char * filename, in_char * title, int * length_in_ms ) { if ( !filename || *filename == '\0' ) { if ( length_in_ms ) { *length_in_ms = self->cached_length; } if ( title ) { - strcpy( title, StringEncode( self->cached_title, CP_ACP ).c_str() ); + std::wstring truncated_title = self->cached_title; + if ( truncated_title.length() >= GETFILEINFO_TITLE_LENGTH ) { + truncated_title.resize( GETFILEINFO_TITLE_LENGTH - 1 ); + } + wcscpy( title, truncated_title.c_str() ); } } else { try { @@ -312,7 +317,11 @@ *length_in_ms = static_cast<int>( mod.get_duration_seconds() * 1000.0 ); } if ( title ) { - strcpy( title, StringEncode( StringDecode( mod.get_metadata("title"), CP_UTF8 ), CP_ACP ).c_str() ); + std::wstring truncated_title = StringDecode( mod.get_metadata("title"), CP_UTF8 ); + if ( truncated_title.length() >= GETFILEINFO_TITLE_LENGTH ) { + truncated_title.resize( GETFILEINFO_TITLE_LENGTH - 1 ); + } + wcscpy( title, truncated_title.c_str() ); } } catch ( ... ) { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-28 17:58:49
|
Revision: 2789 http://sourceforge.net/p/modplug/code/2789 Author: manxorist Date: 2013-09-28 17:58:40 +0000 (Sat, 28 Sep 2013) Log Message: ----------- Merged revision(s) 2780-2788 from branches/manx/snddev: [Ref] sounddev: Simplify ISoundDevice interface and always provide GetStreamPositionSamples(). [Ref] Remove m_TotalSamplesRendered from CMainFrame. The sound device itself knows better. ........ [Mod] sounddev: Always default or fallback to a WaveOut device which is by far the most stable and has the least suprising user experience. ........ [Fix] sounddev: Move querying of default ASIO device samplerate until after sound device code has actually been initialized. This breaks circular dependencies and removes strange initialization order fluctuation depending on values stored in configuration. ........ [Ref] sounddev: Add a class SoundDevicesManager which stores sound device enumeration data instead of storing this globally. [Imp] sounddev: Remove static limit of 16 DirectSound devices. [Imp] sounddev: Remove static limit of 8 ASIO devices. [Ref] sounddev: Let CreateSoundDevice() not only take the device type but also the device index, remove device index from Open(). Cleanup backends code accordingly. [Ref] sounddev: Rework sound device enumeration and avoid storing device names to fixed size char buffers. [Imp] sounddev: Make sound device names Unicode. Not really useful at the moment, but unicodification has to start somewhere. [New] sounddev: Add possibility to re-enumerate sound devices (not in GUI yet). ........ [Ref] sounddev: Remove redundant CASIODevice::m_nChannels. ........ [Ref] sounddev: Rename CanRampleRate() to GetSampleRates() and simplify it a tiny bit. [Fix] When selecting a new sound device in the settings dialog and last selected samplerate is not supported by the new device, no samplerate gets selected in the ComboBox. Select the first one instead. ........ [Ref] Simplify audioOpenDevice() and audioTryOpeningDevice(). There is no need to open ISoundDevice twice for fixed-sampleformat devices like ASIO. Just let CASIODevice update its internal sampleformat unconditionally and query it after the device has been opened to update the tracker settings accordingly. ........ [Ref] Avoid touching TrackerSettings in CMainFrame::AudioRead. ........ [Fix] sounddev: Compile fix for VS2008 and older SDKs. ........ Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/Notification.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.h trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDevicePortAudio.h trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp trunk/OpenMPT/sounddev/SoundDeviceWaveout.h Property Changed: ---------------- trunk/OpenMPT/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT 2013-09-28 17:58:40 UTC (rev 2789) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -12,6 +12,7 ## /branches/manx/project-files-cleanups:1378-1382 /branches/manx/sampleformat-ref:2554-2582 /branches/manx/serialization-utils-cleanup:2382-2386,2395 +/branches/manx/snddev:2780-2788 /branches/manx/snddev-fixes:1605-1713 /branches/manx/stdstring-names:2223,2228 /branches/manx/stdstring-song-name:2462-2463 \ No newline at end of property Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -205,7 +205,6 @@ m_szInfoText[0] = 0; m_szXInfoText[0]= 0; //rewbs.xinfo - m_TotalSamplesRendered = 0; m_PendingNotificationSempahore = NULL; MemsetZero(gcolrefVuMeter); @@ -245,14 +244,27 @@ OnUpdateFrameTitle(false); // Check for valid sound device - if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice), SNDDEV_GET_NUMBER(TrackerSettings::Instance().m_nWaveDevice), nullptr, 0)) + if(!theApp.GetSoundDevicesManager()->FindDeviceInfo(TrackerSettings::Instance().m_nWaveDevice)) { - TrackerSettings::Instance().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); - if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice), SNDDEV_GET_NUMBER(TrackerSettings::Instance().m_nWaveDevice), nullptr, 0)) - { - TrackerSettings::Instance().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); - } + // Fall back to default WaveOut device + TrackerSettings::Instance().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); } + if(TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq == 0) + { + TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq = MixerSettings().gdwMixingFreq; + #ifndef NO_ASIO + // If no mixing rate is specified and we're using ASIO, get a mixing rate supported by the device. + if(SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice) == SNDDEV_ASIO) + { + ISoundDevice *dummy = theApp.GetSoundDevicesManager()->CreateSoundDevice(TrackerSettings::Instance().m_nWaveDevice); + if(dummy) + { + TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq = dummy->GetCurrentSampleRate(); + delete dummy; + } + } + #endif // NO_ASIO + } // Create Notify Thread m_PendingNotificationSempahore = CreateSemaphore(NULL, 0, 1, NULL); @@ -721,23 +733,16 @@ Notification PendingNotification; bool found = false; int64 currenttotalsamples = 0; - bool currenttotalsamplesValid = false; { Util::lock_guard<Util::mutex> lock(m_SoundDeviceMutex); - if(gpSoundDevice && gpSoundDevice->HasGetStreamPosition()) + if(gpSoundDevice) { currenttotalsamples = gpSoundDevice->GetStreamPositionSamples(); - currenttotalsamplesValid = true; } } { // advance to the newest notification, drop the obsolete ones Util::lock_guard<Util::mutex> lock(m_NotificationBufferMutex); - if(!currenttotalsamplesValid) - { - currenttotalsamples = m_TotalSamplesRendered; - currenttotalsamplesValid = true; - } const Notification * pnotify = nullptr; const Notification * p = m_NotifyBuffer.peek_p(); if(p && currenttotalsamples >= p->timestampSamples) @@ -849,11 +854,10 @@ }; -void CMainFrame::AudioRead(PVOID pvData, ULONG NumFrames) -//------------------------------------------------------- +void CMainFrame::AudioRead(PVOID pvData, ULONG NumFrames, SampleFormat sampleFormat) +//---------------------------------------------------------------------------------- { OPENMPT_PROFILE_FUNCTION(Profiler::Audio); - const SampleFormat sampleFormat = TrackerSettings::Instance().m_SampleFormat; StereoVuMeterTargetWrapper target(sampleFormat, m_Dither, pvData); CSoundFile::samplecount_t renderedFrames = m_pSndFile->Read(NumFrames, target); ASSERT(renderedFrames <= NumFrames); @@ -874,35 +878,27 @@ } -void CMainFrame::AudioDone(ULONG NumSamples, ULONG SamplesLatency) +void CMainFrame::AudioDone(ULONG NumSamples, int64 streamPosition) //---------------------------------------------------------------- { OPENMPT_PROFILE_FUNCTION(Profiler::Notify); - DoNotification(NumSamples, SamplesLatency, false); + DoNotification(NumSamples, streamPosition); } -void CMainFrame::AudioDone(ULONG NumSamples) -//------------------------------------------ +bool CMainFrame::audioTryOpeningDevice() +//-------------------------------------- { - OPENMPT_PROFILE_FUNCTION(Profiler::Notify); - DoNotification(NumSamples, 0, true); -} - - -bool CMainFrame::audioTryOpeningDevice(UINT channels, SampleFormat sampleFormat, UINT samplespersec) -//-------------------------------------------------------------------------------------------------- -{ Util::lock_guard<Util::mutex> lock(m_SoundDeviceMutex); - const UINT nDevType = SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice); - if(gpSoundDevice && (gpSoundDevice->GetDeviceType() != nDevType)) + const UINT nDevID = TrackerSettings::Instance().m_nWaveDevice; + if(gpSoundDevice && (gpSoundDevice->GetDeviceID() != nDevID)) { delete gpSoundDevice; - gpSoundDevice = NULL; + gpSoundDevice = nullptr; } if(!gpSoundDevice) { - gpSoundDevice = CreateSoundDevice(nDevType); + gpSoundDevice = theApp.GetSoundDevicesManager()->CreateSoundDevice(nDevID); } if(!gpSoundDevice) { @@ -914,10 +910,10 @@ settings.LatencyMS = TrackerSettings::Instance().m_LatencyMS; settings.UpdateIntervalMS = TrackerSettings::Instance().m_UpdateIntervalMS; settings.fulCfgOptions = TrackerSettings::Instance().GetSoundDeviceFlags(); - settings.Samplerate = samplespersec; - settings.Channels = (uint8)channels; - settings.sampleFormat = sampleFormat; - return gpSoundDevice->Open(SNDDEV_GET_NUMBER(TrackerSettings::Instance().m_nWaveDevice), settings); + settings.Samplerate = TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq; + settings.Channels = (uint8)TrackerSettings::Instance().m_MixerSettings.gnChannels; + settings.sampleFormat = TrackerSettings::Instance().m_SampleFormat; + return gpSoundDevice->Open(settings); } @@ -932,37 +928,30 @@ bool CMainFrame::audioOpenDevice() //-------------------------------- { - if(IsAudioDeviceOpen()) return true; - bool err = false; - - if (!TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq) err = true; - if ((TrackerSettings::Instance().m_MixerSettings.gnChannels != 1) && (TrackerSettings::Instance().m_MixerSettings.gnChannels != 2) && (TrackerSettings::Instance().m_MixerSettings.gnChannels != 4)) err = true; - if(!err) + if(IsAudioDeviceOpen()) { - err = !audioTryOpeningDevice(TrackerSettings::Instance().m_MixerSettings.gnChannels, - TrackerSettings::Instance().m_SampleFormat, - TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq); - SampleFormat fixedBitsPerSample = SampleFormatInvalid; + return true; + } + if(TrackerSettings::Instance().m_MixerSettings.IsValid()) + { + if(audioTryOpeningDevice()) { - Util::lock_guard<Util::mutex> lock(m_SoundDeviceMutex); - fixedBitsPerSample = (gpSoundDevice) ? SampleFormat(gpSoundDevice->HasFixedSampleFormat()) : SampleFormatInvalid; + SampleFormat actualSampleFormat = SampleFormatInvalid; + { + Util::lock_guard<Util::mutex> lock(m_SoundDeviceMutex); + actualSampleFormat = gpSoundDevice->GetActualSampleFormat(); + } + if(actualSampleFormat.IsValid()) + { + TrackerSettings::Instance().m_SampleFormat = actualSampleFormat; + // Device is ready + return true; + } } - if(fixedBitsPerSample.IsValid() && (fixedBitsPerSample != TrackerSettings::Instance().m_SampleFormat)) - { - TrackerSettings::Instance().m_SampleFormat = fixedBitsPerSample; - err = !audioTryOpeningDevice(TrackerSettings::Instance().m_MixerSettings.gnChannels, - TrackerSettings::Instance().m_SampleFormat, - TrackerSettings::Instance().m_MixerSettings.gdwMixingFreq); - } } // Display error message box - if(err) - { - Reporting::Error("Unable to open sound device!"); - return false; - } - // Device is ready - return true; + Reporting::Error("Unable to open sound device!"); + return false; } @@ -988,7 +977,6 @@ { Util::lock_guard<Util::mutex> lock(m_NotificationBufferMutex); m_NotifyBuffer.clear(); - m_TotalSamplesRendered = 0; } } @@ -1026,23 +1014,10 @@ } -BOOL CMainFrame::DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool hasSoundDeviceGetStreamPosition) -//-------------------------------------------------------------------------------------------------------------- +bool CMainFrame::DoNotification(DWORD dwSamplesRead, int64 streamPosition) +//------------------------------------------------------------------------ { - if(dwSamplesRead == 0) return FALSE; - int64 notificationtimestamp = 0; - { - Util::lock_guard<Util::mutex> lock(m_NotificationBufferMutex); // protect m_TotalSamplesRendered - m_TotalSamplesRendered += dwSamplesRead; - if(hasSoundDeviceGetStreamPosition) - { - notificationtimestamp = m_TotalSamplesRendered; - } else - { - notificationtimestamp = m_TotalSamplesRendered + SamplesLatency; - } - } - if(!m_pSndFile) return FALSE; + if(!m_pSndFile) return false; FlagSet<Notification::Type> notifyType(Notification::Default); Notification::Item notifyItem = 0; @@ -1052,14 +1027,13 @@ notifyType = m_pSndFile->m_pModDoc->GetNotificationType(); notifyItem = m_pSndFile->m_pModDoc->GetNotificationItem(); } + // Notify Client - //if(m_NotifyBuffer.read_size() > 0) - { - SetEvent(m_hNotifyWakeUp); - } + SetEvent(m_hNotifyWakeUp); + // Add an entry to the notification history - Notification notification(notifyType, notifyItem, notificationtimestamp, m_pSndFile->m_nRow, m_pSndFile->m_nTickCount, m_pSndFile->m_nCurrentOrder, m_pSndFile->m_nPattern, m_pSndFile->GetMixStat()); + Notification notification(notifyType, notifyItem, streamPosition, m_pSndFile->m_nRow, m_pSndFile->m_nTickCount, m_pSndFile->m_nCurrentOrder, m_pSndFile->m_nPattern, m_pSndFile->GetMixStat()); m_pSndFile->ResetMixStat(); @@ -1166,8 +1140,7 @@ SetEvent(m_hNotifyWakeUp); - return TRUE; - + return true; } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-09-28 17:58:40 UTC (rev 2789) @@ -302,7 +302,6 @@ // Notification Buffer Util::mutex m_NotificationBufferMutex; // to avoid deadlocks, this mutex should only be taken as a innermost lock, i.e. do not block on anything while holding this mutex - int64 m_TotalSamplesRendered; Util::fixed_size_queue<Notification,MAX_UPDATE_HISTORY> m_NotifyBuffer; HANDLE m_PendingNotificationSempahore; // protects the one notification that is in flight from the notification thread to the gui thread from being freed while the gui thread still uses it @@ -326,16 +325,15 @@ // from ISoundSource void FillAudioBufferLocked(IFillAudioBuffer &callback); - void AudioRead(PVOID pData, ULONG NumSamples); - void AudioDone(ULONG NumSamples, ULONG SamplesLatency); - void AudioDone(ULONG NumSamples); + void AudioRead(PVOID pData, ULONG NumSamples, SampleFormat sampleFormat); + void AudioDone(ULONG NumSamples, int64 streamPosition); - bool audioTryOpeningDevice(UINT channels, SampleFormat sampleFormat, UINT samplespersec); + bool audioTryOpeningDevice(); bool audioOpenDevice(); bool audioReopenDevice(); void audioCloseDevice(); bool IsAudioDeviceOpen() const; - BOOL DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool hasSoundDeviceGetStreamPosition); + bool DoNotification(DWORD dwSamplesRead, int64 streamPosition); // Midi Input Functions public: Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -18,6 +18,7 @@ #include "moddoc.h" #include "../sounddev/SoundDevice.h" #include ".\mpdlgs.h" +#include "../common/StringFixer.h" #define str_preampChangeNote GetStrI18N(_TEXT("Note: The Pre-Amp setting affects sample volume only. Changing it may cause undesired effects on volume balance between sample based instruments and plugin instruments.\nIn other words: Don't touch this slider unless you know what you are doing.")) @@ -185,25 +186,25 @@ COMBOBOXEXITEM cbi; UINT iItem = 0; - for (UINT nDevType = 0; nDevType < SNDDEV_NUM_DEVTYPES; nDevType++) + for(std::vector<SoundDeviceInfo>::const_iterator it = theApp.GetSoundDevicesManager()->begin(); it != theApp.GetSoundDevicesManager()->end(); ++it) { + if(!TrackerSettings::Instance().m_MorePortaudio) { - if(nDevType == SNDDEV_PORTAUDIO_ASIO || nDevType == SNDDEV_PORTAUDIO_DS || nDevType == SNDDEV_PORTAUDIO_WMME) + if(it->type == SNDDEV_PORTAUDIO_ASIO || it->type == SNDDEV_PORTAUDIO_DS || it->type == SNDDEV_PORTAUDIO_WMME) { // skip those portaudio apis that are already implemented via our own ISoundDevice class // can be overwritten via [Sound Settings]MorePortaudio=1 continue; } } - UINT nDev = 0; - while (EnumerateSoundDevices(nDevType, nDev, s, CountOf(s))) { + mpt::String::Copy(s, mpt::String::Encode(it->name, mpt::CharsetLocale)); cbi.mask = CBEIF_IMAGE | CBEIF_LPARAM | CBEIF_TEXT | CBEIF_SELECTEDIMAGE | CBEIF_OVERLAY; cbi.iItem = iItem; cbi.cchTextMax = 0; - switch(nDevType) + switch(it->type) { case SNDDEV_DSOUND: case SNDDEV_PORTAUDIO_DS: @@ -220,12 +221,11 @@ cbi.iSelectedImage = cbi.iImage; cbi.iOverlay = cbi.iImage; cbi.iIndent = 0; - cbi.lParam = SNDDEV_BUILD_ID(nDev, nDevType); + cbi.lParam = SNDDEV_BUILD_ID(it->index, it->type); cbi.pszText = s; int pos = m_CbnDevice.InsertItem(&cbi); if (cbi.lParam == (LONG)m_nSoundDevice) m_CbnDevice.SetCurSel(pos); iItem++; - nDev++; } } UpdateControls(m_nSoundDevice); @@ -377,54 +377,50 @@ void COptionsSoundcard::UpdateSampleRates(int dev) //------------------------------------------------ { - CHAR s[16]; m_CbnMixingFreq.ResetContent(); - std::vector<bool> supportedRates; - const std::vector<uint32> samplerates = TrackerSettings::Instance().GetSampleRates(); + std::vector<uint32> samplerates = TrackerSettings::Instance().GetSampleRates(); - bool knowRates = false; { - Util::lock_guard<Util::mutex> lock(CMainFrame::GetMainFrame()->m_SoundDeviceMutex); - ISoundDevice *dummy = nullptr; - bool justCreated = false; - if(TrackerSettings::Instance().m_nWaveDevice == dev) - { - // If this is the currently active sound device, it might already be playing something, so we shouldn't create yet another instance of it. - dummy = CMainFrame::GetMainFrame()->gpSoundDevice; - } - if(dummy == nullptr) - { - justCreated = true; - dummy = CreateSoundDevice(SNDDEV_GET_TYPE(dev)); - } + Util::lock_guard<Util::mutex> lock(CMainFrame::GetMainFrame()->m_SoundDeviceMutex); + ISoundDevice *dummy = nullptr; + bool justCreated = false; + if(TrackerSettings::Instance().m_nWaveDevice == dev) + { + // If this is the currently active sound device, it might already be playing something, so we shouldn't create yet another instance of it. + dummy = CMainFrame::GetMainFrame()->gpSoundDevice; + } + if(dummy == nullptr) + { + justCreated = true; + dummy = theApp.GetSoundDevicesManager()->CreateSoundDevice(dev); + } - if(dummy != nullptr) - { - // Now we can query the supported sample rates. - knowRates = dummy->CanSampleRate(SNDDEV_GET_NUMBER(dev), samplerates, supportedRates); - if(justCreated) + if(dummy != nullptr) { - delete dummy; + // Now we can query the supported sample rates. + samplerates = dummy->GetSampleRates(samplerates); + if(justCreated) + { + delete dummy; + } } } - } - if(!knowRates) + if(samplerates.empty()) { // We have no valid list of supported playback rates! Assume all rates supported by OpenMPT are possible... - supportedRates.assign(samplerates.size(), true); + samplerates = TrackerSettings::Instance().GetSampleRates(); } - int n = 1; + + int n = 0; for(size_t i = 0; i < samplerates.size(); i++) { - if(supportedRates[i]) - { - wsprintf(s, "%i Hz", samplerates[i]); - int pos = m_CbnMixingFreq.AddString(s); - m_CbnMixingFreq.SetItemData(pos, samplerates[i]); - if(m_dwRate == samplerates[i]) n = pos; - } + CHAR s[16]; + wsprintf(s, "%i Hz", samplerates[i]); + int pos = m_CbnMixingFreq.AddString(s); + m_CbnMixingFreq.SetItemData(pos, samplerates[i]); + if(m_dwRate == samplerates[i]) n = pos; } m_CbnMixingFreq.SetCurSel(n); } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -620,6 +620,7 @@ m_bPortableMode = false; m_pModTemplate = NULL; m_pPluginManager = NULL; + m_pSoundDevicesManager = nullptr; m_bInitialized = FALSE; m_szConfigFileName[0] = 0; } @@ -862,7 +863,7 @@ //RegisterExtensions(); // Load sound APIs - SndDevInitialize(); + m_pSoundDevicesManager = new SoundDevicesManager(); // Load DLS Banks if (!cmdInfo.m_bNoDls) LoadDefaultDLSBanks(); @@ -916,7 +917,8 @@ int CTrackApp::ExitInstance() //--------------------------- { - SndDevUninitialize(); + delete m_pSoundDevicesManager; + m_pSoundDevicesManager = nullptr; if (glpMidiLibrary) { if (m_szConfigFileName[0]) ExportMidiConfig(m_szConfigFileName); Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/Mptrack.h 2013-09-28 17:58:40 UTC (rev 2789) @@ -20,6 +20,7 @@ class CModDoc; class CVstPluginManager; +class SoundDevicesManager; class CDLSBank; ///////////////////////////////////////////////////////////////////////////// @@ -111,6 +112,7 @@ protected: CMultiDocTemplate *m_pModTemplate; CVstPluginManager *m_pPluginManager; + SoundDevicesManager *m_pSoundDevicesManager; BOOL m_bInitialized; DWORD m_dwTimeStarted, m_dwLastPluginIdleCall; // Default macro configuration @@ -155,6 +157,7 @@ public: CDocTemplate *GetModDocTemplate() const { return m_pModTemplate; } CVstPluginManager *GetPluginManager() const { return m_pPluginManager; } + SoundDevicesManager *GetSoundDevicesManager() const { return m_pSoundDevicesManager; } void GetDefaultMidiMacro(MIDIMacroConfig &cfg) const { cfg = m_MidiCfg; } void SetDefaultMidiMacro(const MIDIMacroConfig &cfg) { m_MidiCfg = cfg; } LPCTSTR GetConfigFileName() const { return m_szConfigFileName; } Modified: trunk/OpenMPT/mptrack/Notification.h =================================================================== --- trunk/OpenMPT/mptrack/Notification.h 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/Notification.h 2013-09-28 17:58:40 UTC (rev 2789) @@ -33,13 +33,6 @@ static const SmpLength PosInvalid = SmpLength(-1); // pos[i] is not valid (if it contains sample or envelope position) static const uint32 ClipVU = 0x80000000; // Master VU clip indicator bit (sound output has previously clipped) - /* - timestampSamples is kind of confusing at the moment: - If gpSoundDevice->HasGetStreamPosition(), - then it contains the sample timestamp as when it was generated and the output stream is later queried when this exact timestamp has actually reached the speakers. - If !gpSoundDevice->HasGetStreamPosition(), - then it contains a sample timestamp in the future, incremented by the current latency estimation of the sound buffers. It is later checked against the total number of rendered samples at that time. - */ int64 timestampSamples; FlagSet<Type, uint16> type; Item item; // Sample or instrument number, depending on type Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -334,11 +334,6 @@ m_MorePortaudio = CMainFrame::GetPrivateProfileBool("Sound Settings", "MorePortaudio", m_MorePortaudio, iniFile); DWORD defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); // first WaveOut device #ifndef NO_ASIO - // If there's an ASIO device available, prefer it over DirectSound - if(EnumerateSoundDevices(SNDDEV_ASIO, 0, nullptr, 0)) - { - defaultDevice = SNDDEV_BUILD_ID(0, SNDDEV_ASIO); - } CASIODevice::baseChannel = GetPrivateProfileInt("Sound Settings", "ASIOBaseChannel", CASIODevice::baseChannel, iniFile); #endif // NO_ASIO m_nWaveDevice = CMainFrame::GetPrivateProfileLong("Sound Settings", "WaveDevice", defaultDevice, iniFile); @@ -389,22 +384,6 @@ m_LatencyMS = LatencyMS; m_UpdateIntervalMS = UpdateIntervalMS; } - if(m_MixerSettings.gdwMixingFreq == 0) - { - m_MixerSettings.gdwMixingFreq = 44100; -#ifndef NO_ASIO - // If no mixing rate is specified and we're using ASIO, get a mixing rate supported by the device. - if(SNDDEV_GET_TYPE(m_nWaveDevice) == SNDDEV_ASIO) - { - ISoundDevice *dummy = CreateSoundDevice(SNDDEV_ASIO); - if(dummy) - { - m_MixerSettings.gdwMixingFreq = dummy->GetCurrentSampleRate(SNDDEV_GET_NUMBER(m_nWaveDevice)); - delete dummy; - } - } -#endif // NO_ASIO - } m_MixerSettings.m_nPreAmp = CMainFrame::GetPrivateProfileDWord("Sound Settings", "PreAmp", m_MixerSettings.m_nPreAmp, iniFile); m_MixerSettings.m_nStereoSeparation = CMainFrame::GetPrivateProfileLong("Sound Settings", "StereoSeparation", m_MixerSettings.m_nStereoSeparation, iniFile); Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -22,7 +22,10 @@ #include "SoundDevicePortAudio.h" #include "SoundDeviceWaveout.h" +#include <algorithm> +#include <iterator> + /////////////////////////////////////////////////////////////////////////////////////// // // ISoundDevice base class @@ -33,10 +36,13 @@ { m_Source = nullptr; + m_Index = 0; + m_RealLatencyMS = static_cast<float>(m_Settings.LatencyMS); m_RealUpdateIntervalMS = static_cast<float>(m_Settings.UpdateIntervalMS); m_IsPlaying = false; + m_SamplesRendered = 0; } @@ -47,6 +53,14 @@ } +void ISoundDevice::SetDevice(UINT index, const std::wstring &internalID) +//---------------------------------------------------------------------- +{ + m_Index = index; + m_InternalID = internalID; +} + + bool ISoundDevice::FillWaveFormatExtensible(WAVEFORMATEXTENSIBLE &WaveFormat) //--------------------------------------------------------------------------- { @@ -81,8 +95,8 @@ } -bool ISoundDevice::Open(UINT device, const SoundDeviceSettings &settings) -//----------------------------------------------------------------------- +bool ISoundDevice::Open(const SoundDeviceSettings &settings) +//---------------------------------------------------------- { m_Settings = settings; if(m_Settings.LatencyMS < SNDDEV_MINLATENCY_MS) m_Settings.LatencyMS = SNDDEV_MINLATENCY_MS; @@ -91,7 +105,7 @@ if(m_Settings.UpdateIntervalMS > SNDDEV_MAXUPDATEINTERVAL_MS) m_Settings.UpdateIntervalMS = SNDDEV_MAXUPDATEINTERVAL_MS; m_RealLatencyMS = static_cast<float>(m_Settings.LatencyMS); m_RealUpdateIntervalMS = static_cast<float>(m_Settings.UpdateIntervalMS); - return InternalOpen(device); + return InternalOpen(); } @@ -115,19 +129,33 @@ void ISoundDevice::SourceAudioRead(void* pData, ULONG NumSamples) //--------------------------------------------------------------- { - m_Source->AudioRead(pData, NumSamples); + if(NumSamples <= 0) + { + return; + } + m_Source->AudioRead(pData, NumSamples, m_Settings.sampleFormat); } void ISoundDevice::SourceAudioDone(ULONG NumSamples, ULONG SamplesLatency) //------------------------------------------------------------------------ { - if(HasGetStreamPosition()) + if(NumSamples <= 0) { - m_Source->AudioDone(NumSamples); + return; + } + int64 samplesRendered = 0; + { + Util::lock_guard<Util::mutex> lock(m_SamplesRenderedMutex); + m_SamplesRendered += NumSamples; + samplesRendered = m_SamplesRendered; + } + if(InternalHasGetStreamPosition()) + { + m_Source->AudioDone(NumSamples, samplesRendered); } else { - m_Source->AudioDone(NumSamples, SamplesLatency); + m_Source->AudioDone(NumSamples, samplesRendered + SamplesLatency); } } @@ -138,6 +166,10 @@ if(!IsOpen()) return; if(!IsPlaying()) { + { + Util::lock_guard<Util::mutex> lock(m_SamplesRenderedMutex); + m_SamplesRendered = 0; + } InternalStart(); m_IsPlaying = true; } @@ -152,6 +184,10 @@ { InternalStop(); m_IsPlaying = false; + { + Util::lock_guard<Util::mutex> lock(m_SamplesRenderedMutex); + m_SamplesRendered = 0; + } } } @@ -165,6 +201,20 @@ } +int64 ISoundDevice::GetStreamPositionSamples() const +//-------------------------------------------------- +{ + if(InternalHasGetStreamPosition()) + { + return InternalGetStreamPositionSamples(); + } else + { + Util::lock_guard<Util::mutex> lock(m_SamplesRenderedMutex); + return m_SamplesRendered; + } +} + + CAudioThread::CAudioThread(CSoundDeviceWithThread &SoundDevice) : m_SoundDevice(SoundDevice) //----------------------------------------------------------------------------------- { @@ -564,43 +614,79 @@ // -BOOL EnumerateSoundDevices(UINT nType, UINT nIndex, LPSTR pszDesc, UINT cbSize) -//----------------------------------------------------------------------------- +void SoundDevicesManager::ReEnumerate() +//------------------------------------- { - switch(nType) + m_SoundDevices.clear(); + for(int type = 0; type < SNDDEV_NUM_DEVTYPES; ++type) { - case SNDDEV_WAVEOUT: return CWaveDevice::EnumerateDevices(nIndex, pszDesc, cbSize); + std::vector<SoundDeviceInfo> infos; + switch(type) + { + + case SNDDEV_WAVEOUT: + infos = CWaveDevice::EnumerateDevices(); + break; + #ifndef NO_DSOUND - case SNDDEV_DSOUND: return CDSoundDevice::EnumerateDevices(nIndex, pszDesc, cbSize); -#endif // NO_DIRECTSOUND + case SNDDEV_DSOUND: + infos = CDSoundDevice::EnumerateDevices(); + break; +#endif // NO_DSOUND + #ifndef NO_ASIO - case SNDDEV_ASIO: return CASIODevice::EnumerateDevices(nIndex, pszDesc, cbSize); + case SNDDEV_ASIO: + infos = CASIODevice::EnumerateDevices(); + break; #endif // NO_ASIO + #ifndef NO_PORTAUDIO - case SNDDEV_PORTAUDIO_WASAPI: - case SNDDEV_PORTAUDIO_WDMKS: - case SNDDEV_PORTAUDIO_WMME: - case SNDDEV_PORTAUDIO_DS: - case SNDDEV_PORTAUDIO_ASIO: - return SndDevPortaudioIsInitialized() ? CPortaudioDevice::EnumerateDevices(nIndex, pszDesc, cbSize, CPortaudioDevice::SndDevTypeToHostApi(nType)) : FALSE; - break; -#endif + case SNDDEV_PORTAUDIO_WASAPI: + case SNDDEV_PORTAUDIO_WDMKS: + case SNDDEV_PORTAUDIO_WMME: + case SNDDEV_PORTAUDIO_DS: + case SNDDEV_PORTAUDIO_ASIO: + infos = CPortaudioDevice::EnumerateDevices(type); + break; +#endif // NO_PORTAUDIO + + } + std::copy(infos.begin(), infos.end(), std::back_inserter(m_SoundDevices)); } - return FALSE; } -ISoundDevice *CreateSoundDevice(UINT nType) -//----------------------------------------- +const SoundDeviceInfo * SoundDevicesManager::FindDeviceInfo(UINT type, UINT index) const +//-------------------------------------------------------------------------------------- { - switch(nType) + for(std::vector<SoundDeviceInfo>::const_iterator it = begin(); it != end(); ++it) { - case SNDDEV_WAVEOUT: return new CWaveDevice(); break; + if(it->type == type && it->index == index) + { + return &(*it); + } + } + return nullptr; +} + + +ISoundDevice * SoundDevicesManager::CreateSoundDevice(UINT type, UINT index) +//-------------------------------------------------------------------------- +{ + const SoundDeviceInfo *info = FindDeviceInfo(type, index); + if(!info) + { + return nullptr; + } + ISoundDevice *result = nullptr; + switch(type) + { + case SNDDEV_WAVEOUT: result = new CWaveDevice(); break; #ifndef NO_DSOUND - case SNDDEV_DSOUND: return new CDSoundDevice(); break; -#endif // NO_DIRECTSOUND + case SNDDEV_DSOUND: result = new CDSoundDevice(); break; +#endif // NO_DSOUND #ifndef NO_ASIO - case SNDDEV_ASIO: return new CASIODevice(); break; + case SNDDEV_ASIO: result = new CASIODevice(); break; #endif // NO_ASIO #ifndef NO_PORTAUDIO case SNDDEV_PORTAUDIO_WASAPI: @@ -608,35 +694,32 @@ case SNDDEV_PORTAUDIO_WMME: case SNDDEV_PORTAUDIO_DS: case SNDDEV_PORTAUDIO_ASIO: - return SndDevPortaudioIsInitialized() ? new CPortaudioDevice(CPortaudioDevice::SndDevTypeToHostApi(nType)) : nullptr; + result = SndDevPortaudioIsInitialized() ? new CPortaudioDevice(CPortaudioDevice::SndDevTypeToHostApi(type)) : nullptr; break; -#endif +#endif // NO_PORTAUDIO } - return nullptr; + if(result) + { + result->SetDevice(index, info->internalID); + } + return result; } -BOOL SndDevInitialize() -//--------------------- +SoundDevicesManager::SoundDevicesManager() +//---------------------------------------- { -#ifndef NO_DSOUND - SndDevDSoundInitialize(); -#endif // NO_DSOUND #ifndef NO_PORTAUDIO SndDevPortaudioInitialize(); #endif // NO_PORTAUDIO - return TRUE; + ReEnumerate(); } -BOOL SndDevUninitialize() -//----------------------- +SoundDevicesManager::~SoundDevicesManager() +//----------------------------------------- { #ifndef NO_PORTAUDIO SndDevPortaudioUnnitialize(); #endif // NO_PORTAUDIO -#ifndef NO_DSOUND - SndDevDSoundUninitialize(); -#endif // NO_DSOUND - return TRUE; } Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-09-28 17:58:40 UTC (rev 2789) @@ -11,6 +11,7 @@ #pragma once +#include "../common/mutex.h" #include "../soundlib/SampleFormat.h" #include <vector> @@ -42,9 +43,8 @@ { public: virtual void FillAudioBufferLocked(IFillAudioBuffer &callback) = 0; // take any locks needed while rendering audio and then call FillAudioBuffer - virtual void AudioRead(void* pData, ULONG NumSamples) = 0; - virtual void AudioDone(ULONG NumSamples, ULONG SamplesLatency) = 0; // all in samples - virtual void AudioDone(ULONG NumSamples) = 0; // all in samples + virtual void AudioRead(void* pData, ULONG NumSamples, SampleFormat sampleFormat) = 0; + virtual void AudioDone(ULONG NumSamples, int64 streamPosition) = 0; // in samples }; @@ -110,15 +110,23 @@ }; +class SoundDevicesManager; + + //============================================= class ISoundDevice : protected IFillAudioBuffer //============================================= { + friend class SoundDevicesManager; + private: ISoundSource *m_Source; protected: + UINT m_Index; + std::wstring m_InternalID; + SoundDeviceSettings m_Settings; float m_RealLatencyMS; @@ -126,6 +134,9 @@ bool m_IsPlaying; + mutable Util::mutex m_SamplesRenderedMutex; + int64 m_SamplesRendered; + protected: virtual void FillAudioBuffer() = 0; void SourceFillAudioBufferLocked(); @@ -137,7 +148,14 @@ virtual ~ISoundDevice(); void SetSource(ISoundSource *source) { m_Source = source; } ISoundSource *GetSource() const { return m_Source; } +protected: + void SetDevice(UINT index, const std::wstring &internalID); +public: + UINT GetDeviceIndex() const { return m_Index; } + UINT GetDeviceID() const { return SNDDEV_BUILD_ID(GetDeviceIndex(), GetDeviceType()); } + std::wstring GetDeviceInternalID() const { return m_InternalID; } + public: float GetRealLatencyMS() const { return m_RealLatencyMS; } float GetRealUpdateIntervalMS() const { return m_RealUpdateIntervalMS; } @@ -147,42 +165,78 @@ bool FillWaveFormatExtensible(WAVEFORMATEXTENSIBLE &WaveFormat); protected: - virtual bool InternalOpen(UINT nDevice) = 0; + virtual bool InternalOpen() = 0; virtual void InternalStart() = 0; virtual void InternalStop() = 0; virtual void InternalReset() = 0; virtual bool InternalClose() = 0; + virtual bool InternalHasGetStreamPosition() const { return false; } + virtual int64 InternalGetStreamPositionSamples() const { return 0; } public: - virtual UINT GetDeviceType() = 0; - bool Open(UINT nDevice, const SoundDeviceSettings &settings); // Open a device + virtual UINT GetDeviceType() const = 0; + bool Open(const SoundDeviceSettings &settings); // Open a device bool Close(); // Close the currently open device void Start(); void Stop(); void Reset(); - virtual SampleFormat HasFixedSampleFormat() { return SampleFormatInvalid; } + int64 GetStreamPositionSamples() const; + SampleFormat GetActualSampleFormat() { return IsOpen() ? m_Settings.sampleFormat : SampleFormatInvalid; } virtual bool IsOpen() const = 0; virtual UINT GetNumBuffers() { return 0; } virtual float GetCurrentRealLatencyMS() { return GetRealLatencyMS(); } - virtual bool HasGetStreamPosition() const { return false; } - virtual int64 GetStreamPositionSamples() const { return 0; } - virtual UINT GetCurrentSampleRate(UINT nDevice) { UNREFERENCED_PARAMETER(nDevice); return 0; } - // Return which samplerates are actually supported by the device. Currently only implemented properly for ASIO. - virtual bool CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result) { UNREFERENCED_PARAMETER(nDevice); result.assign(samplerates.size(), true); return true; } ; + virtual UINT GetCurrentSampleRate() { return 0; } + // Return which samplerates are actually supported by the device. Currently only implemented properly for ASIO and PortAudio. + virtual std::vector<uint32> GetSampleRates(const std::vector<uint32> &samplerates) { return samplerates; } }; -//////////////////////////////////////////////////////////////////////////////////// -// -// Global Functions -// +struct SoundDeviceInfo +{ + UINT type; + UINT index; + std::wstring name; + std::wstring internalID; + SoundDeviceInfo() + : type(0) + , index(0) + { + return; + } + SoundDeviceInfo(UINT type, UINT index, const std::wstring &name, const std::wstring &id = std::wstring()) + : type(type) + , index(index) + , name(name) + , internalID(id) + { + return; + } +}; -// Initialization -BOOL SndDevInitialize(); -BOOL SndDevUninitialize(); -// Enumerate devices for a specific type -BOOL EnumerateSoundDevices(UINT nType, UINT nIndex, LPSTR pszDescription, UINT cbSize); -ISoundDevice *CreateSoundDevice(UINT nType); +//======================= +class SoundDevicesManager +//======================= +{ +private: + std::vector<SoundDeviceInfo> m_SoundDevices; -//////////////////////////////////////////////////////////////////////////////////// +public: + SoundDevicesManager(); + ~SoundDevicesManager(); + +public: + + void ReEnumerate(); + + std::vector<SoundDeviceInfo>::const_iterator begin() const { return m_SoundDevices.begin(); } + std::vector<SoundDeviceInfo>::const_iterator end() const { return m_SoundDevices.end(); } + const std::vector<SoundDeviceInfo> & GetDeviceInfos() const { return m_SoundDevices; } + + const SoundDeviceInfo * FindDeviceInfo(UINT type, UINT index) const; + const SoundDeviceInfo * FindDeviceInfo(UINT id) const { return FindDeviceInfo(SNDDEV_GET_TYPE(id), SNDDEV_GET_NUMBER(id)); } + + ISoundDevice * CreateSoundDevice(UINT type, UINT index); + ISoundDevice * CreateSoundDevice(UINT id) { return CreateSoundDevice(SNDDEV_GET_TYPE(id), SNDDEV_GET_NUMBER(id)); } + +}; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -36,91 +36,123 @@ #ifndef NO_ASIO -#define ASIO_MAX_DRIVERS 8 -#define ASIO_MAXDRVNAMELEN 128 +#define ASIO_MAXDRVNAMELEN 1024 -typedef struct _ASIODRIVERDESC -{ - CLSID clsid; - CHAR name[80]; -} ASIODRIVERDESC; - CASIODevice *CASIODevice::gpCurrentAsio = NULL; LONG CASIODevice::gnFillBuffers = 0; int CASIODevice::baseChannel = 0; -static UINT gnNumAsioDrivers = 0; -static BOOL gbAsioEnumerated = FALSE; -static ASIODRIVERDESC gAsioDrivers[ASIO_MAX_DRIVERS]; static DWORD g_dwBuffer = 0; static int g_asio_startcount = 0; -BOOL CASIODevice::EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize) -//-------------------------------------------------------------------------------- +static std::wstring CLSIDToString(CLSID clsid) +//-------------------------------------------- { - if (!gbAsioEnumerated) + std::wstring str; + LPOLESTR tmp = nullptr; + StringFromCLSID(clsid, &tmp); + if(tmp) { - HKEY hkEnum = NULL; + str = tmp; + CoTaskMemFree(tmp); + tmp = nullptr; + } + return str; +} + + +static CLSID StringToCLSID(const std::wstring &str) +//------------------------------------------------- +{ + CLSID clsid = CLSID(); + std::vector<OLECHAR> tmp(str.c_str(), str.c_str() + str.length() + 1); + CLSIDFromString(&tmp[0], &clsid); + return clsid; +} + + +static bool IsCLSID(const std::wstring &str) +{ + CLSID clsid = CLSID(); + std::vector<OLECHAR> tmp(str.c_str(), str.c_str() + str.length() + 1); + return CLSIDFromString(&tmp[0], &clsid) == S_OK; +} + + +std::vector<SoundDeviceInfo> CASIODevice::EnumerateDevices() +//----------------------------------------------------------- +{ + std::vector<SoundDeviceInfo> devices; + + LONG cr; + + HKEY hkEnum = NULL; + cr = RegOpenKey(HKEY_LOCAL_MACHINE, "software\\asio", &hkEnum); + + for(DWORD index = 0; ; ++index) + { + CHAR keyname[ASIO_MAXDRVNAMELEN]; - CHAR s[256]; - WCHAR w[100]; - LONG cr; - DWORD index; + if((cr = RegEnumKey(hkEnum, index, keyname, ASIO_MAXDRVNAMELEN)) != ERROR_SUCCESS) + { + break; + } + #ifdef ASIO_LOG + Log("ASIO: Found \"%s\":\n", keyname); + #endif - cr = RegOpenKey(HKEY_LOCAL_MACHINE, "software\\asio", &hkEnum); - index = 0; - while ((cr == ERROR_SUCCESS) && (gnNumAsioDrivers < ASIO_MAX_DRIVERS)) + HKEY hksub = NULL; + if(RegOpenKeyEx(hkEnum, keyname, 0, KEY_READ, &hksub) != ERROR_SUCCESS) { - if ((cr = RegEnumKey(hkEnum, index, (LPTSTR)keyname, ASIO_MAXDRVNAMELEN)) == ERROR_SUCCESS) + continue; + } + + CHAR description[ASIO_MAXDRVNAMELEN]; + DWORD datatype = REG_SZ; + DWORD datasize = sizeof(description); + if(ERROR_SUCCESS == RegQueryValueEx(hksub, "description", 0, &datatype, (LPBYTE)description, &datasize)) + { + #ifdef ASIO_LOG + Log(" description =\"%s\":\n", description); + #endif + } else + { + mpt::String::Copy(description, keyname); + } + + CHAR s[256]; + datatype = REG_SZ; + datasize = sizeof(s); + if(ERROR_SUCCESS == RegQueryValueEx(hksub, "clsid", 0, &datatype, (LPBYTE)s, &datasize)) + { + const std::wstring internalID = mpt::String::Decode(s, mpt::CharsetLocale); + if(IsCLSID(internalID)) { - #ifdef ASIO_LOG - Log("ASIO: Found \"%s\":\n", keyname); - #endif - HKEY hksub; + CLSID clsid = StringToCLSID(internalID); + #ifdef ASIO_LOG + Log(" clsid=\"%s\"\n", s); + #endif - if ((RegOpenKeyEx(hkEnum, (LPCTSTR)keyname, 0, KEY_READ, &hksub)) == ERROR_SUCCESS) - { - DWORD datatype = REG_SZ; - DWORD datasize = 64; - - if (ERROR_SUCCESS == RegQueryValueEx(hksub, "description", 0, &datatype, (LPBYTE)gAsioDrivers[gnNumAsioDrivers].name, &datasize)) - { - #ifdef ASIO_LOG - Log(" description =\"%s\":\n", gAsioDrivers[gnNumAsioDrivers].name); - #endif - } else - { - lstrcpyn(gAsioDrivers[gnNumAsioDrivers].name, keyname, 64); - } - datatype = REG_SZ; - datasize = sizeof(s); - if (ERROR_SUCCESS == RegQueryValueEx(hksub, "clsid", 0, &datatype, (LPBYTE)s, &datasize)) - { - MultiByteToWideChar(CP_ACP, 0, (LPCSTR)s,-1,(LPWSTR)w,100); - if (CLSIDFromString((LPOLESTR)w, (LPCLSID)&gAsioDrivers[gnNumAsioDrivers].clsid) == S_OK) - { - #ifdef ASIO_LOG - Log(" clsid=\"%s\"\n", s); - #endif - gnNumAsioDrivers++; - } - } - RegCloseKey(hksub); - } + // everything ok + devices.push_back(SoundDeviceInfo(SNDDEV_ASIO, devices.size(), mpt::String::Decode(description, mpt::CharsetLocale), internalID)); + } - index++; } - if (hkEnum) RegCloseKey(hkEnum); - gbAsioEnumerated = TRUE; + + RegCloseKey(hksub); + hksub = NULL; + } - if (nIndex < gnNumAsioDrivers) + + if(hkEnum) { - if (pszDescription) lstrcpyn(pszDescription, gAsioDrivers[nIndex].name, cbSize); - return TRUE; + RegCloseKey(hkEnum); + hkEnum = NULL; } - return FALSE; + + return devices; } @@ -128,7 +160,6 @@ //------------------------ { m_pAsioDrv = NULL; - m_nChannels = 0; m_nAsioBufferLen = 0; m_nAsioSampleSize = 0; m_Float = false; @@ -136,7 +167,6 @@ m_Callbacks.sampleRateDidChange = SampleRateDidChange; m_Callbacks.asioMessage = AsioMessage; m_Callbacks.bufferSwitchTimeInfo = BufferSwitchTimeInfo; - m_nCurrentDevice = (ULONG)-1; m_bMixRunning = FALSE; InterlockedExchange(&m_RenderSilence, 0); InterlockedExchange(&m_RenderingSilence, 0); @@ -151,23 +181,18 @@ } -bool CASIODevice::InternalOpen(UINT nDevice) -//------------------------------------------ +bool CASIODevice::InternalOpen() +//------------------------------ { + bool bOk = false; if (IsOpen()) Close(); - if (!gbAsioEnumerated) EnumerateDevices(nDevice, NULL, 0); - if (nDevice >= gnNumAsioDrivers) return false; - if (nDevice != m_nCurrentDevice) - { - m_nCurrentDevice = nDevice; - } #ifdef ASIO_LOG Log("CASIODevice::Open(%d:\"%s\"): %d-bit, %d channels, %dHz\n", - nDevice, gAsioDrivers[nDevice].name, (int)m_Settings.sampleFormat.GetBitsPerSample(), m_Settings.Channels, m_Settings.Samplerate); + GetDeviceIndex(), mpt::String::Encode(GetDeviceInternalID(), mpt::CharsetLocale).c_str(), (int)m_Settings.sampleFormat.GetBitsPerSample(), m_Settings.Channels, m_Settings.Samplerate); #endif - OpenDevice(nDevice); + OpenDevice(); if (IsOpen()) { @@ -178,11 +203,6 @@ { goto abort; } - if((m_Settings.sampleFormat != SampleFormatInt32) && (m_Settings.sampleFormat != SampleFormatFloat32)) - { - goto abort; - } - m_nChannels = m_Settings.Channels; m_pAsioDrv->getChannels(&nInputChannels, &nOutputChannels); #ifdef ASIO_LOG Log(" getChannels: %d inputs, %d outputs\n", nInputChannels, nOutputChannels); @@ -249,6 +269,7 @@ break; } } + m_Settings.sampleFormat = m_Float ? SampleFormatFloat32 : SampleFormatInt32; m_pAsioDrv->getBufferSize(&minSize, &maxSize, &preferredSize, &granularity); #ifdef ASIO_LOG Log(" getBufferSize(): minSize=%d maxSize=%d preferredSize=%d granularity=%d\n", @@ -287,9 +308,9 @@ #ifdef ASIO_LOG Log(" Using buffersize=%d samples\n", m_nAsioBufferLen); #endif - if (m_pAsioDrv->createBuffers(m_BufferInfo, m_nChannels, m_nAsioBufferLen, &m_Callbacks) == ASE_OK) + if (m_pAsioDrv->createBuffers(m_BufferInfo, m_Settings.Channels, m_nAsioBufferLen, &m_Callbacks) == ASE_OK) { - for (UINT iInit=0; iInit<m_nChannels; iInit++) + for (UINT iInit=0; iInit<m_Settings.Channels; iInit++) { if (m_BufferInfo[iInit].buffers[0]) { @@ -462,15 +483,15 @@ } -void CASIODevice::OpenDevice(UINT nDevice) -//---------------------------------------- +void CASIODevice::OpenDevice() +//---------------------------- { if (IsOpen()) { return; } - CLSID clsid = gAsioDrivers[nDevice].clsid; + CLSID clsid = StringToCLSID(GetDeviceInternalID()); if (CoCreateInstance(clsid,0,CLSCTX_INPROC_SERVER, clsid, (void **)&m_pAsioDrv) == S_OK) { m_pAsioDrv->init((void *)m_Settings.hWnd); @@ -517,7 +538,8 @@ { bool rendersilence = (InterlockedExchangeAdd(&m_RenderSilence, 0) == 1); - std::size_t sampleFrameSize = m_nChannels * sizeof(int32); + const int channels = m_Settings.Channels; + std::size_t sampleFrameSize = channels * sizeof(int32); const std::size_t sampleFramesGoal = m_nAsioBufferLen; std::size_t sampleFramesToRender = sampleFramesGoal; std::size_t sampleFramesRendered = 0; @@ -535,7 +557,7 @@ { SourceAudioRead(m_FrameBuffer, countChunk); } - for(int channel = 0; channel < (int)m_nChannels; ++channel) + for(int channel = 0; channel < channels; ++channel) { const int32 *src = m_FrameBuffer; const float *srcFloat = reinterpret_cast<const float*>(m_FrameBuffer); @@ -544,11 +566,11 @@ { case ASIOSTFloat32MSB: case ASIOSTFloat32LSB: - CopyInterleavedToChannel<SC::Convert<float, float> >(reinterpret_cast<float*>(dst), srcFloat, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<float, float> >(reinterpret_cast<float*>(dst), srcFloat, channels, countChunk, channel); break; case ASIOSTFloat64MSB: case ASIOSTFloat64LSB: - CopyInterleavedToChannel<SC::Convert<double, float> >(reinterpret_cast<double*>(dst), srcFloat, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<double, float> >(reinterpret_cast<double*>(dst), srcFloat, channels, countChunk, channel); break; default: ASSERT(false); @@ -557,39 +579,39 @@ { case ASIOSTInt16MSB: case ASIOSTInt16LSB: - CopyInterleavedToChannel<SC::Convert<int16, int32> >(reinterpret_cast<int16*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<int16, int32> >(reinterpret_cast<int16*>(dst), src, channels, countChunk, channel); break; case ASIOSTInt24MSB: case ASIOSTInt24LSB: - CopyInterleavedToChannel<SC::Convert<int24, int32> >(reinterpret_cast<int24*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<int24, int32> >(reinterpret_cast<int24*>(dst), src, channels, countChunk, channel); break; case ASIOSTInt32MSB: case ASIOSTInt32LSB: - CopyInterleavedToChannel<SC::Convert<int32, int32> >(reinterpret_cast<int32*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<int32, int32> >(reinterpret_cast<int32*>(dst), src, channels, countChunk, channel); break; case ASIOSTFloat32MSB: case ASIOSTFloat32LSB: - CopyInterleavedToChannel<SC::Convert<float, int32> >(reinterpret_cast<float*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<float, int32> >(reinterpret_cast<float*>(dst), src, channels, countChunk, channel); break; case ASIOSTFloat64MSB: case ASIOSTFloat64LSB: - CopyInterleavedToChannel<SC::Convert<double, int32> >(reinterpret_cast<double*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::Convert<double, int32> >(reinterpret_cast<double*>(dst), src, channels, countChunk, channel); break; case ASIOSTInt32MSB16: case ASIOSTInt32LSB16: - CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 16> >(reinterpret_cast<int32*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 16> >(reinterpret_cast<int32*>(dst), src, channels, countChunk, channel); break; case ASIOSTInt32MSB18: case ASIOSTInt32LSB18: - CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 14> >(reinterpret_cast<int32*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 14> >(reinterpret_cast<int32*>(dst), src, channels, countChunk, channel); break; case ASIOSTInt32MSB20: case ASIOSTInt32LSB20: - CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 12> >(reinterpret_cast<int32*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 12> >(reinterpret_cast<int32*>(dst), src, channels, countChunk, channel); break; case ASIOSTInt32MSB24: case ASIOSTInt32LSB24: - CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 8> >(reinterpret_cast<int32*>(dst), src, m_nChannels, countChunk, channel); + CopyInterleavedToChannel<SC::ConvertShift<int32, int32, 8> >(reinterpret_cast<int32*>(dst), src, channels, countChunk, channel); break; default: ASSERT(false); @@ -702,27 +724,25 @@ } -bool CASIODevice::CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result) -//-------------------------------------------------------------------------------------------------------------- +std::vector<uint32> CASIODevice::GetSampleRates(const std::vector<uint32> &samplerates) +//------------------------------------------------------------------------------------- { + std::vector<uint32> results; const bool wasOpen = (m_pAsioDrv != NULL); if(!wasOpen) { - OpenDevice(nDevice); + OpenDevice(); if(m_pAsioDrv == NULL) { - return false; + return results; } } - bool foundSomething = false; // is at least one sample rate supported by the device? - result.clear(); for(size_t i = 0; i < samplerates.size(); i++) { - result.push_back((m_pAsioDrv->canSampleRate((ASIOSampleRate)samplerates[i]) == ASE_OK)); - if(result.back()) + if(m_pAsioDrv->canSampleRate((ASIOSampleRate)samplerates[i]) == ASE_OK) { - foundSomething = true; + results.push_back(samplerates[i]); } } @@ -731,18 +751,18 @@ CloseDevice(); } - return foundSomething; + return results; } // If the device is open, this returns the current sample rate. If it's not open, it returns some sample rate supported by the device. -UINT CASIODevice::GetCurrentSampleRate(UINT nDevice) -//-------------------------------------------------- +UINT CASIODevice::GetCurrentSampleRate() +//-------------------------------------- { const bool wasOpen = (m_pAsioDrv != NULL); if(!wasOpen) { - OpenDevice(nDevice); + OpenDevice(); if(m_pAsioDrv == NULL) { return 0; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2013-09-28 17:58:40 UTC (rev 2789) @@ -33,11 +33,11 @@ enum { ASIO_BLOCK_LEN=1024 }; protected: IASIO *m_pAsioDrv; - UINT m_nChannels, m_nAsioBufferLen, m_nAsioSampleSize; + UINT m_nAsioBufferLen; + UINT m_nAsioSampleSize; bool m_Float; BOOL m_bMixRunning; BOOL m_bPostOutput; - UINT m_nCurrentDevice; LONG m_RenderSilence; LONG m_RenderingSilence; ASIOCallbacks m_Callbacks; @@ -56,26 +56,25 @@ ~CASIODevice(); public: - UINT GetDeviceType() { return SNDDEV_ASIO; } - bool InternalOpen(UINT nDevice); + UINT GetDeviceType() const { return SNDDEV_ASIO; } + bool InternalOpen(); bool InternalClose(); void FillAudioBuffer(); void InternalReset(); void InternalStart(); void InternalStop(); bool IsOpen() const { return (m_pAsioDrv != NULL); } - SampleFormat HasFixedSampleFormat() { return m_Float ? SampleFormatFloat32 : SampleFormatInt32; } UINT GetNumBuffers() { return 2; } float GetCurrentRealLatencyMS() { return m_nAsioBufferLen * 2 * 1000.0f / m_Settings.Samplerate; } - bool CanSampleRate(UINT nDevice, const std::vector<uint32> &samplerates, std::vector<bool> &result); - UINT GetCurrentSampleRate(UINT nDevice); + std::vector<uint32> GetSampleRates(const std::vector<uint32> &samplerates); + UINT GetCurrentSampleRate(); public: - static BOOL EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize); + static std::vector<SoundDeviceInfo> EnumerateDevices(); protected: - void OpenDevice(UINT nDevice); + void OpenDevice(); void CloseDevice(); protected: Modified: trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2013-09-28 17:58:40 UTC (rev 2789) @@ -17,6 +17,7 @@ #include "SoundDeviceDirectSound.h" #include "../common/misc_util.h" +#include "../common/StringFixer.h" //////////////////////////////////////////////////////////////////////////////////// @@ -26,48 +27,60 @@ #ifndef NO_DSOUND -#ifndef DSBCAPS_GLOBALFOCUS -#define DSBCAPS_GLOBALFOCUS 0x8000 -#endif -#define MAX_DSOUND_DEVICES 16 +static std::wstring GuidToString(GUID guid) +//----------------------------------------- +{ + std::wstring str; + LPOLESTR tmp = nullptr; + StringFromIID(guid, &tmp); + if(tmp) + { + str = tmp; + CoTaskMemFree(tmp); + tmp = nullptr; + } + return str; +} -static BOOL gbDSoundEnumerated = FALSE; -static UINT gnDSoundDevices = 0; -static GUID *glpDSoundGUID[MAX_DSOUND_DEVICES]; -static CHAR gszDSoundDrvNames[MAX_DSOUND_DEVICES][64]; +static GUID StringToGuid(const std::wstring &str) +//----------------------------------------------- +{ + GUID guid = GUID(); + std::vector<OLECHAR> tmp(str.c_str(), str.c_str() + str.length() + 1); + IIDFromString(&tmp[0], &guid); + return guid; +} -static BOOL WINAPI DSEnumCallback(GUID * lpGuid, LPCSTR lpstrDescription, LPCSTR, LPVOID) -//--------------------------------------------------------------------------------------- + +static BOOL WINAPI DSEnumCallbackW(GUID * lpGuid, LPCWSTR lpstrDescription, LPCWSTR, LPVOID lpContext) +//---------------------------------------------------------------------------------------------------- { - if (gnDSoundDevices >= MAX_DSOUND_DEVICES) return FALSE; - if ((lpstrDescription)) + std::vector<SoundDeviceInfo> &devices = *(std::vector<SoundDeviceInfo>*)lpContext; + if(!lpstrDescription) { - if (lpGuid) - { - //if ((gnDSoundDevices) && (!glpDSoundGUID[gnDSoundDevices-1])) gnDSoundDevices--; - glpDSoundGUID[gnDSoundDevices] = new GUID; - *glpDSoundGUID[gnDSoundDevices] = *lpGuid; - } else glpDSoundGUID[gnDSoundDevices] = NULL; - lstrcpyn(gszDSoundDrvNames[gnDSoundDevices], lpstrDescription, 64); - gnDSoundDevices++; - gbDSoundEnumerated = TRUE; + return TRUE; } + SoundDeviceInfo info; + info.type = SNDDEV_DSOUND; + info.index = devices.size(); + info.name = lpstrDescription; + if(lpGuid) + { + info.internalID = GuidToString(*lpGuid); + } + devices.push_back(info); return TRUE; } -BOOL CDSoundDevice::EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize) -//---------------------------------------------------------------------------------- +std::vector<SoundDeviceInfo> CDSoundDevice::EnumerateDevices() +//------------------------------------------------------------ { - if(!gbDSoundEnumerated) - { - DirectSoundEnumerate(DSEnumCallback, NULL); - } - if (nIndex >= gnDSoundDevices) return FALSE; - lstrcpyn(pszDescription, gszDSoundDrvNames[nIndex], cbSize); - return TRUE; + std::vector<SoundDeviceInfo> devices; + DirectSoundEnumerateW(DSEnumCallbackW, &devices); + return devices; } @@ -91,8 +104,8 @@ } -bool CDSoundDevice::InternalOpen(UINT nDevice) -//-------------------------------------------- +bool CDSoundDevice::InternalOpen() +//-------------------------------- { WAVEFORMATEXTENSIBLE wfext; if(!FillWaveFormatExtensible(wfext)) return false; @@ -103,9 +116,9 @@ UINT nPriorityLevel = (m_Settings.fulCfgOptions & SNDDEV_OPTIONS_EXCLUSIVE) ? DSSCL_WRITEPRIMARY : DSSCL_PRIORITY; if(m_piDS) return true; - if(!gbDSoundEnumerated) DirectSoundEnumerate(DSEnumCallback, NULL); - if(nDevice >= gnDSoundDevices) return false; - if(DirectSoundCreate(glpDSoundGUID[nDevice], &m_piDS, NULL) != DS_OK) return false; + const std::wstring internalID = GetDeviceInternalID(); + GUID guid = internalID.empty() ? GUID() : StringToGuid(internalID); + if(DirectSoundCreate(internalID.empty() ? NULL : &guid, &m_piDS, NULL) != DS_OK) return false; if(!m_piDS) return false; m_piDS->SetCooperativeLevel(m_Settings.hWnd, nPriorityLevel); m_bMixRunning = FALSE; @@ -345,30 +358,5 @@ } -BOOL SndDevDSoundInitialize() -//--------------------------- -{ - MemsetZero(glpDSoundGUID); - return TRUE; -} - - -BOOL SndDevDSoundUninitialize() -//----------------------------- -{ - for (UINT i=0; i<MAX_DSOUND_DEVICES; i++) - { - if (glpDSoundGUID[i]) - { - delete glpDSoundGUID[i]; - glpDSoundGUID[i] = NULL; - } - } - gbDSoundEnumerated = FALSE; - gnDSoundDevices = 0; - return TRUE; -} - - #endif // NO_DIRECTSOUND Modified: trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h 2013-09-28 05:54:38 UTC (rev 2788) +++ trunk/OpenMPT/sounddev/SoundDeviceDirectSound.h 2013-09-28 17:58:40 UTC (rev 2789) @@ -45,8 +45,8 @@ ~CDSoundDevice(); public: - UINT GetDeviceType() { return SNDDEV_DSOUND; } - bool InternalOpen(UINT nDevice); + UINT GetDeviceType() const { return SNDDEV_DSOUND; } + bool Interna... [truncated message content] |
From: <sag...@us...> - 2013-09-29 00:12:03
|
Revision: 2795 http://sourceforge.net/p/modplug/code/2795 Author: saga-games Date: 2013-09-29 00:11:57 +0000 (Sun, 29 Sep 2013) Log Message: ----------- [Fix] VST: Send SysEx messages to plugins as SysEx instead of short messages. This fixes SysEx messages sent through OpenMPT's MIDI Input/Output plugin, as it didn't ignore the fourth byte of short messages. Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/plugins/PlugInterface.h trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-09-28 21:36:13 UTC (rev 2794) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-09-29 00:11:57 UTC (rev 2795) @@ -118,10 +118,10 @@ VSTPluginLib *p = m_pVstHead; while (p) { - if (p == pLib) return TRUE; + if (p == pLib) return true; p = p->pNext; } - return FALSE; + return false; } @@ -201,7 +201,7 @@ if(error != ERROR_MOD_NOT_FOUND) // "File not found errors" are annoying. { TCHAR szBuf[256]; - wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", error, GetErrorMessage(error).c_str()); + wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %x: %s", error, GetErrorMessage(error).c_str()); Reporting::Error(szBuf, "DEBUG: Error when loading plugin dll"); } #endif //_DEBUG @@ -2082,7 +2082,6 @@ Bypass(); CString processMethod = (m_Effect.flags & effFlagsCanReplacing) ? "processReplacing" : "process"; CVstPluginManager::ReportPlugException("The plugin %s threw an exception in %s. It has automatically been set to \"Bypass\".", m_pMixStruct->GetName(), processMethod); - vstEvents.Clear(); } ASSERT(outputBuffers != nullptr); @@ -2255,15 +2254,15 @@ } -bool CVstPlugin::MidiSend(DWORD dwMidiCode) -//----------------------------------------- +bool CVstPlugin::MidiSend(uint32 dwMidiCode) +//------------------------------------------ { // Note-Offs go at the start of the queue. bool insertAtFront = (MIDIEvents::GetTypeFromEvent(dwMidiCode) == MIDIEvents::evNoteOff); VstMidiEvent event; event.type = kVstMidiType; - event.byteSize = sizeof(VstMidiEvent); + event.byteSize = sizeof(event); event.deltaFrames = 0; event.flags = 0; event.noteLength = 0; @@ -2272,7 +2271,7 @@ event.noteOffVelocity = 0; event.reserved1 = 0; event.reserved2 = 0; - *(DWORD *)event.midiData = dwMidiCode; + memcpy(event.midiData, &dwMidiCode, 4); #ifdef VST_LOG Log("Sending Midi %02X.%02X.%02X\n", event.midiData[0]&0xff, event.midiData[1]&0xff, event.midiData[2]&0xff); @@ -2282,6 +2281,23 @@ } +bool CVstPlugin::MidiSysexSend(const char *message, uint32 length) +//---------------------------------------------------------------- +{ + VstMidiSysexEvent event; + event.type = kVstSysExType; + event.byteSize = sizeof(event); + event.deltaFrames = 0; + event.flags = 0; + event.dumpBytes = length; + event.resvd1 = 0; + event.sysexDump = const_cast<char *>(message); // We will make our own copy in VstEventQueue::Enqueue + event.resvd2 = 0; + + return vstEvents.Enqueue(reinterpret_cast<VstEvent *>(&event)); +} + + void CVstPlugin::HardAllNotesOff() //-------------------------------- { @@ -2504,7 +2520,7 @@ note -= NOTE_MIN; // Reset pitch bend on each new note, tracker style. - // This is done if the pitch wheel has been moved or there was a vibrato on the previous row (in which case the highest bit of the pitch bend memory is set) + // This is done if the pitch wheel has been moved or there was a vibrato on the previous row (in which case the "vstVibratoFlag" bit of the pitch bend memory is set) if(m_MidiCh[nMidiCh].midiPitchBendPos != EncodePitchBendParam(MIDIEvents::pitchBendCentre)) { MidiPitchBend(nMidiCh, EncodePitchBendParam(MIDIEvents::pitchBendCentre)); Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2013-09-28 21:36:13 UTC (rev 2794) +++ trunk/OpenMPT/mptrack/Vstplug.h 2013-09-29 00:11:57 UTC (rev 2795) @@ -240,7 +240,8 @@ void RestoreAllParameters(long nProg=-1); //rewbs.plugDefaultProgram - added param void RecalculateGain(); void Process(float *pOutL, float *pOutR, size_t nSamples); - bool MidiSend(DWORD dwMidiCode); + bool MidiSend(uint32 dwMidiCode); + bool MidiSysexSend(const char *message, uint32 length); void MidiCC(uint8 nMidiCh, MIDIEvents::MidiCC nController, uint8 nParam, CHANNELINDEX trackChannel); void MidiPitchBend(uint8 nMidiCh, int32 increment, int8 pwd); void MidiVibrato(uint8 nMidiCh, int32 depth, int8 pwd); Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-09-28 21:36:13 UTC (rev 2794) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-09-29 00:11:57 UTC (rev 2795) @@ -3976,7 +3976,7 @@ pChn->nCutOff = param; } else { - pChn->nCutOff = (BYTE)CalculateSmoothParamChange((float)pChn->nCutOff, (float)param); + pChn->nCutOff = (uint8)CalculateSmoothParamChange((float)pChn->nCutOff, (float)param); } pChn->nRestoreCutoffOnNewNote = 0; } @@ -4000,7 +4000,7 @@ pChn->nResonance = param; } else { - pChn->nResonance = (BYTE)CalculateSmoothParamChange((float)pChn->nResonance, (float)param); + pChn->nResonance = (uint8)CalculateSmoothParamChange((float)pChn->nResonance, (float)param); } } @@ -4080,12 +4080,17 @@ IMixPlugin *pPlugin = m_MixPlugins[nPlug - 1].pMixPlugin; if ((pPlugin) && (m_MixPlugins[nPlug - 1].pMixState)) { - // currently, we don't support sending long MIDI messages in one go... split it up - for(size_t pos = 0; pos < macroLen; pos += 3) + if(macro[0] == 0xF0) { - DWORD curData = 0; - memcpy(&curData, macro + pos, std::min<size_t>(3, macroLen - pos)); - pPlugin->MidiSend(curData); + pPlugin->MidiSysexSend(reinterpret_cast<const char *>(macro), macroLen); + } else + { + for(size_t pos = 0; pos < macroLen; pos += 3) + { + uint32 curData = 0; + memcpy(&curData, macro + pos, std::min<size_t>(3, macroLen - pos)); + pPlugin->MidiSend(curData); + } } } } Modified: trunk/OpenMPT/soundlib/plugins/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2013-09-28 21:36:13 UTC (rev 2794) +++ trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2013-09-29 00:11:57 UTC (rev 2795) @@ -40,7 +40,8 @@ virtual void SaveAllParameters() = 0; virtual void RestoreAllParameters(long nProg=-1) = 0; //rewbs.plugDefaultProgram: added param virtual void Process(float *pOutL, float *pOutR, size_t nSamples) = 0; - virtual bool MidiSend(DWORD dwMidiCode) = 0; + virtual bool MidiSend(uint32 dwMidiCode) = 0; + virtual bool MidiSysexSend(const char *message, uint32 length) = 0; virtual void MidiCC(uint8 nMidiCh, MIDIEvents::MidiCC nController, uint8 nParam, CHANNELINDEX trackChannel) = 0; virtual void MidiPitchBend(uint8 nMidiCh, int32 increment, int8 pwd) = 0; virtual void MidiVibrato(uint8 nMidiCh, int32 depth, int8 pwd) = 0; @@ -150,7 +151,7 @@ { IMixPlugin *pMixPlugin; SNDMIXPLUGINSTATE *pMixState; - ULONG nPluginDataSize; + uint32 nPluginDataSize; char *pPluginData; SNDMIXPLUGININFO Info; float fDryRatio; Modified: trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h 2013-09-28 21:36:13 UTC (rev 2794) +++ trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h 2013-09-29 00:11:57 UTC (rev 2795) @@ -87,6 +87,18 @@ BiggestVstEvent copyEvent; memcpy(©Event, event, std::min(size_t(event->byteSize), sizeof(copyEvent))); + if(copyEvent.type == kVstSysExType) + { + // SysEx messages need to be copied, as the space used for the dump might be freed in the meantime. + VstMidiSysexEvent *e = reinterpret_cast<VstMidiSysexEvent *>(©Event); + e->sysexDump = new (std::nothrow) char[e->dumpBytes]; + if(e->sysexDump == nullptr) + { + return false; + } + memcpy(e->sysexDump, reinterpret_cast<const VstMidiSysexEvent *>(event)->sysexDump, e->dumpBytes); + } + Util::lock_guard<Util::mutex> lock(criticalSection); if(insertFront) { @@ -116,6 +128,14 @@ Util::lock_guard<Util::mutex> lock(criticalSection); if(numEvents) { + // Release temporarily allocated buffer for SysEx messages + for(VstInt32 i = 0; i < numEvents; i++) + { + if(events[i]->type == kVstSysExType) + { + delete[] reinterpret_cast<VstMidiSysexEvent *>(events[i])->sysexDump; + } + } eventQueue.erase(eventQueue.begin(), eventQueue.begin() + numEvents); numEvents = 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-09-29 00:30:32
|
Revision: 2798 http://sourceforge.net/p/modplug/code/2798 Author: saga-games Date: 2013-09-29 00:30:26 +0000 (Sun, 29 Sep 2013) Log Message: ----------- [Ref] Small cleanups Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_flt.cpp trunk/OpenMPT/unarchiver/ungzip.cpp trunk/OpenMPT/unarchiver/unlha.cpp trunk/OpenMPT/unarchiver/unlha.h Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_flt.cpp 2013-09-29 00:29:55 UTC (rev 2797) +++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2013-09-29 00:30:26 UTC (rev 2798) @@ -48,9 +48,9 @@ if(!GetModFlag(MSF_OLDVOLSWING)) { - pChn->nCutOff = (BYTE)cutoff; + pChn->nCutOff = (uint8)cutoff; pChn->nCutSwing = 0; - pChn->nResonance = (BYTE)resonance; + pChn->nResonance = (uint8)resonance; pChn->nResSwing = 0; } @@ -62,7 +62,7 @@ // Filtering is only ever done in IT if either cutoff is not full or if resonance is set. if(IsCompatibleMode(TRK_IMPULSETRACKER) && resonance == 0 && computedCutoff >= 254) { - if(pChn->rowCommand.IsNote() && !(pChn->dwFlags & CHN_PORTAMENTO) && !pChn->nMasterChn && m_SongFlags[SONG_FIRSTTICK]) + if(pChn->rowCommand.IsNote() && !pChn->dwFlags[CHN_PORTAMENTO] && !pChn->nMasterChn && m_SongFlags[SONG_FIRSTTICK]) { // Z7F next to a note disables the filter, however in other cases this should not happen. // Test cases: filter-reset.it, filter-reset-carry.it, filter-nna.it Modified: trunk/OpenMPT/unarchiver/ungzip.cpp =================================================================== --- trunk/OpenMPT/unarchiver/ungzip.cpp 2013-09-29 00:29:55 UTC (rev 2797) +++ trunk/OpenMPT/unarchiver/ungzip.cpp 2013-09-29 00:30:26 UTC (rev 2798) @@ -33,13 +33,13 @@ bool CGzipArchive::IsArchive() const //---------------------------------- { - if(inFile.GetLength() <= (sizeof(GZheader) + sizeof(GZtrailer))) + // Check header data + file size + if(header.magic1 != GZ_HMAGIC1 || header.magic2 != GZ_HMAGIC2 || header.method != GZ_HMDEFLATE || (header.flags & GZ_FRESERVED) != 0 + || inFile.GetLength() <= sizeof(GZheader) + sizeof(GZtrailer)) { return false; } - - // Check header data - return (header.magic1 == GZ_HMAGIC1 && header.magic2 == GZ_HMAGIC2 && header.method == GZ_HMDEFLATE && (header.flags & GZ_FRESERVED) == 0); + return true; } Modified: trunk/OpenMPT/unarchiver/unlha.cpp =================================================================== --- trunk/OpenMPT/unarchiver/unlha.cpp 2013-09-29 00:29:55 UTC (rev 2797) +++ trunk/OpenMPT/unarchiver/unlha.cpp 2013-09-29 00:30:26 UTC (rev 2798) @@ -1,8 +1,14 @@ +/* + * unlha.cpp + * --------- + * Purpose: Implementation file for extracting modules from .lha archives, making use of lhasa + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ #include "stdafx.h" - #include "unlha.h" - #include "lhasa.h" @@ -28,19 +34,21 @@ return 0; } -static void LHAcloseFileReader(void * /*handle*/ ) +static void LHAcloseFileReader(void * /*handle*/) { - //FileReader *f = reinterpret_cast<FileReader*>(handle); } -static LHAInputStreamType vtable = { +static LHAInputStreamType vtable = +{ LHAreadFileReader, LHAskipFileReader, LHAcloseFileReader }; -static inline std::string get_extension( std::string filename ) { - if ( filename.find_last_of( "." ) != std::string::npos ) { +static inline std::string get_extension( std::string filename ) +{ + if ( filename.find_last_of( "." ) != std::string::npos ) + { return filename.substr( filename.find_last_of( "." ) + 1 ); } return ""; Modified: trunk/OpenMPT/unarchiver/unlha.h =================================================================== --- trunk/OpenMPT/unarchiver/unlha.h 2013-09-29 00:29:55 UTC (rev 2797) +++ trunk/OpenMPT/unarchiver/unlha.h 2013-09-29 00:30:26 UTC (rev 2798) @@ -1,6 +1,13 @@ +/* + * unlha.h + * ------- + * Purpose: Header file for .lha loader + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ -#ifndef UNLHA32_LIB_H -#define UNLHA32_LIB_H +#pragma once #include "../soundlib/FileReader.h" @@ -27,5 +34,3 @@ bool ExtractFile(); bool ExtractFile(const std::vector<const char *> &extensions); }; - -#endif // UNLHA32_LIB_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-09-29 21:53:30
|
Revision: 2811 http://sourceforge.net/p/modplug/code/2811 Author: manxorist Date: 2013-09-29 21:53:24 +0000 (Sun, 29 Sep 2013) Log Message: ----------- [Ref] Rename DEPRECATED to MPT_DEPRECATED. Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/FileReader.h Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-09-29 21:48:26 UTC (rev 2810) +++ trunk/OpenMPT/common/typedefs.h 2013-09-29 21:53:24 UTC (rev 2811) @@ -91,13 +91,13 @@ // Some functions might be deprecated although they are still in use. -// Tag them with "DEPRECATED". +// Tag them with "MPT_DEPRECATED". #if MPT_COMPILER_MSVC -#define DEPRECATED __declspec(deprecated) +#define MPT_DEPRECATED __declspec(deprecated) #elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG -#define DEPRECATED __attribute__((deprecated)) +#define MPT_DEPRECATED __attribute__((deprecated)) #else -#define DEPRECATED +#define MPT_DEPRECATED #endif Modified: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h 2013-09-29 21:48:26 UTC (rev 2810) +++ trunk/OpenMPT/soundlib/FileReader.h 2013-09-29 21:53:24 UTC (rev 2811) @@ -26,7 +26,7 @@ // change to show warnings for functions which trigger pre-caching the whole file for unseekable streams -//#define FILEREADER_DEPRECATED DEPRECATED +//#define FILEREADER_DEPRECATED MPT_DEPRECATED #define FILEREADER_DEPRECATED This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-10-04 22:59:07
|
Revision: 2823 http://sourceforge.net/p/modplug/code/2823 Author: manxorist Date: 2013-10-04 22:58:58 +0000 (Fri, 04 Oct 2013) Log Message: ----------- [Mod] Split mod container type from mod type and expose the container type (if available) in libopenmpt, xmp-openmpt and openmpt123. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/soundlib/Load_gdm.cpp trunk/OpenMPT/soundlib/Load_mo3.cpp trunk/OpenMPT/soundlib/Load_umx.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Tables.cpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -540,6 +540,8 @@ std::vector<std::string> retval; retval.push_back("type"); retval.push_back("type_long"); + retval.push_back("container"); + retval.push_back("container_long"); retval.push_back("tracker"); retval.push_back("author"); retval.push_back("title"); @@ -552,6 +554,10 @@ return CSoundFile::ModTypeToString( m_sndFile->GetType() ); } else if ( key == std::string("type_long") ) { return CSoundFile::ModTypeToTracker( m_sndFile->GetType() ); + } else if ( key == std::string("container") ) { + return CSoundFile::ModContainerTypeToString( m_sndFile->GetContainerType() ); + } else if ( key == std::string("container_long") ) { + return CSoundFile::ModContainerTypeToTracker( m_sndFile->GetContainerType() ); } else if ( key == std::string("tracker") ) { return m_sndFile->madeWithTracker; } else if ( key == std::string("title") ) { Modified: trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/libopenmpt/libopenmpt_xmplay.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -660,7 +660,11 @@ std::ostringstream str; str << "\r" - << "Format" << "\t" << self->mod->get_metadata("type") << " (" << self->mod->get_metadata("type_long") << ")" << "\r" + << "Format" << "\t" << self->mod->get_metadata("type") << " (" << self->mod->get_metadata("type_long") << ")" << "\r"; + if ( !self->mod->get_metadata("container").empty() ) { + str << "Container" << "\t" << self->mod->get_metadata("container") << " (" << self->mod->get_metadata("container_long") << ")" << "\r"; + } + str << "Channels" << "\t" << self->mod->get_num_channels() << "\r" << "Orders" << "\t" << self->mod->get_num_orders() << "\r" << "Patterns" << "\t" << self->mod->get_num_patterns() << "\r" Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -1027,6 +1027,7 @@ if ( flags.show_details ) { log << "Filename...: " << get_filename( filename ) << std::endl; log << "Size.......: " << bytes_to_string( filesize ) << std::endl; + log << "Container..: " << ( mod.get_metadata( "container" ).empty() ? std::string("none") : ( mod.get_metadata( "container" ) + " (" + mod.get_metadata( "container_long" ) + ")" ) ) << std::endl; log << "Type.......: " << mod.get_metadata( "type" ) << " (" << mod.get_metadata( "type_long" ) << ")" << std::endl; log << "Tracker....: " << mod.get_metadata( "tracker" ) << std::endl; } Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_gdm.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -158,6 +158,7 @@ InitializeGlobals(); m_nType = gdmFormatOrigin[fileHeader.originalFormat]; + m_ContainerType = MOD_CONTAINERTYPE_GDM; madeWithTracker = mpt::String::Format("BWSB 2GDM %d.%d (converted from %s)", fileHeader.trackerMajorVer, fileHeader.formatMinorVer, ModTypeToTracker(GetType()).c_str()); // Song name Modified: trunk/OpenMPT/soundlib/Load_mo3.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mo3.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Load_mo3.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -90,6 +90,10 @@ || ReadMTM(unpackedFile, loadFlags) || ReadMod(unpackedFile, loadFlags) || ReadM15(unpackedFile, loadFlags); + if(result) + { + m_ContainerType = MOD_CONTAINERTYPE_MO3; + } } UNMO3_Free(stream); Modified: trunk/OpenMPT/soundlib/Load_umx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_umx.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Load_umx.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -291,6 +291,7 @@ || ReadMod(fileChunk, loadFlags) || ReadM15(fileChunk, loadFlags)) { + m_ContainerType = MOD_CONTAINERTYPE_UMX; return true; } #ifdef MODPLUG_TRACKER @@ -314,7 +315,7 @@ if(m_nSamples != 0) { InitializeChannels(); - m_nType = MOD_TYPE_UMX; + m_nType = MOD_TYPE_UAX; m_nChannels = 4; Patterns.Insert(0, 64); Order[0] = 0; Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-10-04 22:58:58 UTC (rev 2823) @@ -87,7 +87,7 @@ MOD_TYPE_ULT = 0x80, MOD_TYPE_STM = 0x100, MOD_TYPE_FAR = 0x200, - MOD_TYPE_WAV = 0x400, + MOD_TYPE_WAV = 0x400, // PCM as module MOD_TYPE_AMF = 0x800, MOD_TYPE_AMS = 0x1000, MOD_TYPE_DSM = 0x2000, @@ -105,14 +105,21 @@ MOD_TYPE_IMF = 0x2000000, MOD_TYPE_AMS2 = 0x4000000, MOD_TYPE_DIGI = 0x8000000, + MOD_TYPE_UAX = 0x10000000, // sampleset as module // Container formats (not used at the moment) - MOD_TYPE_MO3 = 0x20000000, - MOD_TYPE_GDM = 0x40000000, - MOD_TYPE_UMX = 0x80000000, }; DECLARE_FLAGSET(MODTYPE) +enum MODCONTAINERTYPE +{ + MOD_CONTAINERTYPE_NONE = 0x0, + MOD_CONTAINERTYPE_MO3 = 0x1, + MOD_CONTAINERTYPE_GDM = 0x2, + MOD_CONTAINERTYPE_UMX = 0x3, +}; + + enum MOD_CHARSET_CERTAINTY { MOD_CHARSET_UNKNOWN, Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -515,6 +515,7 @@ gnDryLOfsVol = 0; gnDryROfsVol = 0; m_nType = MOD_TYPE_NONE; + m_ContainerType = MOD_CONTAINERTYPE_NONE; m_nChannels = 0; m_nMixChannels = 0; m_nSamples = 0; @@ -594,6 +595,7 @@ { // Do not add or change any of these values! And if you do, review each and every loader to check if they require these defaults! m_nType = MOD_TYPE_NONE; + m_ContainerType = MOD_CONTAINERTYPE_NONE; m_nChannels = 0; m_nInstruments = 0; m_nSamples = 0; @@ -730,6 +732,7 @@ && !ReadM15(file, loadFlags)) { m_nType = MOD_TYPE_NONE; + m_ContainerType = MOD_CONTAINERTYPE_NONE; } if(madeWithTracker.empty()) @@ -952,6 +955,7 @@ } m_nType = MOD_TYPE_NONE; + m_ContainerType = MOD_CONTAINERTYPE_NONE; m_nChannels = m_nSamples = m_nInstruments = 0; return TRUE; } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-10-04 22:58:58 UTC (rev 2823) @@ -321,6 +321,9 @@ CModDoc *m_pModDoc; // Can be a null pointer for example when previewing samples from the treeview. #endif // MODPLUG_TRACKER FlagSet<MODTYPE> m_nType; +private: + MODCONTAINERTYPE m_ContainerType; +public: CHANNELINDEX m_nChannels; SAMPLEINDEX m_nSamples; INSTRUMENTINDEX m_nInstruments; @@ -449,6 +452,8 @@ bool TypeIsIT_MPT_XM() const { return (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) != 0; } bool TypeIsS3M_IT_MPT() const { return (m_nType & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; } + MODCONTAINERTYPE GetContainerType() const { return m_ContainerType; } + // rough heuristic, could be improved std::pair<MOD_CHARSET_CERTAINTY, std::string> GetCharset() const { return GetCharsetFromModType(GetType()); } @@ -551,7 +556,9 @@ static std::vector<const char *> GetSupportedExtensions(bool otherFormats); static std::pair<MOD_CHARSET_CERTAINTY, std::string> GetCharsetFromModType(MODTYPE modtype); static const char * ModTypeToString(MODTYPE modtype); + static std::string CSoundFile::ModContainerTypeToString(MODCONTAINERTYPE containertype); static std::string ModTypeToTracker(MODTYPE modtype); + static std::string CSoundFile::ModContainerTypeToTracker(MODCONTAINERTYPE containertype); void UpgradeModFlags(); void UpgradeSong(); Modified: trunk/OpenMPT/soundlib/Tables.cpp =================================================================== --- trunk/OpenMPT/soundlib/Tables.cpp 2013-10-04 20:42:52 UTC (rev 2822) +++ trunk/OpenMPT/soundlib/Tables.cpp 2013-10-04 22:58:58 UTC (rev 2823) @@ -90,14 +90,6 @@ { MOD_TYPE_IMF, "Imago Orpheus", "imf" }, { MOD_TYPE_J2B, "Galaxy Sound System", "j2b" }, - // Container formats - { MOD_TYPE_GDM, "General Digital Music", "gdm" }, - { MOD_TYPE_UMX, "Unreal Music", "umx" }, - { MOD_TYPE_UMX, "Unreal Sounds", "uax" }, -#ifndef NO_MO3 - { MOD_TYPE_MO3, "MO3", "mo3" }, -#endif // NO_MO3 - #ifndef NO_ARCHIVE_SUPPORT // Compressed modules { MOD_TYPE_MOD, "ProTracker", "mdz" }, @@ -109,11 +101,32 @@ #endif }; + +struct ModContainerInfo +{ + MODCONTAINERTYPE format; // MOD_CONTAINERTYPE_XXXX + const char *name; // "Unreal Music" + const char *extension; // "umx" +}; + +// remember to also update libopenmpt/libopenmpt_foobar2000.cpp (all other plugins read these dynamically) +static const ModContainerInfo modContainerInfo[] = +{ + // Container formats + { MOD_CONTAINERTYPE_GDM, "General Digital Music", "gdm" }, + { MOD_CONTAINERTYPE_UMX, "Unreal Music", "umx" }, +#ifndef NO_MO3 + { MOD_CONTAINERTYPE_MO3, "Un4seen MO3", "mo3" }, +#endif // NO_MO3 +}; + + #ifdef MODPLUG_TRACKER static const ModFormatInfo otherFormatInfo[] = { // Other stuff - { MOD_TYPE_WAV, "Wave", "wav" }, + { MOD_TYPE_WAV, "Wave", "wav" }, // PCM as module + { MOD_TYPE_UAX, "Unreal Sounds", "uax" }, // sampleset as module { MOD_TYPE_MID, "MIDI", "mid" }, { MOD_TYPE_MID, "MIDI", "rmi" }, { MOD_TYPE_MID, "MIDI", "smf" }, @@ -196,6 +209,14 @@ exts.push_back(modFormatInfo[i].extension); } } + for(size_t i = 0; i < CountOf(modContainerInfo); i++) + { + // Avoid dupes in list + if(i == 0 || strcmp(modContainerInfo[i].extension, modContainerInfo[i - 1].extension)) + { + exts.push_back(modContainerInfo[i].extension); + } + } #ifdef MODPLUG_TRACKER if(otherFormats) { @@ -225,6 +246,20 @@ } +std::string CSoundFile::ModContainerTypeToString(MODCONTAINERTYPE containertype) +//------------------------------------------------------------------------------ +{ + for(size_t i = 0; i < CountOf(modContainerInfo); i++) + { + if(modContainerInfo[i].format == containertype) + { + return modContainerInfo[i].extension; + } + } + return ""; +} + + std::string CSoundFile::ModTypeToTracker(MODTYPE modtype) //------------------------------------------------------- { @@ -250,6 +285,32 @@ } +std::string CSoundFile::ModContainerTypeToTracker(MODCONTAINERTYPE containertype) +//------------------------------------------------------------------------------- +{ + std::set<std::string> retvals; + std::string retval; + for(size_t i = 0; i < CountOf(modContainerInfo); i++) + { + if(modContainerInfo[i].format == containertype) + { + std::string name = modContainerInfo[i].name; + if(retvals.find(name) == retvals.end()) + { + retvals.insert(name); + if(!retval.empty()) + { + retval += " / "; + } + retval += name; + } + } + } + return retval; +} + + + /////////////////////////////////////////////////////////////////////// const uint8 ImpulseTrackerPortaVolCmd[16] = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-10-05 05:51:05
|
Revision: 2831 http://sourceforge.net/p/modplug/code/2831 Author: manxorist Date: 2013-10-05 05:50:55 +0000 (Sat, 05 Oct 2013) Log Message: ----------- [Mod] libopenmpt: Remove LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING . [Mod] libopenmpt: Bump API version to 0.1 . Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.cpp trunk/OpenMPT/libopenmpt/libopenmpt_internal.h trunk/OpenMPT/libopenmpt/libopenmpt_version.h trunk/OpenMPT/openmpt123/Makefile trunk/OpenMPT/openmpt123/openmpt123_config.hpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp 2013-10-05 03:17:54 UTC (rev 2830) +++ trunk/OpenMPT/libopenmpt/libopenmpt_cxx.cpp 2013-10-05 05:50:55 UTC (rev 2831) @@ -21,13 +21,13 @@ namespace openmpt { -exception::exception( const std::string & text_ ) throw() +exception::exception( const std::string & text ) throw() : std::exception() , text(0) { - text = (char*)std::malloc( text_.length() + 1 ); - if ( text ) { - std::memcpy( text, text_.c_str(), text_.length() + 1 ); + this->text = (char*)std::malloc( text.length() + 1 ); + if ( this->text ) { + std::memcpy( this->text, text.c_str(), text.length() + 1 ); } } Modified: trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.cpp 2013-10-05 03:17:54 UTC (rev 2830) +++ trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.cpp 2013-10-05 05:50:55 UTC (rev 2831) @@ -2,7 +2,6 @@ #include "foobar2000/SDK/foobar2000.h" #include "foobar2000/helpers/helpers.h" -#define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING #include "libopenmpt.hpp" #include <algorithm> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_internal.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-10-05 03:17:54 UTC (rev 2830) +++ trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-10-05 05:50:55 UTC (rev 2831) @@ -10,11 +10,6 @@ #ifndef LIBOPENMPT_INTERNAL_H #define LIBOPENMPT_INTERNAL_H -/* disable alpha version warning in internal builds */ -#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING -#define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING -#endif - #include "libopenmpt_config.h" #if defined(NO_LIBOPENMPT_C) Modified: trunk/OpenMPT/libopenmpt/libopenmpt_version.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_version.h 2013-10-05 03:17:54 UTC (rev 2830) +++ trunk/OpenMPT/libopenmpt/libopenmpt_version.h 2013-10-05 05:50:55 UTC (rev 2831) @@ -11,7 +11,7 @@ #define LIBOPENMPT_VERSION_H #define OPENMPT_API_VERSION_MAJOR 0 -#define OPENMPT_API_VERSION_MINOR 0 +#define OPENMPT_API_VERSION_MINOR 1 #define OPENMPT_API_VERSION ((OPENMPT_API_VERSION_MAJOR<<24)|(OPENMPT_API_VERSION_MINOR<<16)) @@ -19,12 +19,4 @@ #define OPENMPT_API_VERSION_STRINGIZE(x) OPENMPT_API_VERSION_HELPER_STRINGIZE(x) #define OPENMPT_API_VERSION_STRING OPENMPT_API_VERSION_STRINGIZE(OPENMPT_API_VERSION_MAJOR) "." OPENMPT_API_VERSION_STRINGIZE(OPENMPT_API_VERSION_MINOR) -#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING -#ifdef __cplusplus -static_assert( false, "libopenmpt is currently in alpha stage, do not rely on ABI or even API compatibility for the next few months yet. #define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING to acknowledge this warning." ); -#else -typedef char OPENMPT_STATIC_ASSERT[-1]; /* libopenmpt is currently in alpha stage, do not rely on ABI or even API compatibility for the next few months yet. #define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING to acknowledge this warning. */ -#endif -#endif /* LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING */ - #endif /* LIBOPENMPT_VERSION_H */ Modified: trunk/OpenMPT/openmpt123/Makefile =================================================================== --- trunk/OpenMPT/openmpt123/Makefile 2013-10-05 03:17:54 UTC (rev 2830) +++ trunk/OpenMPT/openmpt123/Makefile 2013-10-05 05:50:55 UTC (rev 2831) @@ -61,7 +61,6 @@ endif #CPPFLAGS += -DMPT_COMPILER_GENERIC -CPPFLAGS += -DLIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING #CXXFLAGS += -mtune=generic #CFLAGS += -mtune=generic Modified: trunk/OpenMPT/openmpt123/openmpt123_config.hpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_config.hpp 2013-10-05 03:17:54 UTC (rev 2830) +++ trunk/OpenMPT/openmpt123/openmpt123_config.hpp 2013-10-05 05:50:55 UTC (rev 2831) @@ -25,10 +25,6 @@ #endif // _MSC_VER -#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING -#define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING -#endif - #define OPENMPT123_VERSION_STRING "0.1" #endif // OPENMPT123_CONFIG_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-10-08 19:09:38
|
Revision: 2842 http://sourceforge.net/p/modplug/code/2842 Author: saga-games Date: 2013-10-08 19:09:30 +0000 (Tue, 08 Oct 2013) Log Message: ----------- [Fix] IT Compatibility: In Compatible Gxx mode, sliding between two different samples shouldn't switch to the new sample (test cases: PortaInsNumCompat.it, PortaSampleCompat.it) [Mod] OpenMPT: Version is now 1.22.05.06 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-10-08 18:30:35 UTC (rev 2841) +++ trunk/OpenMPT/common/versionNumber.h 2013-10-08 19:09:30 UTC (rev 2842) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 05 -#define VER_MINORMINOR 05 +#define VER_MINORMINOR 06 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-10-08 18:30:35 UTC (rev 2841) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-10-08 19:09:30 UTC (rev 2842) @@ -668,6 +668,13 @@ bool returnAfterVolumeAdjust = false; + // IT compatibility: No sample change (also within multi-sample instruments) during portamento when using Compatible Gxx. + // Test case: PortaInsNumCompat.it, PortaSampleCompat.it + if(bPorta && pChn->pModSample != nullptr && pChn->pModSample != pSmp && IsCompatibleMode(TRK_IMPULSETRACKER) && m_SongFlags[SONG_ITCOMPATGXX]) + { + pSmp = pChn->pModSample; + } + // instrumentChanged is used for IT carry-on env option bool instrumentChanged = (pIns != pChn->pModInstrument); const bool sampleChanged = (pChn->pModSample != nullptr) && (pSmp != pChn->pModSample); @@ -1140,7 +1147,8 @@ bPorta = false; } - if (!bPorta || (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) + if (!bPorta + || (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) || (pChn->dwFlags[CHN_NOTEFADE] && !pChn->nFadeOutVol) || (m_SongFlags[SONG_ITCOMPATGXX] && pChn->rowCommand.instr != 0)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-10-11 04:53:44
|
Revision: 2849 http://sourceforge.net/p/modplug/code/2849 Author: manxorist Date: 2013-10-11 04:53:37 +0000 (Fri, 11 Oct 2013) Log Message: ----------- [Fix] Mingw64 headers implement the UNREFERENCED_PARAMETER(x) macro as an assignment (x)=(x). This breaks for parameters which are declared const and is undesireable anyway because it potentially invokes a copy assignment operator. Only ever use the system-provided UNEREFERENCED_PARAMETER macro on MSVC and fallback to (void)(x) for all other compilers. In order to not conflict with the system header definition, rename our version to MPT_UNREFERENCED_PARAMETER(x) . Modified Paths: -------------- trunk/OpenMPT/common/typedefs.cpp trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/ColourEdit.cpp trunk/OpenMPT/mptrack/CreditStatic.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/DefaultVstEditor.cpp trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/StreamEncoder.cpp trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/ModInstrument.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/Tables.cpp trunk/OpenMPT/soundlib/load_j2b.cpp trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/common/typedefs.cpp =================================================================== --- trunk/OpenMPT/common/typedefs.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/common/typedefs.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -176,11 +176,11 @@ << std::endl; #endif // MODPLUG_TRACKER #else - UNREFERENCED_PARAMETER(file); - UNREFERENCED_PARAMETER(line); - UNREFERENCED_PARAMETER(function); - UNREFERENCED_PARAMETER(format); - UNREFERENCED_PARAMETER(args); + MPT_UNREFERENCED_PARAMETER(file); + MPT_UNREFERENCED_PARAMETER(line); + MPT_UNREFERENCED_PARAMETER(function); + MPT_UNREFERENCED_PARAMETER(format); + MPT_UNREFERENCED_PARAMETER(args); #endif } Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/common/typedefs.h 2013-10-11 04:53:37 UTC (rev 2849) @@ -369,7 +369,9 @@ -#ifndef UNREFERENCED_PARAMETER -#define UNREFERENCED_PARAMETER(x) (void)(x) +#if MPT_COMPILER_MSVC && defined(UNREFERENCED_PARAMETER) +#define MPT_UNREFERENCED_PARAMETER(x) UNREFERENCED_PARAMETER(x) +#else +#define MPT_UNREFERENCED_PARAMETER(x) (void)(x) #endif Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -257,8 +257,8 @@ BOOL CModCleanupDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) //---------------------------------------------------------------------------- { - UNREFERENCED_PARAMETER(id); - UNREFERENCED_PARAMETER(pResult); + MPT_UNREFERENCED_PARAMETER(id); + MPT_UNREFERENCED_PARAMETER(pResult); // need to handle both ANSI and UNICODE versions of the message TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; Modified: trunk/OpenMPT/mptrack/ColourEdit.cpp =================================================================== --- trunk/OpenMPT/mptrack/ColourEdit.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/ColourEdit.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -35,7 +35,7 @@ HBRUSH CColourEdit::CtlColor(CDC* pDC, UINT nCtlColor) { - UNREFERENCED_PARAMETER(nCtlColor); + MPT_UNREFERENCED_PARAMETER(nCtlColor); pDC->SetTextColor(m_crText); //set text color pDC->SetBkColor(m_crBackGnd); //set the text's background color return m_brBackGnd; //return the brush used for background - this sets control background Modified: trunk/OpenMPT/mptrack/CreditStatic.cpp =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/CreditStatic.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -232,7 +232,7 @@ BOOL CCreditStatic::OnEraseBkgnd(CDC* pDC) { - UNREFERENCED_PARAMETER(pDC); + MPT_UNREFERENCED_PARAMETER(pDC); return TRUE; // return CStatic::OnEraseBkgnd(pDC); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -1049,7 +1049,7 @@ void COrderList::OnMButtonDown(UINT nFlags, CPoint pt) //---------------------------------------------------- { - UNREFERENCED_PARAMETER(nFlags); + MPT_UNREFERENCED_PARAMETER(nFlags); QueuePattern(pt); } Modified: trunk/OpenMPT/mptrack/DefaultVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -375,8 +375,8 @@ BOOL CDefaultVstEditor::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) //------------------------------------------------------------------------ { - UNREFERENCED_PARAMETER(nFlags); - UNREFERENCED_PARAMETER(pt); + MPT_UNREFERENCED_PARAMETER(nFlags); + MPT_UNREFERENCED_PARAMETER(pt); // Mouse wheel - scroll parameter list int minpos, maxpos; Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -339,7 +339,7 @@ //----------------------------------------------------------------------------------------- void CEffectVis::ShowVis(CDC * pDC, CRect rectBorder) { - UNREFERENCED_PARAMETER(rectBorder); + MPT_UNREFERENCED_PARAMETER(rectBorder); if (m_boolForceRedraw) { m_boolForceRedraw = FALSE ; @@ -530,9 +530,9 @@ void CEffectVis::OnSize(UINT nType, int cx, int cy) { - UNREFERENCED_PARAMETER(nType); - UNREFERENCED_PARAMETER(cx); - UNREFERENCED_PARAMETER(cy); + MPT_UNREFERENCED_PARAMETER(nType); + MPT_UNREFERENCED_PARAMETER(cx); + MPT_UNREFERENCED_PARAMETER(cy); GetClientRect(&m_rcFullWin); m_rcDraw.SetRect( m_rcFullWin.left + LEFTBORDER, m_rcFullWin.top + TOPBORDER, m_rcFullWin.right - RIGHTBORDER, m_rcFullWin.bottom - BOTTOMBORDER); Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -241,7 +241,7 @@ void COptionsSoundcard::UpdateChannels(int dev) //--------------------------------------------- { - UNREFERENCED_PARAMETER(dev); + MPT_UNREFERENCED_PARAMETER(dev); CHAR s[128]; UINT n = 0; m_CbnChannels.ResetContent(); Modified: trunk/OpenMPT/mptrack/StreamEncoder.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoder.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/StreamEncoder.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -34,22 +34,22 @@ void StreamWriterBase::WriteMetatags(const FileTags &tags) //-------------------------------------------------------- { - UNREFERENCED_PARAMETER(tags); + MPT_UNREFERENCED_PARAMETER(tags); } void StreamWriterBase::WriteInterleavedConverted(size_t frameCount, const char *data) //----------------------------------------------------------------------------------- { - UNREFERENCED_PARAMETER(frameCount); - UNREFERENCED_PARAMETER(data); + MPT_UNREFERENCED_PARAMETER(frameCount); + MPT_UNREFERENCED_PARAMETER(data); } void StreamWriterBase::WriteCues(const std::vector<uint64> &cues) //--------------------------------------------------------------- { - UNREFERENCED_PARAMETER(cues); + MPT_UNREFERENCED_PARAMETER(cues); } Modified: trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/StreamEncoderFLAC.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -50,23 +50,23 @@ } FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) { - UNREFERENCED_PARAMETER(encoder); - UNREFERENCED_PARAMETER(samples); - UNREFERENCED_PARAMETER(current_frame); + MPT_UNREFERENCED_PARAMETER(encoder); + MPT_UNREFERENCED_PARAMETER(samples); + MPT_UNREFERENCED_PARAMETER(current_frame); f.write(reinterpret_cast<const char*>(buffer), bytes); if(!f) return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; } FLAC__StreamEncoderSeekStatus SeekCallback(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset) { - UNREFERENCED_PARAMETER(encoder); + MPT_UNREFERENCED_PARAMETER(encoder); f.seekp(absolute_byte_offset); if(!f) return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR; return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; } FLAC__StreamEncoderTellStatus TellCallback(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset) { - UNREFERENCED_PARAMETER(encoder); + MPT_UNREFERENCED_PARAMETER(encoder); if(absolute_byte_offset) { *absolute_byte_offset = f.tellp(); @@ -138,8 +138,8 @@ } virtual void SetFormat(int samplerate, int channels, const Encoder::Settings &settings) { - UNREFERENCED_PARAMETER(samplerate); - UNREFERENCED_PARAMETER(channels); + MPT_UNREFERENCED_PARAMETER(samplerate); + MPT_UNREFERENCED_PARAMETER(channels); FinishStream(); Modified: trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -405,7 +405,7 @@ } static void GenreEnumCallback(int num, const char *name, void *cookie) { - UNREFERENCED_PARAMETER(num); + MPT_UNREFERENCED_PARAMETER(num); Encoder::Traits &traits = *reinterpret_cast<Encoder::Traits*>(cookie); if(name) { Modified: trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/StreamEncoderWAV.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -76,8 +76,8 @@ } virtual void SetFormat(int samplerate, int channels, const Encoder::Settings &settings) { - UNREFERENCED_PARAMETER(samplerate); - UNREFERENCED_PARAMETER(channels); + MPT_UNREFERENCED_PARAMETER(samplerate); + MPT_UNREFERENCED_PARAMETER(channels); FinishStream(); Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -391,8 +391,8 @@ BOOL CModTypeDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) //------------------------------------------------------------------------- { - UNREFERENCED_PARAMETER(id); - UNREFERENCED_PARAMETER(pResult); + MPT_UNREFERENCED_PARAMETER(id); + MPT_UNREFERENCED_PARAMETER(pResult); // need to handle both ANSI and UNICODE versions of the message TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -665,7 +665,7 @@ void CASIODevice::BufferSwitch(long doubleBufferIndex, ASIOBool directProcess) //---------------------------------------------------------------------------- { - UNREFERENCED_PARAMETER(directProcess); + MPT_UNREFERENCED_PARAMETER(directProcess); if(gpCurrentAsio) { gpCurrentAsio->BufferSwitch(doubleBufferIndex); @@ -679,16 +679,16 @@ void CASIODevice::SampleRateDidChange(ASIOSampleRate sRate) //--------------------------------------------------------- { - UNREFERENCED_PARAMETER(sRate); + MPT_UNREFERENCED_PARAMETER(sRate); } long CASIODevice::AsioMessage(long selector, long value, void* message, double* opt) //---------------------------------------------------------------------------------- { - UNREFERENCED_PARAMETER(value); - UNREFERENCED_PARAMETER(message); - UNREFERENCED_PARAMETER(opt); + MPT_UNREFERENCED_PARAMETER(value); + MPT_UNREFERENCED_PARAMETER(message); + MPT_UNREFERENCED_PARAMETER(opt); #ifdef ASIO_LOG // Log("AsioMessage(%d, %d)\n", selector, value); #endif Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -203,8 +203,8 @@ ) //----------------------------------------- { - UNREFERENCED_PARAMETER(input); - UNREFERENCED_PARAMETER(statusFlags); + MPT_UNREFERENCED_PARAMETER(input); + MPT_UNREFERENCED_PARAMETER(statusFlags); if(!output) return paAbort; if(Pa_GetHostApiInfo(m_HostApi)->type == paWDMKS) { Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -380,7 +380,7 @@ #define BEGIN_MIX_INTERFACE(func)\ void func(ModChannel *pChannel, const CResampler *pResampler, int *pbuffer, int *pbufmax)\ {\ - UNREFERENCED_PARAMETER(pResampler);\ + MPT_UNREFERENCED_PARAMETER(pResampler);\ LONG nPos; #define END_MIX_INTERFACE()\ Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -1055,7 +1055,7 @@ const size_t num = (pModDoc != nullptr) ? pModDoc->GetFileHistory().size() + 1 : 0; // + 1 for this session #else const size_t num = 0; - UNREFERENCED_PARAMETER(pSndFile); + MPT_UNREFERENCED_PARAMETER(pSndFile); #endif // MODPLUG_TRACKER uint16 fnum = (uint16)MIN(num, uint16_max); // Number of entries that are actually going to be written Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -49,8 +49,8 @@ //------------------------------------------------------------------------- { #ifndef MODPLUG_TRACKER - UNREFERENCED_PARAMETER(file); - UNREFERENCED_PARAMETER(loadFlags); + MPT_UNREFERENCED_PARAMETER(file); + MPT_UNREFERENCED_PARAMETER(loadFlags); return false; #else // MODPLUG_TRACKER @@ -283,7 +283,7 @@ //------------------------------------------------- { #ifndef MODPLUG_TRACKER - UNREFERENCED_PARAMETER(lpszFileName); + MPT_UNREFERENCED_PARAMETER(lpszFileName); return false; #else // MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/ModInstrument.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/ModInstrument.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -170,7 +170,7 @@ void ModInstrument::Convert(MODTYPE fromType, MODTYPE toType) //----------------------------------------------------------- { - UNREFERENCED_PARAMETER(fromType); + MPT_UNREFERENCED_PARAMETER(fromType); if(toType & MOD_TYPE_XM) { Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -1922,7 +1922,7 @@ ASSERT((bps <= 8 && sample.GetElementarySampleSize() == 1) || (bps > 8 && sample.GetElementarySampleSize() == 2)); ASSERT(modChannels <= FLAC__stream_decoder_get_channels(decoder)); ASSERT(bps == FLAC__stream_decoder_get_bits_per_sample(decoder)); - UNREFERENCED_PARAMETER(decoder); // decoder is unused if ASSERTs are compiled out + MPT_UNREFERENCED_PARAMETER(decoder); // decoder is unused if ASSERTs are compiled out // Do the sample conversion for(uint8 chn = 0; chn < modChannels; chn++) @@ -2041,8 +2041,8 @@ return true; } #else - UNREFERENCED_PARAMETER(sample); - UNREFERENCED_PARAMETER(file); + MPT_UNREFERENCED_PARAMETER(sample); + MPT_UNREFERENCED_PARAMETER(file); #endif // NO_FLAC return false; } @@ -2203,8 +2203,8 @@ FLAC__stream_encoder_delete(encoder); return true; #else - UNREFERENCED_PARAMETER(nSample); - UNREFERENCED_PARAMETER(lpszFileName); + MPT_UNREFERENCED_PARAMETER(nSample); + MPT_UNREFERENCED_PARAMETER(lpszFileName); return false; #endif // NO_FLAC } @@ -2376,8 +2376,8 @@ return true; } #else - UNREFERENCED_PARAMETER(sample); - UNREFERENCED_PARAMETER(file); + MPT_UNREFERENCED_PARAMETER(sample); + MPT_UNREFERENCED_PARAMETER(file); #endif // NO_MP3_SAMPLES return false; } Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -291,7 +291,7 @@ } #endif // NO_AGC #if defined(NO_DSP) && defined(NO_EQ) && defined(NO_AGC) - UNREFERENCED_PARAMETER(countChunk); + MPT_UNREFERENCED_PARAMETER(countChunk); #endif } Modified: trunk/OpenMPT/soundlib/Tables.cpp =================================================================== --- trunk/OpenMPT/soundlib/Tables.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/Tables.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -226,7 +226,7 @@ } } #else - UNREFERENCED_PARAMETER(otherFormats); + MPT_UNREFERENCED_PARAMETER(otherFormats); #endif return exts; } Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -981,8 +981,8 @@ #ifdef NO_ZLIB - UNREFERENCED_PARAMETER(file); - UNREFERENCED_PARAMETER(loadFlags); + MPT_UNREFERENCED_PARAMETER(file); + MPT_UNREFERENCED_PARAMETER(loadFlags); return false; #else Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2013-10-10 10:42:02 UTC (rev 2848) +++ trunk/OpenMPT/test/test.cpp 2013-10-11 04:53:37 UTC (rev 2849) @@ -155,7 +155,7 @@ #define TEST_TRY try { #define TEST_CATCH } catch(...) { ReportExceptionAndBreak(THIS_FILE, __LINE__, description, true); } #define TEST_START() do { } while(0) -#define TEST_OK() do { UNREFERENCED_PARAMETER(description); } while(0) +#define TEST_OK() do { MPT_UNREFERENCED_PARAMETER(description); } while(0) #define TEST_FAIL() ReportErrorAndBreak(THIS_FILE, __LINE__, description, false) #define TEST_FAIL_STOP() ReportErrorAndBreak(THIS_FILE, __LINE__, description, true) @@ -173,9 +173,9 @@ static noinline void show_ok(const char * const file, const int line, const char * const description) { - UNREFERENCED_PARAMETER(file); - UNREFERENCED_PARAMETER(line); - UNREFERENCED_PARAMETER(description); + MPT_UNREFERENCED_PARAMETER(file); + MPT_UNREFERENCED_PARAMETER(line); + MPT_UNREFERENCED_PARAMETER(description); std::cout << "PASS" << std::endl; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-10-11 10:38:48
|
Revision: 2860 http://sourceforge.net/p/modplug/code/2860 Author: manxorist Date: 2013-10-11 10:38:42 +0000 (Fri, 11 Oct 2013) Log Message: ----------- [New] libopenmpt: Support building with miniz instead of zlib to facilitate easier cross-compiling because no libopenmpt depends on no other library when using miniz. [Mod] libopenmpt: Build libopenmpt on windows with miniz. This simplifies the build process somehow. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/libopenmpt/libopenmpt.sln trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.sln trunk/OpenMPT/openmpt123/Makefile trunk/OpenMPT/openmpt123/openmpt123.sln trunk/OpenMPT/soundlib/load_j2b.cpp Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/common/BuildSettings.h 2013-10-11 10:38:42 UTC (rev 2860) @@ -112,6 +112,9 @@ // Define to build without zlib support //#define NO_ZLIB +// Define to build without miniz support +#define NO_MINIZ + // Define to build without MP3 import support (via mpg123) //#define NO_MP3_SAMPLES @@ -152,7 +155,10 @@ #endif #define NO_DSOUND #define NO_FLAC -//#define NO_ZLIB +#if !defined(MPT_WITH_ZLIB) +#define NO_ZLIB +#endif +//#define NO_MINIZ #define NO_MP3_SAMPLES //#define NO_LIBMODPLUG #if !defined(_WIN32) || (defined(_WIN32) && !defined(_M_IX86)) @@ -187,6 +193,11 @@ #undef MODPLUG_NO_FILESAVE // tests recommend file saving #endif +#if !defined(NO_ZLIB) && !defined(NO_MINIZ) +// Only one deflate implementation should be used. Prefer zlib. +#define NO_MINIZ +#endif + #if defined(MPT_PLATFORM_BIG_ENDIAN) && !defined(MODPLUG_NO_FILESAVE) #define MODPLUG_NO_FILESAVE // file saving is broken on big endian #endif Modified: trunk/OpenMPT/libopenmpt/libopenmpt.sln =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.sln 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/libopenmpt/libopenmpt.sln 2013-10-11 10:38:42 UTC (rev 2860) @@ -8,8 +8,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenmpt_settings", "libopenmpt_settings.vcxproj", "{B2B6EE07-F662-496D-980C-FCA7CA144DBC}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\include\zlib\zlib.vcxproj", "{1654FB18-FDE6-406F-9D84-BA12BFBD67B2}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -41,18 +39,6 @@ {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Test|Win32.ActiveCfg = Release|Win32 {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Test|Win32.Build.0 = Release|Win32 {B2B6EE07-F662-496D-980C-FCA7CA144DBC}.Test|x64.ActiveCfg = Release|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|Win32.ActiveCfg = DebugLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|Win32.Build.0 = DebugLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|x64.ActiveCfg = DebugLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|x64.Build.0 = DebugLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|Win32.ActiveCfg = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|Win32.Build.0 = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|x64.ActiveCfg = ReleaseLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|x64.Build.0 = ReleaseLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Test|Win32.ActiveCfg = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Test|Win32.Build.0 = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Test|x64.ActiveCfg = ReleaseLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Test|x64.Build.0 = ReleaseLib|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-10-11 10:38:42 UTC (rev 2860) @@ -254,7 +254,6 @@ <OptimizeReferences>true</OptimizeReferences> <DelayLoadDLLs> </DelayLoadDLLs> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> </Link> <PreBuildEvent> <Command>subwcrev .. ..\common\svn_version_subwcrev\svn_version.template.h ..\common\svn_version_subwcrev\svn_version.h || del ..\common\svn_version_subwcrev\svn_version.h || true</Command> @@ -289,7 +288,6 @@ <DelayLoadDLLs> </DelayLoadDLLs> <SubSystem>Console</SubSystem> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> </Link> <PreBuildEvent> <Command>subwcrev .. ..\common\svn_version_subwcrev\svn_version.template.h ..\common\svn_version_subwcrev\svn_version.h || del ..\common\svn_version_subwcrev\svn_version.h || true</Command> @@ -318,7 +316,6 @@ <OptimizeReferences>true</OptimizeReferences> <DelayLoadDLLs> </DelayLoadDLLs> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> </Link> <PreBuildEvent> <Command>subwcrev .. ..\common\svn_version_subwcrev\svn_version.template.h ..\common\svn_version_subwcrev\svn_version.h || del ..\common\svn_version_subwcrev\svn_version.h || true</Command> @@ -351,7 +348,6 @@ <DelayLoadDLLs> </DelayLoadDLLs> <SubSystem>Console</SubSystem> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> </Link> <PreBuildEvent> <Command>subwcrev .. ..\common\svn_version_subwcrev\svn_version.template.h ..\common\svn_version_subwcrev\svn_version.h || del ..\common\svn_version_subwcrev\svn_version.h || true</Command> @@ -495,6 +491,7 @@ <ClCompile Include="..\common\stdafx.cpp" /> <ClCompile Include="..\common\typedefs.cpp" /> <ClCompile Include="..\common\version.cpp" /> + <ClCompile Include="..\include\miniz\miniz.c" /> <ClCompile Include="..\include\pugixml\src\pugixml.cpp" /> <ClCompile Include="..\soundlib\Dither.cpp" /> <ClCompile Include="..\soundlib\Dlsbank.cpp" /> @@ -585,11 +582,6 @@ <ClCompile Include="libopenmpt_winamp.cpp" /> <ClCompile Include="libopenmpt_xmplay.cpp" /> </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\include\zlib\zlib.vcxproj"> - <Project>{1654fb18-fde6-406f-9d84-ba12bfbd67b2}</Project> - </ProjectReference> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-10-11 10:38:42 UTC (rev 2860) @@ -33,6 +33,9 @@ <Filter Include="Source Files\pugixml"> <UniqueIdentifier>{c229b22b-065f-42fd-81ee-498a859a7c8d}</UniqueIdentifier> </Filter> + <Filter Include="Source Files\miniz"> + <UniqueIdentifier>{3800b9bf-c28e-489f-8792-64b1b5a58b40}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClInclude Include="..\common\AudioCriticalSection.h"> @@ -511,5 +514,8 @@ <ClCompile Include="..\soundlib\Tagging.cpp"> <Filter>Source Files\soundlib</Filter> </ClCompile> + <ClCompile Include="..\include\miniz\miniz.c"> + <Filter>Source Files\miniz</Filter> + </ClCompile> </ItemGroup> </Project> \ No newline at end of file Modified: trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.sln =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.sln 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/libopenmpt/libopenmpt_foobar2000.sln 2013-10-11 10:38:42 UTC (rev 2860) @@ -13,8 +13,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenmpt", "libopenmpt.vcxproj", "{812A654D-99BE-4D13-B97F-86332AD3E363}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\include\zlib\zlib.vcxproj", "{1654FB18-FDE6-406F-9D84-BA12BFBD67B2}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -45,10 +43,6 @@ {812A654D-99BE-4D13-B97F-86332AD3E363}.Debug|Win32.Build.0 = DebugStatic|Win32 {812A654D-99BE-4D13-B97F-86332AD3E363}.Release|Win32.ActiveCfg = ReleaseStatic|Win32 {812A654D-99BE-4D13-B97F-86332AD3E363}.Release|Win32.Build.0 = ReleaseStatic|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|Win32.ActiveCfg = DebugLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|Win32.Build.0 = DebugLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|Win32.ActiveCfg = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|Win32.Build.0 = ReleaseLib|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/openmpt123/Makefile =================================================================== --- trunk/OpenMPT/openmpt123/Makefile 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/openmpt123/Makefile 2013-10-11 10:38:42 UTC (rev 2860) @@ -65,7 +65,7 @@ # build setup -CPPFLAGS += -I../common -I.. -I../include/modplug/include +CPPFLAGS += -I../common -I.. -I../include/modplug/include -I../include CXXFLAGS += -fvisibility=hidden CFLAGS += -fvisibility=hidden LDFLAGS += @@ -198,6 +198,9 @@ ../libopenmpt/libopenmpt_impl.cpp \ ../libopenmpt/libopenmpt_interactive.cpp \ ../libopenmpt/libopenmpt_version.cpp \ +ifeq ($(NO_ZLIB),1) +LIBOPENMPT_CXX_SOURCES += ../miniz/miniz.c +endif LIBOPENMPT_OBJECTS = $(LIBOPENMPT_CXX_SOURCES:.cpp=.o) LIBOPENMPT_DEPENDS = $(LIBOPENMPT_OBJECTS:.o=.d) Modified: trunk/OpenMPT/openmpt123/openmpt123.sln =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.sln 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/openmpt123/openmpt123.sln 2013-10-11 10:38:42 UTC (rev 2860) @@ -7,8 +7,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flac", "..\include\flac\flac.vcxproj", "{E599F5AA-F9A3-46CC-8DB0-C8DEFCEB90C5}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\include\zlib\zlib.vcxproj", "{1654FB18-FDE6-406F-9D84-BA12BFBD67B2}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "..\include\portaudio\portaudio.vcxproj", "{189B867F-FF4B-45A1-B741-A97492EE69AF}" EndProject Global @@ -43,14 +41,6 @@ {E599F5AA-F9A3-46CC-8DB0-C8DEFCEB90C5}.Release|Win32.Build.0 = ReleaseLib|Win32 {E599F5AA-F9A3-46CC-8DB0-C8DEFCEB90C5}.Release|x64.ActiveCfg = ReleaseLib|x64 {E599F5AA-F9A3-46CC-8DB0-C8DEFCEB90C5}.Release|x64.Build.0 = ReleaseLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|Win32.ActiveCfg = DebugLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|Win32.Build.0 = DebugLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|x64.ActiveCfg = DebugLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Debug|x64.Build.0 = DebugLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|Win32.ActiveCfg = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|Win32.Build.0 = ReleaseLib|Win32 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|x64.ActiveCfg = ReleaseLib|x64 - {1654FB18-FDE6-406F-9D84-BA12BFBD67B2}.Release|x64.Build.0 = ReleaseLib|x64 {189B867F-FF4B-45A1-B741-A97492EE69AF}.Debug|Win32.ActiveCfg = DebugLib|Win32 {189B867F-FF4B-45A1-B741-A97492EE69AF}.Debug|Win32.Build.0 = DebugLib|Win32 {189B867F-FF4B-45A1-B741-A97492EE69AF}.Debug|x64.ActiveCfg = DebugLib|x64 Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2013-10-11 10:36:46 UTC (rev 2859) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2013-10-11 10:38:42 UTC (rev 2860) @@ -15,7 +15,7 @@ #include "Loaders.h" #include "ChunkReader.h" -#ifndef NO_ZLIB +#if !defined(NO_ZLIB) #if MPT_COMPILER_MSVC #include <zlib/zlib.h> @@ -23,9 +23,14 @@ #include <zlib.h> #endif -#endif // ZLIB +#elif !defined(NO_MINIZ) +#define MINIZ_HEADER_FILE_ONLY +#include "miniz/miniz.c" +#endif + + // First off, a nice vibrato translation LUT. static const uint8 j2bAutoVibratoTrans[] = { @@ -979,7 +984,7 @@ //------------------------------------------------------------------- { -#ifdef NO_ZLIB +#if defined(NO_ZLIB) && defined(NO_MINIZ) MPT_UNREFERENCED_PARAMETER(file); MPT_UNREFERENCED_PARAMETER(loadFlags); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |