Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 9e5b5f4

Browse files
committed
* NEW: OSR 0.52
1 parent f621c68 commit 9e5b5f4

24 files changed

+400
-470
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,9 @@ x64/Debug/vc141.pdb
179179
/osrDecoder/x64/Debug/osrDecoder.tlog
180180
/osrMain/x64/Debug/osrMain.tlog
181181
/x64/Debug/OpenSoun.3BCAFC30.tlog
182+
/osrDecoder/x64/Release
183+
/osrKernel/x64/Release
184+
/osrMain/x64/Release
185+
/osrMixer/x64/Release
186+
/osrPlugins/x64
187+
/release

OpenSoundRefenation.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<ProjectGuid>{3BCAFC30-1810-3BA9-9FDB-0C781F1F4E7F}</ProjectGuid>
1515
<RootNamespace>OpenSoundRefenation</RootNamespace>
1616
<Keyword>Qt4VSv1.0</Keyword>
17-
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
17+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
1818
</PropertyGroup>
1919
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,5 @@ wWinMain(
2828

2929
// critical section
3030
InitApplication();
31-
StartApplication(lpCmdLine);
32-
33-
return TRUE;
31+
return StartApplication(lpCmdLine);
3432
}

osrDecoder/WMFMain.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ IMFDecoder::DecodeFile(const char* PathToFileUTF8, void*& pOutFile, size_t& OutS
7373
pSourceReader->GetNativeMediaType((DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, NULL, &pMediaType);
7474
MFCreateWaveFormatExFromMFMediaType(pMediaType, &pWave, &dwSizeOfWaveFormat);
7575

76-
CoTaskMemFree(pWave);
77-
pWave = nullptr;
78-
7976
if (pWave->wBitsPerSample == 24 && pWave->wFormatTag == 1)
8077
{
8178
_RELEASE(pSourceReader);
8279
_RELEASE(pMediaSrc);
8380
return;
8481
}
8582

83+
CoTaskMemFree(pWave);
84+
pWave = nullptr;
85+
8686
GUID MajorType = { NULL };
8787
GUID SubType = { NULL };
8888

osrDecoder/osrDecoder.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<ProjectGuid>{6E43CD6F-6AD0-4544-A368-05359BFE7813}</ProjectGuid>
1616
<Keyword>Win32Proj</Keyword>
1717
<RootNamespace>osrDecoder</RootNamespace>
18-
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
18+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
1919
</PropertyGroup>
2020
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2121
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

osrKernel/OSR.h

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,157 @@ constexpr unsigned int FOURCC_MIDI_SAMPLE = MAKEFOURCC('s', 'm', 'p', 'l');
371371
constexpr unsigned int FOURCC_XWMA_DPDS = MAKEFOURCC('d', 'p', 'd', 's');
372372
constexpr unsigned int FOURCC_XMA_SEEK = MAKEFOURCC('s', 'e', 'e', 'k');
373373

374+
class MultiString
375+
{
376+
MultiString(const WideChar* StringUTF16)
377+
{
378+
// we need to get size of data to allocate
379+
StringSize = WideCharToMultiByte(CP_UTF8, 0, StringUTF16, -1, nullptr, 0, nullptr, nullptr);
380+
String = nullptr;
381+
382+
if (StringSize && StringSize < sizeof(STRING256))
383+
{
384+
// allocate new string at kernel heap
385+
String = (LPSTR)FastAlloc(++StringSize);
386+
387+
// convert to UTF-8
388+
WideCharToMultiByte(CP_UTF8, 0, StringUTF16, -1, String, StringSize, nullptr, nullptr);
389+
}
390+
}
391+
392+
MultiString(const char* StringUTF8)
393+
{
394+
// allocate new string at kernel heap
395+
StringSize = strlen(StringUTF8);
396+
String = (LPSTR)FastAlloc(++StringSize);
397+
398+
// copy string to local string
399+
strcpy_s(String, StringSize, StringUTF8);
400+
}
401+
402+
MultiString()
403+
{
404+
405+
}
406+
407+
MultiString& operator=(const MultiString& osrString)
408+
{
409+
StringSize = osrString.StringSize;
410+
String = (LPSTR)FastAlloc(StringSize);
411+
strcpy_s(String, StringSize, osrString.String);
412+
}
413+
414+
MultiString& operator=(const WideChar* StringUTF16)
415+
{
416+
// we need to get size of data to allocate
417+
StringSize = WideCharToMultiByte(CP_UTF8, 0, StringUTF16, -1, nullptr, 0, nullptr, nullptr);
418+
String = nullptr;
419+
420+
if (StringSize && StringSize < sizeof(STRING256))
421+
{
422+
// allocate new string at kernel heap
423+
String = (LPSTR)FastAlloc(++StringSize);
424+
425+
// convert to UTF-8
426+
WideCharToMultiByte(CP_UTF8, 0, StringUTF16, -1, String, StringSize, nullptr, nullptr);
427+
}
428+
}
429+
430+
MultiString& operator=(const char* StringUTF8)
431+
{
432+
// allocate new string at kernel heap
433+
StringSize = strlen(StringUTF8);
434+
String = (LPSTR)FastAlloc(++StringSize);
435+
436+
// copy string to local string
437+
strcpy_s(String, StringSize, StringUTF8);
438+
}
439+
440+
~MultiString()
441+
{
442+
FREEKERNELHEAP(String);
443+
}
444+
445+
size_t copy_to()
446+
{
447+
448+
}
449+
450+
size_t copy_from()
451+
{
452+
453+
}
454+
455+
void clear()
456+
{
457+
458+
}
459+
460+
void move()
461+
{
462+
463+
}
464+
465+
void push_back(char Symbol)
466+
{
467+
char* pLocal = nullptr;
468+
size_t LocalStringSize = 0;
469+
470+
// if allocated space smaller than null-terminated string + 1 symbol
471+
if (((LocalStringSize = strlen(String) + 2)) > StringSize)
472+
{
473+
pLocal = (char*)FastAlloc(StringSize + 1);
474+
memset(pLocal, 0, StringSize + 1); // for null-terminated string
475+
memcpy(pLocal, String, StringSize);
476+
pLocal[StringSize - 1] = Symbol;
477+
478+
FREEKERNELHEAP(String);
479+
480+
String = pLocal;
481+
StringSize++;
482+
}
483+
else
484+
{
485+
486+
}
487+
}
488+
489+
void reserve(size_t size) // in bytes
490+
{
491+
char* pLocal = nullptr;
492+
493+
if (size > StringSize)
494+
{
495+
pLocal = (char*)FastAlloc(size);
496+
497+
if (String)
498+
{
499+
memcpy(pLocal, String, StringSize);
500+
FREEKERNELHEAP(String);
501+
}
502+
503+
String = pLocal;
504+
StringSize = size;
505+
}
506+
}
507+
508+
private:
509+
char* String;
510+
size_t StringSize;
511+
};
512+
513+
class OSRString
514+
{
515+
public:
516+
using StringStruct = struct
517+
{
518+
519+
};
520+
521+
using StringVector = std::vector<StringStruct>;
522+
};
523+
524+
374525
#ifdef WIN32
375526
#include <Shobjidl.h>
376527
class TaskbarValue

osrKernel/OSRConfigSystem.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ IsConfigExist(
100100
{
101101
bool bDir = false;
102102
WSTRING_PATH szConfigPath = { 0 };
103-
WSTRING64 szConfigName = { 0 };
104103

105104
ConvertToPath(lpConfig, szConfigPath);
106105

osrKernel/OSRSystem.h

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ class IOSRFileSystem : public IObject
303303
virtual void ReadSize(OSRHandle& Handle, size_t& SizeToRead, void*& pOutFile) = 0;
304304
virtual void Write(OSRHandle& Handle, u8*& pOutStream, size_t& OutSize) = 0;
305305

306+
virtual void ListFolderFiles(const char* FolderPath, const char* FileType, STRING512* OutFiles, size_t CountFiles) = 0;
306307
virtual void GetPathUTF8(OSRHandle& OutHandle, const char*& OutString, size_t& OutStringSize) = 0;
307308
virtual FILE_TYPE IsAudio(const char* PathToFile) = 0;
308309

@@ -522,6 +523,59 @@ class IOSRWin32FileSystem : public IOSRFileSystem
522523
}
523524
}
524525

526+
void ListFolderFiles(const char* FolderPath, const char* FileType, STRING512* OutFiles, size_t CountFiles) override
527+
{
528+
WSTRING_PATH szPath = { 0 };
529+
STRING512 PathTemp = { 0 };
530+
WSTRING64 szType = { 0 };
531+
size_t cb = CountFiles;
532+
size_t u = 0;
533+
534+
if (FileType)
535+
{
536+
for (size_t i = 0; i < strlen(FileType); i++)
537+
{
538+
szType[i] = FileType[i];
539+
}
540+
541+
if (MultiByteToWideChar(CP_UTF8, 0, FolderPath, strlen(FolderPath), szPath, sizeof(WSTRING_PATH)))
542+
{
543+
size_t Cycle = 0;
544+
BOOL isFind = TRUE;
545+
WIN32_FIND_DATAW findData = { 0 };
546+
HANDLE hFind = FindFirstFileW(szPath, &findData);
547+
548+
if (hFind)
549+
{
550+
if (!cb) { cb = 100; }
551+
552+
OutFiles = (STRING512*)FastAlloc(sizeof(STRING512) * cb);
553+
554+
while (isFind)
555+
{
556+
isFind = FindNextFileW(hFind, &findData);
557+
LPCWSTR FileType = (findData.cFileName + (wcslen(szPath) - (wcslen(szType) - 1)));
558+
559+
if (!wcscmp(FileType, szType) && Cycle < cb)
560+
{
561+
if (WideCharToMultiByte(CP_UTF8, 0, findData.cFileName, wcslen(findData.cFileName), PathTemp, 512, nullptr, nullptr))
562+
{
563+
memcpy(OutFiles[Cycle], PathTemp, 512);
564+
Cycle++;
565+
}
566+
}
567+
568+
u++;
569+
}
570+
571+
FindClose(hFind);
572+
573+
Cycle++;
574+
}
575+
}
576+
}
577+
}
578+
525579
void GetPathUTF8(OSRHandle& OutHandle, const char*& OutString, size_t& OutStringSize) override
526580
{
527581
BOOL bSuccess = FALSE;
@@ -836,7 +890,11 @@ class IOSRWin32FileSystem : public IOSRFileSystem
836890

837891
void CloseThisHandle(OSRHandle& OutHandle) override
838892
{
839-
if (OutHandle) { CloseHandle(OutHandle); };
893+
if (OutHandle)
894+
{
895+
CloseHandle(OutHandle);
896+
OutHandle = nullptr;
897+
};
840898
}
841899

842900
void Release() override

0 commit comments

Comments
 (0)