• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ wxFFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxFFile的典型用法代码示例。如果您正苦于以下问题:C++ wxFFile类的具体用法?C++ wxFFile怎么用?C++ wxFFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxFFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: writeStatus

void CCCSHandler::writeStatus(wxFFile& file)
{
	for (unsigned int i = 0U; i < m_count; i++) {
		CCCSHandler* handler = m_handlers[i];
		if (handler != NULL) {
			struct tm* tm = ::gmtime(&handler->m_time);

			switch (handler->m_direction) {
				case DIR_OUTGOING:
					if (handler->m_state == CS_ACTIVE) {
						wxString text;
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: CCS link - Rptr: %s Remote: %s Dir: Outgoing\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							handler->m_callsign.c_str(), handler->m_yourCall.c_str());
						file.Write(text);
					}
					break;

				case DIR_INCOMING:
					if (handler->m_state == CS_ACTIVE) {
						wxString text;
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: CCS link - Rptr: %s Remote: %s Dir: Incoming\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							handler->m_callsign.c_str(), handler->m_yourCall.c_str());
						file.Write(text);
					}
					break;
			}
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:31,代码来源:CCSHandler.cpp


示例2: SaveXML

void SilentBlockFile::SaveXML(int depth, wxFFile &xmlFile)
{
   for(int i = 0; i < depth; i++)
      xmlFile.Write("\t");
   xmlFile.Write("<silentblockfile ");
   xmlFile.Write(wxString::Format("len='%d' ", mLen));
   xmlFile.Write("/>\n");
}
开发者ID:CoolOppo,项目名称:audacity,代码行数:8,代码来源:SilentBlockFile.cpp


示例3: CPPUNIT_ASSERT

// test a wxFFile and wxFFileInput/OutputStreams of a known type
// 
void FileKindTestCase::TestFILE(wxFFile& file, bool expected)
{
    CPPUNIT_ASSERT(file.IsOpened());
    CPPUNIT_ASSERT((wxGetFileKind(file.fp()) == wxFILE_KIND_DISK) == expected);
    CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected);

    wxFFileInputStream inStream(file);
    CPPUNIT_ASSERT(inStream.IsSeekable() == expected);

    wxFFileOutputStream outStream(file);
    CPPUNIT_ASSERT(outStream.IsSeekable() == expected);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:14,代码来源:filekind.cpp


示例4: writeStatus

void CDPlusHandler::writeStatus(wxFFile& file)
{
	for (unsigned int i = 0U; i < m_maxReflectors; i++) {
		CDPlusHandler* reflector = m_reflectors[i];
		if (reflector != NULL) {
			wxString text;

			struct tm* tm = ::gmtime(&reflector->m_time);

			if (reflector->m_linkState == DPLUS_LINKED) {
				switch (reflector->m_direction) {
					case DIR_OUTGOING:
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle Rptr: %s Refl: %s Dir: Outgoing\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
						break;

					case DIR_INCOMING:
						text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle User: %s Dir: Incoming\n"),
							tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 
							reflector->m_reflector.c_str());
						break;
				}

				file.Write(text);
			}
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:29,代码来源:DPlusHandler.cpp


示例5: IsMcdFormatted

static bool IsMcdFormatted( wxFFile& fhand )
{
	static const char formatted_string[] = "Sony PS2 Memory Card Format";
	static const int fmtstrlen = sizeof( formatted_string )-1;

	char dest[fmtstrlen];

	fhand.Read( dest, fmtstrlen );
	return memcmp( formatted_string, dest, fmtstrlen ) == 0;
}
开发者ID:madnessw,项目名称:thesnow,代码行数:10,代码来源:MemoryCardListPanel.cpp


示例6: print

void PPToken::print(wxFFile &fp)
{
#if 0
	wxString buff;
	buff << wxT("Name          : ") << name << wxT("\n");
	buff << wxT("replacement   : ") << replacement << wxT("\n");
	buff << wxT("isFunctionLike: ") << isFunctionLike << wxT("\n");
	if(isFunctionLike) {
		for(size_t i=0; i<args.size(); i++) {
			buff << wxT("Arg: ") << args.Item(i) << wxT("\n");
		}
	}
	buff << wxT(" ---- \n");
	fp.Write(buff);
#else
	wxString buff;
	buff << name << wxT("(") << (flags & IsFunctionLike) << wxT(")") << wxT("=") << replacement << wxT("\n");
	fp.Write(buff);
#endif
}
开发者ID:05storm26,项目名称:codelite,代码行数:20,代码来源:pptable.cpp


示例7: Seek

// Returns FALSE if the seek failed (is outside the bounds of the file).
bool FileMemoryCard::Seek( wxFFile& f, u32 adr )
{
	const u32 size = f.Length();

	// If anyone knows why this filesize logic is here (it appears to be related to legacy PSX
	// cards, perhaps hacked support for some special emulator-specific memcard formats that
	// had header info?), then please replace this comment with something useful.  Thanks!  -- air

	u32 offset = 0;

	if( size == MCD_SIZE + 64 )
		offset = 64;
	else if( size == MCD_SIZE + 3904 )
		offset = 3904;
	else
	{
		// perform sanity checks here?
	}

	return f.Seek( adr + offset );
}
开发者ID:friedbacon987,项目名称:pcsx2,代码行数:22,代码来源:MemoryCardFile.cpp


示例8: IsMcdFormatted

static bool IsMcdFormatted( wxFFile& fhand )
{
	static const char formatted_psx[] = "MC";
	static const char formatted_string[] = "Sony PS2 Memory Card Format";
	static const int fmtstrlen = sizeof( formatted_string )-1;

	char dest[fmtstrlen];

	fhand.Read( dest, fmtstrlen );

	bool formatted = memcmp( formatted_string, dest, fmtstrlen ) == 0;
	if(!formatted) formatted = memcmp( formatted_psx, dest, 2 ) == 0;

	return formatted;
}
开发者ID:Alchemistxxd,项目名称:pcsx2,代码行数:15,代码来源:MemoryCardListPanel.cpp


示例9: writeStatus

void CXReflectorDPlusHandler::writeStatus(wxFFile& file)
{
    for (unsigned int i = 0U; i < m_maxReflectors; i++) {
        CXReflectorDPlusHandler* reflector = m_reflectors[i];
        if (reflector != NULL) {
            struct tm* tm = ::gmtime(&reflector->m_time);

            wxString text;
            text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle User: %s Dir: Inbound\n"),
                        tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
                        reflector->m_reflector.c_str());

            file.Write(text);
        }
    }
}
开发者ID:jcyfkimi,项目名称:OpenDV,代码行数:16,代码来源:XReflectorDPlusHandler.cpp


示例10: GenerateHeaderCode

    void GenerateHeaderCode(wxFFile& file)
    {

        file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
                   + _T(" {\nprotected:\n"));
        size_t i;
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write(
                _T(" ") + w.GetClass() + _T("* ") + w.GetName()
                + _T(";\n"));
        }
        file.Write(_T("\nprivate:\n void InitWidgetsFromXRC(){\n")
                   _T("  wxXmlResource::Get()->LoadObject(this,NULL,_T(\"")
                   +  m_className
                   +  _T("\"), _T(\"")
                   +  m_parentClassName
                   +  _T("\"));\n"));
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write( _T("  ")
                        + w.GetName()
                        + _T(" = XRCCTRL(*this,\"")
                        + w.GetName()
                        + _T("\",")
                        + w.GetClass()
                        + _T(");\n")
                );
        }
        file.Write(_T(" }\n"));

        file.Write(
            _T("public:\n")
            + m_className
            + _T("::")
            + m_className
            + _T("(){\n")
            + _T("  InitWidgetsFromXRC();\n")
              _T(" }\n")
              _T("};\n")
        );
    };
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:48,代码来源:wxrc.cpp


