Exemple #1
0
BOOL OSndStreamWAV::OpenStream( const CUString& strFileName )
{
	SF_INFO wfInfo;

    memset(&wfInfo,0,sizeof(SF_INFO));
	wfInfo.samplerate  = GetSampleRate();
	wfInfo.frames      = -1;
	wfInfo.sections	   = 1;
	wfInfo.channels    = GetChannels();
	wfInfo.format      = (SF_FORMAT_WAV | m_OutputFormat) ;

	// Set file name
	SetFileName(strFileName);
	
    CUStringConvert strCnv;

	// Open stream
    #ifdef _UNICODE
    if (! (m_pSndFile = sf_open(	(const tchar*)strCnv.ToT( GetFileName() + _W( "." ) + GetFileExtention() ),
									SFM_WRITE,
									&wfInfo ) ) )
    #else
	if (! (m_pSndFile = sf_open(	strCnv.ToT( GetFileName() + _W( "." ) + GetFileExtention() ),
									SFM_WRITE,
									&wfInfo ) ) )
    #endif
	{
		ASSERT( FALSE );
		return FALSE;
	}

	// return Success
	return TRUE;
}
Exemple #2
0
//
// Looking for file containers
//
void XFileSystem::ScaningCntFiles
    (
    )
{
    DPrint( "XFileSystem::ScaningCntFiles : start process\n" );

    int i;
    int handle;
    int ret = 0;
    struct _finddata_t fileinfo;
    const char *pExt;

    handle = _findfirst( "*.*", &fileinfo );
    if ( handle == -1 )
        ret = -1;

    while ( ret == 0 )
    {
        if ( !( fileinfo.attrib & _A_SUBDIR ) )
        {
            FixFileName( fileinfo.name );
            pExt = GetFileExtention( fileinfo.name );

            // find container type
            for ( i = 0; i < m_nNumContainers; i++ )
                if ( m_pContainers[ i ]->IsContainerExt( pExt ) )
                {
                    m_CntFiles[ m_nNumCntFiles ].m_nContainerID = i;
                    strcpy( m_CntFiles[ m_nNumCntFiles ].m_pFileName, fileinfo.name );

                    m_pContainers[ i ]->Initialize( &m_CntFiles[ m_nNumCntFiles ] );

                    m_nNumCntFiles++;
                    DPrint( ".found \"" ); DPrint( fileinfo.name ); DPrint( "\"\n" );
                    break;
                }
        }

        ret = _findnext( handle, &fileinfo );
        if ( ret != 0 )
        {
            _findclose( handle );
        }
    }
}
bool Animated_Mesh::Load(const std::string& file){
	OUTPUT_DEBUG_MSG("Animated_Mesh::Load file: '" + file+"'");
	if(!FileExists(file)) {
		OUTPUT_DEBUG_MSG("File does not exist");
		return false;
	}
	std::string ext = GetFileExtention(file);
	DeInit();// make sure to free any resources
	bool ret = false;
	if(ext == ".dsm") ret = Load_MyFormat(file);//.dsm is my file extention for models
	else ret = Load_Assimp(file);
	//Configure and load the appropriate shaders

	CBuffer0.Create(1, sizeof(Object_Transform), CONSTANT_BUFFER);
	CBuffer1.Create(1, sizeof(Material), CONSTANT_BUFFER);
	CBuffer2.Create(1, sizeof(mat4)*MAX_BONES, CONSTANT_BUFFER);
	if(ret) Generate_BV();
	return ret;
}