mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
replaced char parameters in sound system with stl string
This commit is contained in:
@@ -5072,7 +5072,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
// plik z przyspieszaczem (upust po zlapaniu hamowania)
|
||||
// sBrakeAcc.Init(str.c_str(),Parser->GetNextSymbol().ToDouble(),GetPosition().x,GetPosition().y,GetPosition().z,true);
|
||||
parser.getTokens( 1, false ); parser >> token;
|
||||
sBrakeAcc = TSoundsManager::GetFromName( token.c_str(), true );
|
||||
sBrakeAcc = TSoundsManager::GetFromName( token, true );
|
||||
bBrakeAcc = true;
|
||||
// sBrakeAcc.AM=1.0;
|
||||
// sBrakeAcc.AA=0.0;
|
||||
|
||||
@@ -25,7 +25,7 @@ void TFadeSound::Free()
|
||||
{
|
||||
}
|
||||
|
||||
void TFadeSound::Init(char *Name, float fNewFade)
|
||||
void TFadeSound::Init(std::string const &Name, float fNewFade)
|
||||
{
|
||||
Sound = TSoundsManager::GetFromName(Name, false);
|
||||
if (Sound)
|
||||
|
||||
@@ -24,7 +24,7 @@ class TFadeSound
|
||||
public:
|
||||
TFadeSound();
|
||||
~TFadeSound();
|
||||
void Init(char *Name, float fNewFade);
|
||||
void Init(std::string const &Name, float fNewFade);
|
||||
void TurnOn();
|
||||
void TurnOff();
|
||||
bool Playing()
|
||||
|
||||
12
Ground.cpp
12
Ground.cpp
@@ -823,11 +823,19 @@ void TSubRect::LoadNodes()
|
||||
break;
|
||||
case TP_TRACK:
|
||||
if (n->iNumVerts) // bo tory zabezpieczające są niewidoczne
|
||||
n->pTrack->RaArrayFill(m_pVNT + n->iVboPtr, m_pVNT);
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
n->pTrack->RaArrayFill( m_pVNT + n->iVboPtr, m_pVNT );
|
||||
#else
|
||||
n->pTrack->RaArrayFill(m_pVNT.data() + n->iVboPtr, m_pVNT.data());
|
||||
#endif
|
||||
break;
|
||||
case TP_TRACTION:
|
||||
if (n->iNumVerts) // druty mogą być niewidoczne...?
|
||||
n->hvTraction->RaArrayFill(m_pVNT + n->iVboPtr);
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
n->hvTraction->RaArrayFill( m_pVNT + n->iVboPtr );
|
||||
#else
|
||||
n->hvTraction->RaArrayFill(m_pVNT.data() + n->iVboPtr);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
n = n->nNext2; // następny z sektora
|
||||
|
||||
@@ -144,98 +144,6 @@ bool FuzzyLogicAI(double Test, double Threshold, double Probability)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string ReadWord(std::ifstream &infile)
|
||||
{
|
||||
std::string s = "";
|
||||
char c;
|
||||
bool nextword = false;
|
||||
|
||||
while ((!infile.eof()) && (!nextword))
|
||||
{
|
||||
infile.get(c);
|
||||
if (_spacesigns.find(c) != std::string::npos)
|
||||
if (s != "")
|
||||
nextword = true;
|
||||
if (_spacesigns.find(c) == std::string::npos)
|
||||
s += c;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string TrimSpace(std::string &s)
|
||||
{
|
||||
/*int ii;
|
||||
|
||||
switch (Just)
|
||||
{
|
||||
case CutLeft:
|
||||
{
|
||||
ii = 0;
|
||||
while ((ii < s.length()) && (s[ii + 1] == (char)" "))
|
||||
++ii;
|
||||
s = s.substr(ii + 1, s.length() - ii);
|
||||
}
|
||||
case CutRight:
|
||||
{
|
||||
ii = s.length();
|
||||
while ((ii > 0) && (s[ii] == (char)" "))
|
||||
--ii;
|
||||
s = s.substr(0, ii);
|
||||
}
|
||||
case CutBoth:
|
||||
{
|
||||
s = TrimSpace(s, CutLeft);
|
||||
s = TrimSpace(s, CutRight);
|
||||
}
|
||||
}
|
||||
return s;*/
|
||||
|
||||
if (s.empty())
|
||||
return "";
|
||||
size_t first = s.find_first_not_of(' ');
|
||||
if (first == std::string::npos)
|
||||
return "";
|
||||
size_t last = s.find_last_not_of(' ');
|
||||
return s.substr(first, (last - first + 1));
|
||||
}
|
||||
|
||||
char* TrimAndReduceSpaces(const char* s)
|
||||
{ // redukuje spacje pomiedzy znakami do jednej
|
||||
char* tmp = nullptr;
|
||||
if (s)
|
||||
{
|
||||
|
||||
tmp = _strdup(s);
|
||||
char* from = tmp + strspn(tmp, " ");
|
||||
char* to = tmp;
|
||||
|
||||
do if ((*to = *from++) == ' ')
|
||||
from += strspn(from, " ");
|
||||
while (*to++);
|
||||
|
||||
while (*--to == ' ')
|
||||
*to = '\0';
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
std::string ExtractKeyWord(std::string InS, std::string KeyWord)
|
||||
{
|
||||
std::string s;
|
||||
InS = InS + " ";
|
||||
std::size_t kwp = InS.find(KeyWord);
|
||||
if (kwp != std::string::npos)
|
||||
{
|
||||
s = InS.substr(kwp, InS.length());
|
||||
//s = Copy(InS, kwp, length(InS));
|
||||
s = s.substr(0, s.find_first_of(" "));
|
||||
//s = Copy(s, 1, Pos(" ", s) - 1);
|
||||
}
|
||||
else
|
||||
s = "";
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string DUE(std::string s) /*Delete Before Equal sign*/
|
||||
{
|
||||
//DUE = Copy(s, Pos("=", s) + 1, length(s));
|
||||
@@ -473,8 +381,7 @@ void ComputeALine(double X0, double Y0, double Xn, double Yn, double L, double R
|
||||
bool FileExists( std::string const &Filename ) {
|
||||
|
||||
std::ifstream file( Filename );
|
||||
if( file.is_open() == false ) { return false; }
|
||||
else { return true; }
|
||||
return( true == file.is_open() );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -105,11 +105,6 @@ bool FuzzyLogicAI(double Test, double Threshold, double Probability);
|
||||
/*to samo ale zawsze niezaleznie od DebugFlag*/
|
||||
|
||||
/*operacje na stringach*/
|
||||
std::string ReadWord( std::ifstream& infile); /*czyta slowo z wiersza pliku tekstowego*/
|
||||
//std::string Ups(std::string s);
|
||||
//std::string TrimSpace(std::string &s);
|
||||
//char* TrimAndReduceSpaces(const char* s);
|
||||
//std::string ExtractKeyWord(std::string InS, std::string KeyWord); /*wyciaga slowo kluczowe i lancuch do pierwszej spacji*/
|
||||
std::string DUE(std::string s); /*Delete Until Equal sign*/
|
||||
std::string DWE(std::string s); /*Delete While Equal sign*/
|
||||
std::string ExchangeCharInString(std::string const &s, const char &aim, const char &target); // zamienia jeden znak na drugi
|
||||
|
||||
@@ -56,7 +56,8 @@ void TModelsManager::Init()
|
||||
*/
|
||||
void TModelsManager::Free()
|
||||
{
|
||||
SafeDeleteArray(Models);
|
||||
delete[] Models;
|
||||
Models = nullptr;
|
||||
}
|
||||
|
||||
TModel3d * TModelsManager::LoadModel(std::string const &Name, bool dynamic)
|
||||
|
||||
@@ -14,16 +14,12 @@ http://mozilla.org/MPL/2.0/.
|
||||
class TMdlContainer
|
||||
{
|
||||
friend class TModelsManager;
|
||||
TMdlContainer()
|
||||
{
|
||||
Model = NULL;
|
||||
};
|
||||
~TMdlContainer()
|
||||
{
|
||||
SafeDelete(Model);
|
||||
delete Model;
|
||||
};
|
||||
TModel3d * LoadModel(std::string const &NewName, bool dynamic);
|
||||
TModel3d *Model;
|
||||
TModel3d *Model{ nullptr };
|
||||
std::string Name;
|
||||
};
|
||||
|
||||
|
||||
58
Model3d.cpp
58
Model3d.cpp
@@ -1577,8 +1577,12 @@ TModel3d::~TModel3d()
|
||||
}
|
||||
else
|
||||
{ // wczytano z pliku binarnego (jest właścicielem tablic)
|
||||
m_pVNT = NULL; // nie usuwać tego, bo wskazuje na iModel
|
||||
Root = NULL;
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
m_pVNT = nullptr; // nie usuwać tego, bo wskazuje na iModel
|
||||
#else
|
||||
m_pVNT.clear();
|
||||
#endif
|
||||
Root = nullptr;
|
||||
delete[] iModel; // usuwamy cały wczytany plik i to wystarczy
|
||||
}
|
||||
// później się jeszcze usuwa obiekt z którego dziedziczymy tabelę VBO
|
||||
@@ -1801,7 +1805,11 @@ void TModel3d::SaveToBinFile(char const *FileName)
|
||||
transforms[i].serialize_float32(s);
|
||||
|
||||
MakeArray(iNumVerts);
|
||||
Root->RaArrayFill(m_pVNT);
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
Root->RaArrayFill(m_pVNT);
|
||||
#else
|
||||
Root->RaArrayFill( m_pVNT.data() );
|
||||
#endif
|
||||
sn_utils::ls_uint32(s, MAKE_ID4('V', 'N', 'T', '0'));
|
||||
sn_utils::ls_uint32(s, 8 + iNumVerts * 32);
|
||||
for (size_t i = 0; i < (size_t)iNumVerts; i++)
|
||||
@@ -1886,7 +1894,11 @@ void TSubModel::deserialize(std::istream &s)
|
||||
|
||||
void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||
{
|
||||
m_pVNT = nullptr;
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
m_pVNT = nullptr;
|
||||
#else
|
||||
m_pVNT.clear();
|
||||
#endif
|
||||
Root = nullptr;
|
||||
float4x4 *tm = nullptr;
|
||||
|
||||
@@ -1900,13 +1912,22 @@ void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||
|
||||
if (type == MAKE_ID4('V', 'N', 'T', '0'))
|
||||
{
|
||||
if (m_pVNT != nullptr)
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
if (m_pVNT != nullptr)
|
||||
#else
|
||||
if( false == m_pVNT.empty() )
|
||||
#endif
|
||||
throw std::runtime_error("e3d: duplicated VNT chunk");
|
||||
|
||||
size_t vt_cnt = size / 32;
|
||||
iNumVerts = (int)vt_cnt;
|
||||
m_nVertexCount = (int)vt_cnt;
|
||||
m_pVNT = new CVertNormTex[vt_cnt];
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
assert( m_pVNT == nullptr );
|
||||
m_pVNT = new CVertNormTex[vt_cnt];
|
||||
#else
|
||||
m_pVNT.resize( vt_cnt );
|
||||
#endif
|
||||
for (size_t i = 0; i < vt_cnt; i++)
|
||||
m_pVNT[i].deserialize(s);
|
||||
}
|
||||
@@ -1967,12 +1988,20 @@ void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||
if (!Root)
|
||||
throw std::runtime_error("e3d: no submodels");
|
||||
|
||||
if (!m_pVNT)
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
if (!m_pVNT)
|
||||
#else
|
||||
if(m_pVNT.empty() )
|
||||
#endif
|
||||
throw std::runtime_error("e3d: no vertices");
|
||||
|
||||
for (size_t i = 0; (int)i < iSubModelsCount; i++)
|
||||
{
|
||||
Root[i].BinInit(Root, tm, (float8*)m_pVNT, &Textures, &Names, dynamic);
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
Root[i].BinInit(Root, tm, (float8*)m_pVNT, &Textures, &Names, dynamic);
|
||||
#else
|
||||
Root[ i ].BinInit( Root, tm, (float8*)m_pVNT.data(), &Textures, &Names, dynamic );
|
||||
#endif
|
||||
|
||||
if (Root[i].ChildGet())
|
||||
Root[i].ChildGet()->Parent = &Root[i];
|
||||
@@ -2151,11 +2180,18 @@ void TModel3d::Init()
|
||||
*/
|
||||
if (Global::bUseVBO)
|
||||
{
|
||||
if (!m_pVNT) // jeśli nie ma jeszcze tablicy (wczytano z pliku
|
||||
// tekstowego)
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
if (!m_pVNT) // jeśli nie ma jeszcze tablicy (wczytano z pliku tekstowego)
|
||||
#else
|
||||
if( m_pVNT.empty() )
|
||||
#endif
|
||||
{ // tworzenie tymczasowej tablicy z wierzchołkami całego modelu
|
||||
MakeArray(iNumVerts); // tworzenie tablic dla VBO
|
||||
Root->RaArrayFill(m_pVNT); // wypełnianie tablicy
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
Root->RaArrayFill(m_pVNT); // wypełnianie tablicy
|
||||
#else
|
||||
Root->RaArrayFill( m_pVNT.data() ); // wypełnianie tablicy
|
||||
#endif
|
||||
BuildVBOs(); // tworzenie VBO i usuwanie tablicy z pamięci
|
||||
}
|
||||
else
|
||||
|
||||
@@ -40,7 +40,7 @@ void TRealSound::Init(std::string const &SoundName, double DistanceAttenuation,
|
||||
bool Dynamic, bool freqmod, double rmin)
|
||||
{
|
||||
// Nazwa=SoundName; //to tak raczej nie zadziała, (SoundName) jest tymczasowe
|
||||
pSound = TSoundsManager::GetFromName(SoundName.c_str(), Dynamic, &fFrequency);
|
||||
pSound = TSoundsManager::GetFromName(SoundName, Dynamic, &fFrequency);
|
||||
if (pSound)
|
||||
{
|
||||
if (freqmod)
|
||||
@@ -48,8 +48,7 @@ void TRealSound::Init(std::string const &SoundName, double DistanceAttenuation,
|
||||
{ // dla modulowanych nie może być zmiany mnożnika, bo częstotliwość w nagłówku byłą
|
||||
// ignorowana, a mogła być inna niż 22050
|
||||
fFrequency = 22050.0;
|
||||
ErrorLog("Bad sound: " + std::string(SoundName) +
|
||||
", as modulated, should have 22.05kHz in header");
|
||||
ErrorLog("Bad sound: " + SoundName + ", as modulated, should have 22.05kHz in header");
|
||||
}
|
||||
AM = 1.0;
|
||||
pSound->SetVolume(DSBVOLUME_MIN);
|
||||
@@ -57,7 +56,7 @@ void TRealSound::Init(std::string const &SoundName, double DistanceAttenuation,
|
||||
else
|
||||
{ // nie ma dźwięku, to jest wysyp
|
||||
AM = 0;
|
||||
ErrorLog("Missed sound: " + std::string(SoundName));
|
||||
ErrorLog("Missed sound: " + SoundName);
|
||||
}
|
||||
if (DistanceAttenuation > 0.0)
|
||||
{
|
||||
@@ -268,26 +267,8 @@ void TTextSound::Play(double Volume, int Looping, bool ListenerInside, vector3 N
|
||||
{ // jeśli ma powiązany tekst
|
||||
DWORD stat;
|
||||
pSound->GetStatus(&stat);
|
||||
if (!(stat & DSBSTATUS_PLAYING)) // jeśli nie jest aktualnie odgrywany
|
||||
{
|
||||
/*
|
||||
std::string t( asText );
|
||||
size_t i;
|
||||
do
|
||||
{ // na razie zrobione jakkolwiek, docelowo przenieść teksty do tablicy nazw
|
||||
i = t.find('\r'); // znak nowej linii
|
||||
if( i == std::string::npos ) {
|
||||
Global::tranTexts.Add( t, fTime, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
Global::tranTexts.Add(t.substr(0, i), fTime, true);
|
||||
t.erase(0, i + 1);
|
||||
while (t.empty() ? false : (unsigned char)(t[1]) < 33)
|
||||
t.erase(0, 1);
|
||||
}
|
||||
} while (i != std::string::npos);
|
||||
*/
|
||||
if (!(stat & DSBSTATUS_PLAYING)) {
|
||||
// jeśli nie jest aktualnie odgrywany
|
||||
Global::tranTexts.Add( asText, fTime, true );
|
||||
}
|
||||
}
|
||||
|
||||
116
Sound.cpp
116
Sound.cpp
@@ -14,7 +14,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Usefull.h"
|
||||
#include "mczapkie/mctools.h"
|
||||
#include "WavRead.h"
|
||||
//#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
|
||||
#define SAFE_RELEASE(p) \
|
||||
{ \
|
||||
if (p) \
|
||||
@@ -24,43 +24,31 @@ http://mozilla.org/MPL/2.0/.
|
||||
} \
|
||||
}
|
||||
|
||||
char Directory[] = "sounds\\";
|
||||
|
||||
LPDIRECTSOUND TSoundsManager::pDS;
|
||||
LPDIRECTSOUNDNOTIFY TSoundsManager::pDSNotify;
|
||||
|
||||
int TSoundsManager::Count = 0;
|
||||
TSoundContainer *TSoundsManager::First = NULL;
|
||||
|
||||
TSoundContainer::TSoundContainer(LPDIRECTSOUND pDS, const char *Directory, const char *strFileName,
|
||||
int NConcurrent)
|
||||
TSoundContainer::TSoundContainer(LPDIRECTSOUND pDS, std::string const &Directory, std::string const &Filename, int NConcurrent)
|
||||
{ // wczytanie pliku dźwiękowego
|
||||
int hr = 111;
|
||||
DSBuffer = NULL; // na początek, gdyby uruchomić dźwięków się nie udało
|
||||
|
||||
DSBuffer = nullptr; // na początek, gdyby uruchomić dźwięków się nie udało
|
||||
Concurrent = NConcurrent;
|
||||
|
||||
Oldest = 0;
|
||||
// strcpy(Name, strFileName);
|
||||
|
||||
strcpy(Name, Directory);
|
||||
strcat(Name, strFileName);
|
||||
|
||||
CWaveSoundRead *pWaveSoundRead;
|
||||
m_name = Directory + Filename;
|
||||
|
||||
// Create a new wave file class
|
||||
pWaveSoundRead = new CWaveSoundRead();
|
||||
std::shared_ptr<CWaveSoundRead> pWaveSoundRead = std::make_shared<CWaveSoundRead>();
|
||||
|
||||
// Load the wave file
|
||||
if (FAILED(pWaveSoundRead->Open(Name)))
|
||||
if (FAILED(pWaveSoundRead->Open(strdup(strFileName))))
|
||||
{
|
||||
// SetFileUI( hDlg, TEXT("Bad wave file.") );
|
||||
ErrorLog( "Missed sound: " + std::string( strFileName ) );
|
||||
return;
|
||||
}
|
||||
if( ( FAILED( pWaveSoundRead->Open( m_name ) ) )
|
||||
&& ( FAILED( pWaveSoundRead->Open( Filename ) ) ) ) {
|
||||
ErrorLog( "Missed sound: " + Filename );
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(Name, ToLower(strFileName).c_str());
|
||||
m_name = ToLower( Filename );
|
||||
|
||||
// Set up the direct sound buffer, and only request the flags needed
|
||||
// since each requires some overhead and limits if the buffer can
|
||||
@@ -133,27 +121,10 @@ TSoundContainer::TSoundContainer(LPDIRECTSOUND pDS, const char *Directory, const
|
||||
// We dont need the wav file data buffer anymore, so delete it
|
||||
delete[] pbWavData;
|
||||
|
||||
delete pWaveSoundRead;
|
||||
|
||||
DSBuffers.push(DSBuffer);
|
||||
|
||||
/*
|
||||
for (int i=1; i<Concurrent; i++)
|
||||
{
|
||||
if( FAILED( hr= pDS->DuplicateSoundBuffer(pDSBuffer[0],&(pDSBuffer[i]))))
|
||||
{
|
||||
Concurrent= i;
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
};*/
|
||||
};
|
||||
TSoundContainer::~TSoundContainer()
|
||||
{
|
||||
// for (int i=Concurrent-1; i>=0; i--)
|
||||
// SAFE_RELEASE( pDSBuffer[i] );
|
||||
// free(pDSBuffer);
|
||||
while (!DSBuffers.empty())
|
||||
{
|
||||
SAFE_RELEASE(DSBuffers.top());
|
||||
@@ -185,84 +156,51 @@ void TSoundsManager::Free()
|
||||
SAFE_RELEASE(pDS);
|
||||
};
|
||||
|
||||
TSoundContainer * TSoundsManager::LoadFromFile(const char *Dir, const char *Name, int Concurrent)
|
||||
TSoundContainer * TSoundsManager::LoadFromFile( std::string const &Dir, std::string const &Filename, int Concurrent)
|
||||
{
|
||||
TSoundContainer *Tmp = First;
|
||||
First = new TSoundContainer(pDS, Dir, Name, Concurrent);
|
||||
First->Next = Tmp;
|
||||
TSoundContainer *tmp = First;
|
||||
First = new TSoundContainer(pDS, Dir, Filename, Concurrent);
|
||||
First->Next = tmp;
|
||||
Count++;
|
||||
return First; // albo NULL, jak nie wyjdzie (na razie zawsze wychodzi)
|
||||
};
|
||||
|
||||
void TSoundsManager::LoadSounds(char *Directory)
|
||||
{ // wczytanie wszystkich plików z katalogu - mało elastyczne
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE handle = FindFirstFile("sounds\\*.wav", &FindFileData);
|
||||
if (handle != INVALID_HANDLE_VALUE)
|
||||
do
|
||||
{
|
||||
LoadFromFile(Directory, FindFileData.cFileName, 1);
|
||||
} while (FindNextFile(handle, &FindFileData));
|
||||
FindClose(handle);
|
||||
};
|
||||
|
||||
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(const char *Name, bool Dynamic, float *fSamplingRate)
|
||||
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(std::string const &Name, bool Dynamic, float *fSamplingRate)
|
||||
{ // wyszukanie dźwięku w pamięci albo wczytanie z pliku
|
||||
std::string name{ ToLower(Name) };
|
||||
std::string file;
|
||||
if (Dynamic)
|
||||
{ // próba wczytania z katalogu pojazdu
|
||||
file = Global::asCurrentDynamicPath + Name;
|
||||
file = Global::asCurrentDynamicPath + name;
|
||||
if (FileExists(file))
|
||||
Name = file.c_str(); // nowa nazwa
|
||||
name = file; // nowa nazwa
|
||||
else
|
||||
Dynamic = false; // wczytanie z "sounds/"
|
||||
}
|
||||
TSoundContainer *Next = First;
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (strcmp(Name, Next->Name) == 0)
|
||||
{
|
||||
if( name == Next->m_name ) {
|
||||
|
||||
if (fSamplingRate)
|
||||
*fSamplingRate = Next->fSamplingRate; // częstotliwość
|
||||
return (Next->GetUnique(pDS));
|
||||
// DSBuffers.
|
||||
/*
|
||||
Next->pDSBuffer[Next->Oldest]->Stop();
|
||||
Next->pDSBuffer[Next->Oldest]->SetCurrentPosition(0);
|
||||
if (Next->Oldest<Next->Concurrent-1)
|
||||
{
|
||||
Next->Oldest++;
|
||||
return (Next->pDSBuffer[Next->Oldest-1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Next->Oldest= 0;
|
||||
return (Next->pDSBuffer[Next->Concurrent-1]);
|
||||
};
|
||||
|
||||
/* for (int j=0; j<Next->Concurrent; j++)
|
||||
{
|
||||
|
||||
Next->pDSBuffer[j]->GetStatus(&dwStatus);
|
||||
if ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING)
|
||||
return (Next->pDSBuffer[j]);
|
||||
} */
|
||||
}
|
||||
else
|
||||
Next = Next->Next;
|
||||
};
|
||||
if (Dynamic) // wczytanie z katalogu pojazdu
|
||||
Next = LoadFromFile("", Name, 1);
|
||||
Next = LoadFromFile("", name, 1);
|
||||
else
|
||||
Next = LoadFromFile(Directory, Name, 1);
|
||||
Next = LoadFromFile(szSoundPath, name, 1);
|
||||
if (Next)
|
||||
{ //
|
||||
if (fSamplingRate)
|
||||
*fSamplingRate = Next->fSamplingRate; // częstotliwość
|
||||
return Next->GetUnique(pDS);
|
||||
}
|
||||
ErrorLog("Missed sound: " + std::string(Name) );
|
||||
return (NULL);
|
||||
ErrorLog("Missed sound: " + Name );
|
||||
return (nullptr);
|
||||
};
|
||||
|
||||
void TSoundsManager::RestoreAll()
|
||||
@@ -299,10 +237,6 @@ void TSoundsManager::RestoreAll()
|
||||
};
|
||||
};
|
||||
|
||||
// void TSoundsManager::Init(char *Name, int Concurrent)
|
||||
// TSoundsManager::TSoundsManager(HWND hWnd)
|
||||
// void TSoundsManager::Init(HWND hWnd, char *NDirectory)
|
||||
|
||||
void TSoundsManager::Init(HWND hWnd)
|
||||
{
|
||||
|
||||
|
||||
38
Sound.h
38
Sound.h
@@ -7,56 +7,44 @@ obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef SoundH
|
||||
#define SoundH
|
||||
#pragma once
|
||||
|
||||
#include <stack>
|
||||
#include <dsound.h>
|
||||
|
||||
typedef LPDIRECTSOUNDBUFFER PSound;
|
||||
|
||||
// inline Playing(PSound Sound)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
class TSoundContainer
|
||||
{
|
||||
public:
|
||||
public:
|
||||
int Concurrent;
|
||||
int Oldest;
|
||||
char Name[80];
|
||||
std::string m_name;
|
||||
LPDIRECTSOUNDBUFFER DSBuffer;
|
||||
float fSamplingRate; // częstotliwość odczytana z pliku
|
||||
int iBitsPerSample; // ile bitów na próbkę
|
||||
TSoundContainer *Next;
|
||||
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
|
||||
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
|
||||
TSoundContainer(LPDIRECTSOUND pDS, const char *Directory, const char *strFileName, int NConcurrent);
|
||||
|
||||
TSoundContainer(LPDIRECTSOUND pDS, std::string const &Directory, std::string const &Filename, int NConcurrent);
|
||||
~TSoundContainer();
|
||||
LPDIRECTSOUNDBUFFER GetUnique( LPDIRECTSOUND pDS );
|
||||
};
|
||||
|
||||
class TSoundsManager
|
||||
{
|
||||
private:
|
||||
private:
|
||||
static LPDIRECTSOUND pDS;
|
||||
static LPDIRECTSOUNDNOTIFY pDSNotify;
|
||||
// static char Directory[80];
|
||||
static int Count;
|
||||
static TSoundContainer *First;
|
||||
static TSoundContainer * LoadFromFile(const char *Dir, const char *Name, int Concurrent);
|
||||
static int Count;
|
||||
|
||||
public:
|
||||
// TSoundsManager(HWND hWnd);
|
||||
// static void Init(HWND hWnd, char *NDirectory);
|
||||
static void Init(HWND hWnd);
|
||||
static TSoundContainer * LoadFromFile( std::string const &Directory, std::string const &FileName, int Concurrent);
|
||||
|
||||
public:
|
||||
~TSoundsManager();
|
||||
static void Init( HWND hWnd );
|
||||
static void Free();
|
||||
static void Init(char *Name, int Concurrent);
|
||||
static void LoadSounds(char *Directory);
|
||||
static LPDIRECTSOUNDBUFFER GetFromName(const char *Name, bool Dynamic, float *fSamplingRate = NULL);
|
||||
static LPDIRECTSOUNDBUFFER GetFromName( std::string const &Name, bool Dynamic, float *fSamplingRate = NULL );
|
||||
static void RestoreAll();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
50
Train.cpp
50
Train.cpp
@@ -5820,6 +5820,8 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
|
||||
// NOTE: yaml-style comments are disabled until conflict in use of # is resolved
|
||||
// parser.addCommentStyle( "#", "\n" );
|
||||
//Wartości domyślne by nie wysypywało przy wybrakowanych mmd @240816 Stele
|
||||
// NOTE: should be no longer needed as safety checks were added,
|
||||
// but leaving the defaults for the sake of incomplete mmd files
|
||||
dsbPneumaticSwitch = TSoundsManager::GetFromName("silence1.wav", true);
|
||||
dsbBufferClamp = TSoundsManager::GetFromName("en57_bufferclamp.wav", true);
|
||||
dsbCouplerDetach = TSoundsManager::GetFromName("couplerdetach.wav", true);
|
||||
@@ -5847,67 +5849,67 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
|
||||
{
|
||||
// nastawnik:
|
||||
dsbNastawnikJazdy =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "ctrlscnd:")
|
||||
{
|
||||
// hunter-081211: nastawnik bocznikowania
|
||||
dsbNastawnikBocz =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "reverserkey:")
|
||||
{
|
||||
// hunter-131211: dzwiek kierunkowego
|
||||
dsbReverserKey =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "buzzer:")
|
||||
{
|
||||
// bzyczek shp:
|
||||
dsbBuzzer =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "slipalarm:")
|
||||
{
|
||||
// Bombardier 011010: alarm przy poslizgu:
|
||||
dsbSlipAlarm =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "tachoclock:")
|
||||
{
|
||||
// cykanie rejestratora:
|
||||
dsbHasler =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "switch:")
|
||||
{
|
||||
// przelaczniki:
|
||||
dsbSwitch =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "pneumaticswitch:")
|
||||
{
|
||||
// stycznik EP:
|
||||
dsbPneumaticSwitch =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "wejscie_na_bezoporow:")
|
||||
{
|
||||
// hunter-111211: wydzielenie wejscia na bezoporowa i na drugi uklad do pliku
|
||||
dsbWejscie_na_bezoporow =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "wejscie_na_drugi_uklad:")
|
||||
{
|
||||
|
||||
dsbWejscie_na_drugi_uklad =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "relay:")
|
||||
{
|
||||
// styczniki itp:
|
||||
dsbRelay =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
if (!dsbWejscie_na_bezoporow)
|
||||
{ // hunter-111211: domyslne, gdy brak
|
||||
dsbWejscie_na_bezoporow =
|
||||
@@ -5923,39 +5925,37 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
|
||||
{
|
||||
// wylaczniki pneumatyczne:
|
||||
dsbPneumaticRelay =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "couplerattach:")
|
||||
{
|
||||
// laczenie:
|
||||
dsbCouplerAttach =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "couplerstretch:")
|
||||
{
|
||||
// laczenie:
|
||||
dsbCouplerStretch = TSoundsManager::GetFromName(
|
||||
parser.getToken<std::string>().c_str(),
|
||||
true); // McZapkie-090503: PROWIZORKA!!! "en57_couplerstretch.wav"
|
||||
dsbCouplerStretch =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "couplerdetach:")
|
||||
{
|
||||
// rozlaczanie:
|
||||
dsbCouplerDetach =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "bufferclamp:")
|
||||
{
|
||||
// laczenie:
|
||||
dsbBufferClamp = TSoundsManager::GetFromName(
|
||||
parser.getToken<std::string>().c_str(),
|
||||
true); // McZapkie-090503: PROWIZORKA!!! "en57_bufferclamp.wav"
|
||||
dsbBufferClamp =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "ignition:")
|
||||
{
|
||||
// odpalanie silnika
|
||||
dsbDieselIgnition =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "brakesound:")
|
||||
{
|
||||
@@ -6073,25 +6073,25 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
|
||||
{
|
||||
// podniesienie patyka:
|
||||
dsbPantUp =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "pantographdown:")
|
||||
{
|
||||
// podniesienie patyka:
|
||||
dsbPantDown =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "doorclose:")
|
||||
{
|
||||
// zamkniecie drzwi:
|
||||
dsbDoorClose =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
else if (token == "dooropen:")
|
||||
{
|
||||
// otwarcie drzwi:
|
||||
dsbDoorOpen =
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>().c_str(), true);
|
||||
TSoundsManager::GetFromName(parser.getToken<std::string>(), true);
|
||||
}
|
||||
|
||||
} while (token != "");
|
||||
|
||||
20
VBO.cpp
20
VBO.cpp
@@ -44,7 +44,9 @@ void CVertNormTex::serialize(std::ostream &s)
|
||||
|
||||
CMesh::CMesh()
|
||||
{ // utworzenie pustego obiektu
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
m_pVNT = nullptr;
|
||||
#endif
|
||||
m_nVertexCount = -1;
|
||||
m_nVBOVertices = 0; // nie zarezerwowane
|
||||
};
|
||||
@@ -57,7 +59,13 @@ CMesh::~CMesh()
|
||||
void CMesh::MakeArray(int n)
|
||||
{ // tworzenie tablic
|
||||
m_nVertexCount = n;
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
assert( m_pVNT == nullptr );
|
||||
m_pVNT = new CVertNormTex[m_nVertexCount]; // przydzielenie pamięci dla tablicy
|
||||
#else
|
||||
m_pVNT.clear();
|
||||
m_pVNT.resize( m_nVertexCount );
|
||||
#endif
|
||||
};
|
||||
|
||||
void CMesh::BuildVBOs(bool del)
|
||||
@@ -65,11 +73,19 @@ void CMesh::BuildVBOs(bool del)
|
||||
// pobierz numer VBO oraz ustaw go jako aktywny
|
||||
glGenBuffers(1, &m_nVBOVertices); // pobierz numer
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_nVBOVertices); // ustaw bufor jako aktualny
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
glBufferData(GL_ARRAY_BUFFER, m_nVertexCount * sizeof(CVertNormTex), m_pVNT, GL_STATIC_DRAW);
|
||||
#else
|
||||
glBufferData( GL_ARRAY_BUFFER, m_nVertexCount * sizeof( CVertNormTex ), m_pVNT.data(), GL_STATIC_DRAW );
|
||||
#endif
|
||||
// WriteLog("Assigned VBO number "+AnsiString(m_nVBOVertices)+", vertices:
|
||||
// "+AnsiString(m_nVertexCount));
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
if (del)
|
||||
SafeDeleteArray(m_pVNT); // wierzchołki już się nie przydadzą
|
||||
#else
|
||||
m_pVNT.clear();
|
||||
#endif
|
||||
};
|
||||
|
||||
void CMesh::Clear()
|
||||
@@ -82,7 +98,11 @@ void CMesh::Clear()
|
||||
}
|
||||
m_nVBOVertices = 0;
|
||||
m_nVertexCount = -1; // do ponownego zliczenia
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
SafeDeleteArray(m_pVNT); // usuwanie tablic, gdy były użyte do Vertex Array
|
||||
#else
|
||||
m_pVNT.clear();
|
||||
#endif
|
||||
};
|
||||
|
||||
bool CMesh::StartVBO()
|
||||
|
||||
7
VBO.h
7
VBO.h
@@ -9,6 +9,9 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#ifndef VBOH
|
||||
#define VBOH
|
||||
|
||||
#define EU07_USE_OLD_VERTEXBUFFER
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
class CVertNormTex
|
||||
{
|
||||
@@ -30,7 +33,11 @@ class CMesh
|
||||
{ // wsparcie dla VBO
|
||||
public:
|
||||
int m_nVertexCount; // liczba wierzchołków
|
||||
#ifdef EU07_USE_OLD_VERTEXBUFFER
|
||||
CVertNormTex *m_pVNT;
|
||||
#else
|
||||
std::vector<CVertNormTex> m_pVNT;
|
||||
#endif
|
||||
unsigned int m_nVBOVertices; // numer VBO z wierzchołkami
|
||||
CMesh();
|
||||
~CMesh();
|
||||
|
||||
24
usefull.h
24
usefull.h
@@ -11,17 +11,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#define SafeDelete(a) \
|
||||
{ \
|
||||
delete (a); \
|
||||
a = nullptr; \
|
||||
}
|
||||
#define SafeDeleteArray(a) \
|
||||
{ \
|
||||
delete[](a); \
|
||||
a = nullptr; \
|
||||
}
|
||||
|
||||
#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
|
||||
|
||||
#define DegToRad(a) ((M_PI / 180.0) * (a)) //(a) w nawiasie, bo może być dodawaniem
|
||||
@@ -31,9 +20,22 @@ http://mozilla.org/MPL/2.0/.
|
||||
#define asSceneryPath std::string("scenery\\")
|
||||
#define szSceneryPath "scenery\\"
|
||||
#define szTexturePath "textures\\"
|
||||
#define szSoundPath "sounds\\"
|
||||
|
||||
#define MAKE_ID4(a,b,c,d) (((std::uint32_t)(d)<<24)|((std::uint32_t)(c)<<16)|((std::uint32_t)(b)<<8)|(std::uint32_t)(a))
|
||||
|
||||
template <typename _Type>
|
||||
void SafeDelete( _Type &Pointer ) {
|
||||
delete Pointer;
|
||||
Pointer = nullptr;
|
||||
}
|
||||
|
||||
template <typename _Type>
|
||||
void SafeDeleteArray( _Type &Pointer ) {
|
||||
delete[] Pointer;
|
||||
Pointer = nullptr;
|
||||
}
|
||||
|
||||
template <typename _Type>
|
||||
_Type
|
||||
clamp( _Type const Value, _Type const Min, _Type const Max ) {
|
||||
|
||||
33
wavread.cpp
33
wavread.cpp
@@ -17,26 +17,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "WavRead.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines, constants, and global variables
|
||||
//-----------------------------------------------------------------------------
|
||||
#define SAFE_DELETE(p) \
|
||||
{ \
|
||||
if (p) \
|
||||
{ \
|
||||
delete (p); \
|
||||
(p) = NULL; \
|
||||
} \
|
||||
}
|
||||
#define SAFE_RELEASE(p) \
|
||||
{ \
|
||||
if (p) \
|
||||
{ \
|
||||
(p)->Release(); \
|
||||
(p) = NULL; \
|
||||
} \
|
||||
}
|
||||
#include "usefull.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: ReadMMIO()
|
||||
@@ -122,13 +103,13 @@ HRESULT ReadMMIO(HMMIO hmmioIn, MMCKINFO *pckInRIFF, WAVEFORMATEX **ppwfxInfo)
|
||||
// so the data can be easily read with WaveReadFile. Returns 0 if
|
||||
// successful, the error code if not.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT WaveOpenFile(CHAR *strFileName, HMMIO *phmmioIn, WAVEFORMATEX **ppwfxInfo,
|
||||
HRESULT WaveOpenFile( std::string const &Filename, HMMIO *phmmioIn, WAVEFORMATEX **ppwfxInfo,
|
||||
MMCKINFO *pckInRIFF)
|
||||
{
|
||||
HRESULT hr;
|
||||
HMMIO hmmioIn = NULL;
|
||||
|
||||
if (NULL == (hmmioIn = mmioOpen(strFileName, NULL, MMIO_ALLOCBUF | MMIO_READ)))
|
||||
if (NULL == (hmmioIn = mmioOpen(const_cast<char*>(Filename.c_str()), NULL, MMIO_ALLOCBUF | MMIO_READ)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(hr = ReadMMIO(hmmioIn, pckInRIFF, ppwfxInfo)))
|
||||
@@ -228,20 +209,20 @@ CWaveSoundRead::CWaveSoundRead()
|
||||
CWaveSoundRead::~CWaveSoundRead()
|
||||
{
|
||||
Close();
|
||||
SAFE_DELETE(m_pwfx);
|
||||
SafeDelete(m_pwfx);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: Open()
|
||||
// Desc: Opens a wave file for reading
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveSoundRead::Open(CHAR *strFilename)
|
||||
HRESULT CWaveSoundRead::Open(std::string const &Filename)
|
||||
{
|
||||
SAFE_DELETE(m_pwfx);
|
||||
SafeDelete(m_pwfx);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
if (FAILED(hr = WaveOpenFile(strFilename, &m_hmmioIn, &m_pwfx, &m_ckInRiff)))
|
||||
if (FAILED(hr = WaveOpenFile(Filename, &m_hmmioIn, &m_pwfx, &m_ckInRiff)))
|
||||
return hr;
|
||||
|
||||
if (FAILED(hr = Reset()))
|
||||
|
||||
10
wavread.h
10
wavread.h
@@ -15,12 +15,12 @@ http://mozilla.org/MPL/2.0/.
|
||||
//
|
||||
// Copyright (c) 1999 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef WAVE_READ_H
|
||||
#define WAVE_READ_H
|
||||
#pragma once
|
||||
|
||||
#include <mmsystem.h>
|
||||
#include <string>
|
||||
|
||||
HRESULT WaveOpenFile(CHAR *strFileName, HMMIO *phmmioIn, WAVEFORMATEX **ppwfxInfo,
|
||||
HRESULT WaveOpenFile(std::string const &Filename, HMMIO *phmmioIn, WAVEFORMATEX **ppwfxInfo,
|
||||
MMCKINFO *pckInRIFF);
|
||||
HRESULT WaveStartDataRead(HMMIO *phmmioIn, MMCKINFO *pckIn, MMCKINFO *pckInRIFF);
|
||||
HRESULT WaveReadFile(HMMIO hmmioIn, UINT cbRead, BYTE *pbDest, MMCKINFO *pckIn, UINT *cbActualRead);
|
||||
@@ -41,10 +41,8 @@ class CWaveSoundRead
|
||||
CWaveSoundRead();
|
||||
~CWaveSoundRead();
|
||||
|
||||
HRESULT Open(CHAR *strFilename);
|
||||
HRESULT Open(std::string const &Filename);
|
||||
HRESULT Reset();
|
||||
HRESULT Read(UINT nSizeToRead, BYTE *pbData, UINT *pnSizeRead);
|
||||
HRESULT Close();
|
||||
};
|
||||
|
||||
#endif WAVE_READ_H
|
||||
|
||||
Reference in New Issue
Block a user