示例11: SaveXML

void PCMAliasBlockFile::SaveXML(int depth, wxFFile &xmlFile)
{
   for(int i = 0; i < depth; i++)
      xmlFile.Write("\t");
   xmlFile.Write("<pcmaliasblockfile ");
   xmlFile.Write(wxString::Format("summaryfile='%s' ",
                                  XMLTagHandler::XMLEsc(mFileName.GetFullName()).c_str()));
   xmlFile.Write(wxString::Format("aliasfile='%s' ",
                                  XMLTagHandler::XMLEsc(mAliasedFileName.GetFullPath()).c_str()));
   xmlFile.Write(wxString::Format("aliasstart='%d' ", mAliasStart));
   xmlFile.Write(wxString::Format("aliaslen='%d' ", mLen));
   xmlFile.Write(wxString::Format("aliaschannel='%d' ", mAliasChannel));
   xmlFile.Write(wxString::Format("min='%s' ",
            Internat::ToString(mMin).c_str()));
   xmlFile.Write(wxString::Format("max='%s' ",
            Internat::ToString(mMax).c_str()));
   xmlFile.Write(wxString::Format("rms='%s'",
            Internat::ToString(mRMS).c_str()));
   xmlFile.Write("/>\n");
}
开发者ID:CoolOppo,项目名称:audacity,代码行数:20,代码来源:PCMAliasBlockFile.cpp


