本文整理汇总了C++中DiskFile::open方法的典型用法代码示例。如果您正苦于以下问题:C++ DiskFile::open方法的具体用法?C++ DiskFile::open怎么用?C++ DiskFile::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiskFile
的用法示例。
在下文中一共展示了DiskFile::open方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
result WavStream::load(const char *aFilename)
{
delete[] mFilename;
delete mMemFile;
mMemFile = 0;
mFilename = 0;
mSampleCount = 0;
DiskFile fp;
int res = fp.open(aFilename);
if (res != SO_NO_ERROR)
return res;
int len = (int)strlen(aFilename);
mFilename = new char[len+1];
memcpy(mFilename, aFilename, len);
mFilename[len] = 0;
res = parse(&fp);
if (res != SO_NO_ERROR)
{
delete[] mFilename;
mFilename = 0;
return res;
}
return 0;
}
示例2: format
Image::Image(const char* filename) : format(RGBA32) {
printf("Image %s\n", filename);
DiskFile file; file.open(filename, DiskFile::ReadMode);
uint size = file.getSize();
int comp;
data = stbi_load_from_memory((u8*)file.readAll(), size, &width, &height, &comp, 4);
}
示例3: loadParams
result Sfxr::loadParams(const char *aFilename)
{
DiskFile df;
int res = df.open(aFilename);
if (res != SO_NO_ERROR)
return res;
return loadParamsFile(&df);
}
示例4: loadToMem
result WavStream::loadToMem(const char *aFilename)
{
DiskFile df;
int res = df.open(aFilename);
if (res == SO_NO_ERROR)
{
res = loadFileToMem(&df);
}
return res;
}
示例5: load
result Wav::load(const char *aFilename)
{
DiskFile dr;
int res = dr.open(aFilename);
if (res != SO_NO_ERROR)
{
return res;
}
return testAndLoadFile(&dr);
}
示例6: MemoryFile
WavStreamInstance::WavStreamInstance(WavStream *aParent)
{
mParent = aParent;
mOffset = 0;
mOgg = 0;
mFile = 0;
if (aParent->mMemFile)
{
MemoryFile *mf = new MemoryFile();
mFile = mf;
mf->openMem(aParent->mMemFile->getMemPtr(), aParent->mMemFile->length(), false, false);
}
else
if (aParent->mFilename)
{
DiskFile *df = new DiskFile;
mFile = df;
df->open(aParent->mFilename);
}
else
if (aParent->mStreamFile)
{
mFile = aParent->mStreamFile;
mFile->seek(0); // stb_vorbis assumes file offset to be at start of ogg
}
else
{
return;
}
if (mFile)
{
if (mParent->mOgg)
{
int e;
mOgg = stb_vorbis_open_file((Soloud_Filehack *)mFile, 0, &e, 0);
if (!mOgg)
{
if (mFile != mParent->mStreamFile)
delete mFile;
mFile = 0;
}
mOggFrameSize = 0;
mOggFrameOffset = 0;
mOggOutputs = 0;
}
else
{
mFile->seek(aParent->mDataOffset);
}
}
}
示例7: load
result Wav::load(const char *aFilename)
{
if (aFilename == 0)
return INVALID_PARAMETER;
stop();
DiskFile dr;
int res = dr.open(aFilename);
if (res == SO_NO_ERROR)
return loadFile(&dr);
return res;
}