示例12: GenerateHeaderCode

    void GenerateHeaderCode(wxFFile& file)
    {

        file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
                   + _T(" {\nprotected:\n"));
        size_t i;
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write(
                _T(" ") + w.GetClass() + _T("* ") + w.GetName()
                + _T(";\n"));
        }
        file.Write(_T("\nprivate:\n void InitWidgetsFromXRC(wxWindow *parent){\n")
                   _T("  wxXmlResource::Get()->LoadObject(this,parent,_T(\"")
                   +  m_className
                   +  _T("\"), _T(\"")
                   +  m_parentClassName
                   +  _T("\"));\n"));
        for(i=0;i<m_wdata.Count();++i)
        {
            const XRCWidgetData& w = m_wdata.Item(i);
            if( !IsRealClass(w.GetClass()) ) continue;
            if( w.GetName().Length() == 0 ) continue;
            file.Write( _T("  ")
                        + w.GetName()
                        + _T(" = XRCCTRL(*this,\"")
                        + w.GetName()
                        + _T("\",")
                        + w.GetClass()
                        + _T(");\n"));
        }
        file.Write(_T(" }\n"));

        file.Write( _T("public:\n"));

        if ( m_ancestorClassNames.size() == 1 )
        {
            file.Write
                 (
                    m_className +
                    _T("(") +
                        *m_ancestorClassNames.begin() +
                        _T(" *parent=NULL){\n") +
                    _T("  InitWidgetsFromXRC((wxWindow *)parent);\n")
                    _T(" }\n")
                    _T("};\n")
                 );
        }
        else
        {
            file.Write(m_className + _T("(){\n") +
                       _T("  InitWidgetsFromXRC(NULL);\n")
                       _T(" }\n")
                       _T("};\n"));

            for ( StringSet::const_iterator it = m_ancestorClassNames.begin();
                  it != m_ancestorClassNames.end();
                  ++it )
            {
                file.Write(m_className + _T("(") + *it + _T(" *parent){\n") +
                            _T("  InitWidgetsFromXRC((wxWindow *)parent);\n")
                            _T(" }\n")
                            _T("};\n"));
            }
        }
    }
开发者ID:EdgarTx,项目名称:wx,代码行数:69,代码来源:wxrc.cpp


示例13: Init

bool FLACImportFileHandle::Init()
{
#ifdef LEGACY_FLAC
   bool success = mFile->set_filename(OSINPUT(mFilename));
   if (!success) {
      return false;
   }
   mFile->set_metadata_respond(FLAC__METADATA_TYPE_STREAMINFO);
   mFile->set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT);
   FLAC::Decoder::File::State state = mFile->init();
   if (state != FLAC__FILE_DECODER_OK) {
      return false;
   }
#else
   if (!mHandle.Open(mFilename, wxT("rb"))) {
      return false;
   }

   // Even though there is an init() method that takes a filename, use the one that
   // takes a file handle because wxWidgets can open a file with a Unicode name and
   // libflac can't (under Windows).
   //
   // Responsibility for closing the file is passed to libflac.
   // (it happens when mFile->finish() is called)
   bool result = mFile->init(mHandle.fp())?true:false;
   mHandle.Detach();

   if (result != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
      return false;
   }
#endif
   mFile->process_until_end_of_metadata();

#ifdef LEGACY_FLAC
   state = mFile->get_state();
   if (state != FLAC__FILE_DECODER_OK) {
      return false;
   }
#else
   // not necessary to check state, error callback will catch errors, but here's how:
   if (mFile->get_state() > FLAC__STREAM_DECODER_READ_FRAME) {
      return false;
   }
#endif

   if (!mFile->is_valid() || mFile->get_was_error()) {
      // This probably is not a FLAC file at all
      return false;
   }
   return true;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:51,代码来源:ImportFLAC.cpp


示例14: systemStopGameRecording

void systemStopGameRecording()
{
    if (!game_recording)
        return;

    if (game_file.Write(&game_frame, sizeof(game_frame)) != sizeof(game_frame) || game_file.Write(&game_joypad, sizeof(game_joypad)) != sizeof(game_joypad) || !game_file.Close())
        wxLogError(_("Error writing game recording"));

    game_recording = false;
    MainFrame* mf = wxGetApp().frame;
    mf->cmd_enable &= ~CMDEN_GREC;
    mf->cmd_enable |= CMDEN_NGREC | CMDEN_NGPLAY;
    mf->enable_menus();
}
开发者ID:arko-pl,项目名称:visualboyadvance-m,代码行数:14,代码来源:sys.cpp


示例15: ExecuteCmd

bool DbgGdb::ExecuteCmd( const wxString &cmd )
{
    if( m_gdbProcess ) {
        if ( m_info.enableDebugLog ) {
#if DBG_LOG
            if(gfp.IsOpened()) {
                gfp.Write(wxString::Format( wxT( "DEBUG>>%s\n" ), cmd.c_str() ));
                gfp.Flush();
            }
#else
            m_observer->UpdateAddLine( wxString::Format( wxT( "DEBUG>>%s" ), cmd.c_str() ) );
#endif
        }
        return m_gdbProcess->Write( cmd );
    }
    return false;
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:17,代码来源:debuggergdb.cpp


示例16: systemStartGameRecording

void systemStartGameRecording(const wxString &fname)
{
	GameArea* panel = wxGetApp().frame->GetPanel();

	if (!panel || panel->game_type() == IMAGE_UNKNOWN ||
	        !panel->emusys->emuWriteState)
	{
		wxLogError(_("No game in progress to record"));
		return;
	}

	systemStopGamePlayback();
	wxString fn = fname;

	if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false))
		fn.append(wxT(".vmv"));

	u32 version = 1;

	if (!game_file.Open(fn.c_str(), wxT("wb")) ||
	        game_file.Write(&version, sizeof(version)) != sizeof(version))
	{
		wxLogError(_("Cannot open output file %s"), fname.c_str());
		return;
	}

	fn[fn.size() - 1] = wxT('0');

	if (!panel->emusys->emuWriteState(fn.mb_fn_str()))
	{
		wxLogError(_("Error writing game recording"));
		game_file.Close();
		return;
	}

	game_frame = 0;
	game_joypad = 0;
	game_recording = true;
	MainFrame* mf = wxGetApp().frame;
	mf->cmd_enable &= ~(CMDEN_NGREC | CMDEN_GPLAY | CMDEN_NGPLAY);
	mf->cmd_enable |= CMDEN_GREC;
	mf->enable_menus();
}
开发者ID:MrSwiss,项目名称:visualboyadvance-m,代码行数:43,代码来源:sys.cpp


示例17: systemStopGamePlayback

void systemStopGamePlayback()
{
	if (!game_playback)
		return;

	game_file.Close();
	game_playback = false;
	MainFrame* mf = wxGetApp().frame;
	mf->cmd_enable &= ~CMDEN_GPLAY;
	mf->cmd_enable |= CMDEN_NGREC | CMDEN_NGPLAY;
	mf->enable_menus();
}
开发者ID:MrSwiss,项目名称:visualboyadvance-m,代码行数:12,代码来源:sys.cpp


示例18: systemStartGamePlayback

void systemStartGamePlayback(const wxString& fname)
{
    GameArea* panel = wxGetApp().frame->GetPanel();

    if (!panel || panel->game_type() == IMAGE_UNKNOWN || !panel->emusys->emuReadState) {
        wxLogError(_("No game in progress to record"));
        return;
    }

    if (game_recording) {
        wxLogError(_("Cannot play game recording while recording"));
        return;
    }

    systemStopGamePlayback();
    wxString fn = fname;

    if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false))
        fn.append(wxT(".vmv"));

    u32 version;

    if (!game_file.Open(fn.c_str(), wxT("rb")) || game_file.Read(&version, sizeof(version)) != sizeof(version) || wxUINT32_SWAP_ON_BE(version) != 1) {
        wxLogError(_("Cannot open recording file %s"), fname.c_str());
        return;
    }

    u32 gf, jp;

    if (game_file.Read(&gf, sizeof(gf)) != sizeof(gf) || game_file.Read(&jp, sizeof(jp)) != sizeof(jp)) {
        wxLogError(_("Error reading game recording"));
        game_file.Close();
        return;
    }

    game_next_frame = wxUINT32_SWAP_ON_BE(gf);
    game_next_joypad = wxUINT32_SWAP_ON_BE(jp);
    fn[fn.size() - 1] = wxT('0');

    if (!panel->emusys->emuReadState(fn.mb_fn_str())) {
        wxLogError(_("Error reading game recording"));
        game_file.Close();
        return;
    }

    game_frame = 0;
    game_joypad = 0;
    game_playback = true;
    MainFrame* mf = wxGetApp().frame;
    mf->cmd_enable &= ~(CMDEN_NGREC | CMDEN_GREC | CMDEN_NGPLAY);
    mf->cmd_enable |= CMDEN_GPLAY;
    mf->enable_menus();
}
开发者ID:arko-pl,项目名称:visualboyadvance-m,代码行数:53,代码来源:sys.cpp


示例19: Import

bool OggImportFileHandle::Import(TrackFactory *trackFactory, Track ***outTracks,
                                 int *outNumTracks, Tags *tags)
{
   wxASSERT(mFile->IsOpened());

   /* -1 is for the current logical bitstream */
   vorbis_info *vi = ov_info(mVorbisFile, -1);
   vorbis_comment *vc = ov_comment(mVorbisFile, -1);

   WaveTrack **channels = new WaveTrack *[vi->channels];

   int c;
   for (c = 0; c < vi->channels; c++) {
      channels[c] = trackFactory->NewWaveTrack(int16Sample, vi->rate);

      if (vi->channels == 2) {
         switch (c) {
         case 0:
            channels[c]->SetChannel(Track::LeftChannel);
            channels[c]->SetLinked(true);
            break;
         case 1:
            channels[c]->SetChannel(Track::RightChannel);
            channels[c]->SetTeamed(true);
            break;
         }
   }
      else {
         channels[c]->SetChannel(Track::MonoChannel);
      }
   }

/* The number of bytes to get from the codec in each run */
#define CODEC_TRANSFER_SIZE 4096

/* The number of samples to read between calls to the callback.
 * Balance between responsiveness of the GUI and throughput of import. */
#define SAMPLES_PER_CALLBACK 100000

   short *mainBuffer = new short[CODEC_TRANSFER_SIZE];

   /* determine endianness (clever trick courtesy of Nicholas Devillard,
    * (http://www.eso.org/~ndevilla/endian/) */
   int testvar = 1, endian;
   if(*(char *)&testvar)
      endian = 0;  // little endian
   else
      endian = 1;  // big endian

   /* number of samples currently in each channel's buffer */
   bool cancelled = false;
   long bytesRead = 0;
   long samplesRead = 0;
   int bitstream = 0;
   int samplesSinceLastCallback = 0;

   // You would think that the stream would already be seeked to 0, and
   // indeed it is if the file is legit.  But I had several ogg files on
   // my hard drive that have malformed headers, and this added call
   // causes them to be read correctly.  Otherwise they have lots of
   // zeros inserted at the beginning
   ov_pcm_seek(mVorbisFile, 0);
   
   do {
      /* get data from the decoder */
      bytesRead = ov_read(mVorbisFile, (char *) mainBuffer,
                          CODEC_TRANSFER_SIZE,
                          endian,
                          2,    // word length (2 for 16 bit samples)
                          1,    // signed
                          &bitstream);

      if (bytesRead < 0) {
         /* Malformed Ogg Vorbis file. */
         /* TODO: Return some sort of meaningful error. */
         break;
      }

      samplesRead = bytesRead / vi->channels / sizeof(short);

      /* give the data to the wavetracks */
      for (c = 0; c < vi->channels; c++)
          channels[c]->Append((char *)(mainBuffer + c),
                              int16Sample,
                              samplesRead,
                              vi->channels);

      samplesSinceLastCallback += samplesRead;
      if (samplesSinceLastCallback > SAMPLES_PER_CALLBACK) {
          if( mProgressCallback )
             cancelled = mProgressCallback(mUserData,
                                           ov_time_tell(mVorbisFile) /
                                           ov_time_total(mVorbisFile, bitstream));
          samplesSinceLastCallback -= SAMPLES_PER_CALLBACK;
      }

   } while (!cancelled && bytesRead != 0 && bitstream == 0);

   delete[]mainBuffer;

//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:ImportOGG.cpp


示例20: Init

bool FLACImportFileHandle::Init()
{
#ifdef EXPERIMENTAL_OD_FLAC
   mDecoderTask=new ODDecodeFlacTask;

   ODFlacDecoder* odDecoder = (ODFlacDecoder*)mDecoderTask->CreateFileDecoder(mFilename);
   if(!odDecoder || !odDecoder->ReadHeader())
   {
      //DELETE the task only if it failed to read - otherwise the OD man takes care of it.
      delete mDecoderTask;
      return false;
   }
   //copy the meta data over to the class

   mSampleRate=odDecoder->mSampleRate;
   mNumChannels=odDecoder->mNumChannels;
   mBitsPerSample=odDecoder->mBitsPerSample;

   mNumSamples=odDecoder->mNumSamples;
   mBitsPerSample=odDecoder->mBitsPerSample;
   mFormat=odDecoder->mFormat;
   mStreamInfoDone=true;


   return true;
#endif
#ifdef LEGACY_FLAC
   bool success = mFile->set_filename(OSINPUT(mFilename));
   if (!success) {
      return false;
   }
   mFile->set_metadata_respond(FLAC__METADATA_TYPE_STREAMINFO);
   mFile->set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT);
   FLAC::Decoder::File::State state = mFile->init();
   if (state != FLAC__FILE_DECODER_OK) {
      return false;
   }
#else
   if (!mHandle.Open(mFilename, wxT("rb"))) {
      return false;
   }

   // Even though there is an init() method that takes a filename, use the one that
   // takes a file handle because wxWidgets can open a file with a Unicode name and
   // libflac can't (under Windows).
   //
   // Responsibility for closing the file is passed to libflac.
   // (it happens when mFile->finish() is called)
   bool result = mFile->init(mHandle.fp())?true:false;
   mHandle.Detach();

   if (result != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
      return false;
   }
#endif
   mFile->process_until_end_of_metadata();

#ifdef LEGACY_FLAC
   state = mFile->get_state();
   if (state != FLAC__FILE_DECODER_OK) {
      return false;
   }
#else
   // not necessary to check state, error callback will catch errors, but here's how:
   if (mFile->get_state() > FLAC__STREAM_DECODER_READ_FRAME) {
      return false;
   }
#endif

   if (!mFile->is_valid() || mFile->get_was_error()) {
      // This probably is not a FLAC file at all
      return false;
   }
   return true;
}
开发者ID:ShanghaiTimes,项目名称:audacity-1,代码行数:75,代码来源:ImportFLAC.cpp



注:本文中的wxFFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxFSFile类代码示例发布时间:2022-05-31
下一篇:
C++ wxEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap