当前位置: 首页>>代码示例>>C++>>正文


C++ SetFormat函数代码示例

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


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

示例1: fopen

bool
libname::COggStreamSample::Load( const char *szFilename )
{

  vorbis_info * pInfo;
  if ( !m_pFile )
    m_pFile = fopen( szFilename, "rb");
  
  if( ov_open_callbacks( m_pFile , &m_OggFile, NULL, 0, OV_CALLBACKS_DEFAULT) < 0) 
  {
    cerr << "Input does not appear to be an Ogg bitstream." << endl;
    return false;
  }
  
  pInfo = ov_info(&m_OggFile,-1);

  SetNumChannels( pInfo->channels);  // number of channels
  SetFreq( pInfo->rate);             // The frequency of the sampling rate
  
  // Check the number of channels... always use 16-bit samples
  if (GetNumChannels() == 1)
    SetFormat( AL_FORMAT_MONO16 );
  else
    SetFormat( AL_FORMAT_STEREO16 );
  cerr << "Freq: "     << GetFreq() << endl;
  cerr << "Channels: " << GetNumChannels() << endl;
  cerr << "Encoded: "  << ov_comment(&m_OggFile,-1)->vendor << endl;
  
  m_lFileSize = ov_raw_total( &m_OggFile, -1);

  return true;
}
开发者ID:moose3d,项目名称:moose,代码行数:32,代码来源:MooseOggStreamSample.cpp

示例2: UNICODE_STRING_SIMPLE

UnicodeString ICUSQLite3Utility::Format(
	const UDate& dateTime, const EIcuSqlite3DTStorageTypes type)
{
	if(!m_dtFormat) {
		return UNICODE_STRING_SIMPLE("");
	}
	if(ICUSQLITE_DATETIME_ISO8601 == type) {
		//Format as full date/time.  See if we have milliseconds and
		//	format accordingly.
		if(0 == (static_cast<int64_t>(dateTime) % 1000)) {
			SetFormat(DATE_FORMAT_ISO8601_DATETIME);
		} else {
			SetFormat(DATE_FORMAT_ISO8601_DATETIME_MILLISECONDS);
		}
	} else if(ICUSQLITE_DATETIME_ISO8601_TIME == type) {
		//Format as time only. See if we have milliseconds and
		//	format accordingly.
		if(0 == (static_cast<int64_t>(dateTime) % 1000)) {
			SetFormat(DATE_FORMAT_ISO8601_TIME);
		} else {
			SetFormat(DATE_FORMAT_ISO8601_TIME_MILLISECONDS);
		}
	} else {
		SetFormat(static_cast<EIcuSqlite3FormatIndex>(type));
	}
	UnicodeString result;
	return m_dtFormat->format(dateTime, result);
}
开发者ID:NuSkooler,项目名称:ICUSQLite3,代码行数:28,代码来源:ICUSQLite3Utility.cpp

示例3: SetFormat

// Format negotiation
HRESULT CTimeStretchFilter::NegotiateFormat(const WAVEFORMATEXTENSIBLE* pwfx, int nApplyChangesDepth, ChannelOrder* pChOrder)
{
  if (!pwfx)
    return VFW_E_TYPE_NOT_ACCEPTED;

#ifdef INTEGER_SAMPLES
  // only accept 16bit int
  if (pwfx->Format.wBitsPerSample != 16 || pwfx->SubFormat != KSDATAFORMAT_SUBTYPE_PCM)
    return VFW_E_TYPE_NOT_ACCEPTED;
#else 
  // only accept 32bit float
  if (pwfx->Format.wBitsPerSample != 32 || pwfx->SubFormat != KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)
    return VFW_E_TYPE_NOT_ACCEPTED;
#endif

  if (FormatsEqual(pwfx, m_pInputFormat))
  {
    *pChOrder = m_chOrder;
    return S_OK;
  }

  bool bApplyChanges = (nApplyChangesDepth != 0);
  if (nApplyChangesDepth != INFINITE && nApplyChangesDepth > 0)
    nApplyChangesDepth--;

  HRESULT hr = m_pNextSink->NegotiateFormat(pwfx, nApplyChangesDepth, pChOrder);
  if (FAILED(hr))
    return hr;

  hr = VFW_E_CANNOT_CONNECT;
  
  if (!pwfx)
    return SetFormat(NULL);

  if (bApplyChanges)
  {
    LogWaveFormat(pwfx, "TS   - applying ");

    AM_MEDIA_TYPE tmp;
    HRESULT result = CreateAudioMediaType((WAVEFORMATEX*)pwfx, &tmp, true);
    if (SUCCEEDED(result))
    {
      if (m_pMediaType)
        DeleteMediaType(m_pMediaType);
      m_pMediaType = CreateMediaType(&tmp);
    }

    SetInputFormat(pwfx);
    SetOutputFormat(pwfx);
    SetFormat(pwfx);
  }
  else
    LogWaveFormat(pwfx, "TS   -          ");

  m_chOrder = *pChOrder;

  return S_OK;
}
开发者ID:K405,项目名称:MediaPortal-1,代码行数:59,代码来源:TimeStretchFilter.cpp

示例4: ReadTagAPE

bool ReadTagAPE(FILE_INFO *pFileMP3)
{
	GetValues_mp3infp(pFileMP3);
	CTag_Ape ape;
	if (ape.Load(GetFullPath(pFileMP3)) != ERROR_SUCCESS) {
		return false;
	}

	
	CString buff;
	// トラック名
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_TITLE, buff);
	SetTrackNameSI(pFileMP3, buff);
	// アーティスト名
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_ARTIST, buff);
	SetArtistNameSI(pFileMP3, buff);
	// アルバム名
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_ALBUM, buff);
	SetAlbumNameSI(pFileMP3, buff);
	// リリース年号
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_YEAR, buff);
	SetYearSI(pFileMP3, buff);
	// コメント
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_COMMENT, buff);
	SetCommentSI(pFileMP3, buff);
	// トラック番号
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_TRACK, buff);
	SetTrackNumberSI(pFileMP3, buff);
	// ジャンル番号
	ape.GetComment(CTag_Ape::APE_TAG_FIELD_GENRE, buff);
	SetGenreSI(pFileMP3, buff);
	//SetBGenre(STEPGetGenreCode(buff));
	// 作曲者
	ape.GetComment("Composer", buff);
	SetComposerSI(pFileMP3, buff);
	// パフォーマー
	ape.GetComment("Performer", buff);
	SetOrigArtistSI(pFileMP3, buff);
	// ファイル形式:APE
	SetFileTypeName(pFileMP3, "Monkey's Audio");
	if (!ape.HasApetag() && ape.HasId3tag()) {
		SetFormat(pFileMP3, nFileTypeAPEID3);
		SetFileTypeName(pFileMP3, "Monkey's Audio(ID3)");
	} else {
		SetFormat(pFileMP3, nFileTypeAPE);
		if (ape.HasApetag()) {
			if (ape.isApetagV1()) {
				SetFileTypeName(pFileMP3, "Monkey's Audio(APE)");
			} else {
				SetFileTypeName(pFileMP3, "Monkey's Audio(APEv2)");
			}
		}
	}

	return true;
}
开发者ID:iskwa,项目名称:mm_STEP_M,代码行数:56,代码来源:STEP_ape.cpp

示例5: HasDynamicScope

OSStatus	CAAudioUnit::ConfigureDynamicScope (AudioUnitScope 		inScope,
											UInt32 					inNumElements,
											UInt32 					*inChannelsPerElement,
											Float64 				inSampleRate)
{
	SInt32 numChannels = 0;
	bool isDyamic = HasDynamicScope (inScope, numChannels);
	if (isDyamic == false)
		return kAudioUnitErr_InvalidProperty;

	//lets to a sanity check...
	// if numChannels == -1, then it can do "any"...
	if (numChannels > 0) {
		SInt32 count = 0;
		for (unsigned int i = 0; i < inNumElements; ++i)
			count += inChannelsPerElement[i];
		if (count > numChannels)
			return kAudioUnitErr_InvalidPropertyValue;
	}

	OSStatus result = SetElementCount (inScope, inNumElements);
	if (result)
		return result;

	CAStreamBasicDescription desc;
	desc.mSampleRate = inSampleRate;
	for (unsigned int i = 0; i < inNumElements; ++i) {
		desc.SetCanonical (inChannelsPerElement[i], false);
		result = SetFormat (inScope, i, desc);
		if (result)
			return result;
	}
	return noErr;
}
开发者ID:63n,项目名称:ardour,代码行数:34,代码来源:CAAudioUnit.cpp

示例6: SetText

int TextWidget::Load(XmlSynthElem *elem)
{
	SynthWidget::Load(elem);
	char *txt;
	if (elem->GetAttribute("lbl", &txt) == 0)
	{
		SetText(txt);
		delete txt;
	}
	if (elem->GetAttribute("fmt", &txt) == 0)
	{
		SetFormat(txt);
		delete txt;
	}
	short th;
	if (elem->GetAttribute("th", th) == 0)
		SetTextHeight(th);
	if (elem->GetAttribute("bold", th) == 0)
		SetBold(th);
	if (elem->GetAttribute("italic", th) == 0)
		SetItalic(th);
	if (elem->GetAttribute("filled", th) == 0)
		SetFilled(th);
	if (elem->GetAttribute("align", th) == 0)
		SetAlign(th);
	if (elem->GetAttribute("shadow", th) == 0)
		SetShadow(th);
	if (elem->GetAttribute("inset", th) == 0)
		SetInset(th);
	if (elem->GetAttribute("edit", th) == 0)
		editable = (int) th;
	return 0;
}
开发者ID:travisgoodspeed,项目名称:basicsynth,代码行数:33,代码来源:TextWidget.cpp

示例7: SetFormat

void CuModule::SetSampler(CuModule::TexBind* texBind,
	const CuTexSamplerAttr& sampler) {

	SetFormat(texBind, sampler.fmt, sampler.numPackedComponents);
	
	if(texBind->sampler.addressX != sampler.addressX) {
		cuTexRefSetAddressMode(texBind->texRef, 0, texBind->sampler.addressX);
		texBind->sampler.addressX = sampler.addressX;
	}
	if(texBind->sampler.addressY != sampler.addressY) {
		cuTexRefSetAddressMode(texBind->texRef, 1, texBind->sampler.addressY);
		texBind->sampler.addressY = sampler.addressY;
	}
	if(texBind->sampler.addressZ != sampler.addressZ) {
		cuTexRefSetAddressMode(texBind->texRef, 2, texBind->sampler.addressZ);
		texBind->sampler.addressZ = sampler.addressZ;
	}
	if(texBind->sampler.filter != sampler.filter) {
		cuTexRefSetFilterMode(texBind->texRef, sampler.filter);
		texBind->sampler.filter = sampler.filter;
	}
	if((texBind->sampler.readAsInteger != sampler.readAsInteger) ||
		(texBind->sampler.normCoord != sampler.normCoord)) {
	
		uint flags = (sampler.readAsInteger ? CU_TRSF_READ_AS_INTEGER : 0) |
			(sampler.normCoord ? CU_TRSF_NORMALIZED_COORDINATES : 0);
		texBind->sampler.readAsInteger = sampler.readAsInteger;
		texBind->sampler.normCoord = sampler.normCoord;
		cuTexRefSetFlags(texBind->texRef, flags);		
	}
}
开发者ID:CindyYang85,项目名称:mgpu,代码行数:31,代码来源:cucpp.cpp

示例8: m_hWnd

CClipboard::CClipboard(HWND hWnd, LPCSTR Format) :
	m_hWnd(hWnd)
{
	m_hWnd = NULL;
	SetFormat(Format);
	memset(&m_Owner, 0, sizeof(GUID));
}
开发者ID:victimofleisure,项目名称:Mixere,代码行数:7,代码来源:Clipboard.cpp

示例9: PAGED_CODE

NTSTATUS WaveStream::Init(IN Wave *Miniport_,IN PPORTWAVERTSTREAM PortStream_,IN ULONG Pin_,IN BOOLEAN Capture_,IN PKSDATAFORMAT DataFormat)
{
	PAGED_CODE();

	debug("WaveStream[%d]::Init: [%p, %p]\n",Pin_,this,Miniport_);

	magic=object_magic;
	wave=Miniport_;
	Pin=Pin_;
	State=KSSTATE_STOP;
	PortStream=PortStream_;

	AudioPosition=0;
	NotificationCount=0;
	AudioBuffer=NULL;
	NotificationEvent=NULL;

	is_asio=false;
	is_16bit=false;
	is_recording=!!Capture_;
	enabled=false;

	NTSTATUS ntStatus=SetFormat(DataFormat);

	return ntStatus;
}
开发者ID:kxproject,项目名称:kx-1010-driver,代码行数:26,代码来源:wavestream.cpp

示例10: EditorSceneNode

    EditorCamera::EditorCamera(const std::string& name)
        : EditorSceneNode(name)
    {
        SetMesh(Mesh::GetOrCreate<QuadMesh>("NSGEditorCamera"));
        SetMaterial(Material::GetOrCreate("NSGEditorCamera"));
        material_->SetRenderPass(RenderPass::TEXT);
		material_->SetDiffuseColor(COLOR_DODGER_BLUE);
        material_->EnableTransparent(true);
		material_->SetAlpha(0.9f);
        material_->SetBillboardType(BillboardType::SPHERICAL);
        material_->CastShadow(false);
        material_->ReceiveShadows(false);
		
		const int SIZE = 8;
		static const unsigned char image[SIZE][SIZE]
        {
            {X X X X X X X X},
            {X O O O O O O X},
            {X O X X X X O X},
            {X O X O O O O X},
            {X O X O O O O X},
            {X O X X X X O X},
            {X O O O O O O X},
            {X X X X X X X X},
        };

		auto texture = std::make_shared<Texture2D>();
		texture->SetFormat(GL_ALPHA);
		texture->SetData(&image[0][0]);
		texture->SetSize(SIZE, SIZE);
		texture->SetMapType(TextureType::COL);
		material_->SetTextMap(texture);
		texture->SetFilterMode(TextureFilterMode::NEAREST);
    }
开发者ID:dreamsxin,项目名称:nsg-library,代码行数:34,代码来源:EditorCamera.cpp

示例11: Flush

void RichQtfParser::EndPart()
{
	if(istable) {
		if(paragraph.GetCount() == 0 && text.GetCount() == 0)
			if(table.GetCount())
				table.Top().text.CatPick(pick(tablepart));
			else
				target.CatPick(pick(tablepart));
		else {
			paragraph.part.Clear();
			text.Clear();
		}
	}
	else {
		Flush();
		if(table.GetCount())
			table.Top().text.Cat(paragraph, target.GetStyles());
		else {
			if(breakpage)
				paragraph.format.newpage = true;
			target.Cat(paragraph);
		}
		paragraph.part.Clear();
		SetFormat();
		breakpage = false;
	}
	istable = false;
}
开发者ID:koz4k,项目名称:soccer,代码行数:28,代码来源:ParseQtf.cpp

示例12: SetFormat

//---------------------------------------------------------------------------------------
void tNdp2kTableDataSources::LoadFromGlobalSettings()
{
    SetFormat( m_DefaultFormat );

    int errors = 0;
    m_Table.resize( m_DefaultFormatRows );
    for (int row = 0; row < m_DefaultFormatRows; ++row)
    {
        tDataType type = m_pDefaultFormatTypes[row];
        eDigitalDataSourceSettingId settingID = m_pSourceSettings->DataTypeToSettingId( type );

        tRow& info = m_Table[ row ];
        info.dataType = type;
        info.dirty = false;

        bool ok = false;
        if (m_pSourceSettings->SettingIdToDataType( settingID ) == type)
        {
            tDigitalDataSourceSettings::tGlobalSetting setting(*m_pSourceSettings);
            if (setting.Load( settingID ))
            {
                info.selections = setting.DataSourceList();
                ok = true;
            }
        }
        if (ok == false)
        {
            info.selections = tSourceSelections();
            ++errors;
        }
    }
}
开发者ID:dulton,项目名称:53_hero,代码行数:33,代码来源:tNdp2kTableDataSources.cpp

示例13: Init

TLvColumn::TLvColumn(const tstring& text, int width, TFormat how, int subitemIndex)
{
  Init();
  SetText(text);
  SetWidth(width, text);
  SetFormat(how);
  SetSubItem(subitemIndex);
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:8,代码来源:listviewctrl.cpp

示例14: SetWidth

wxGridCellFloatRenderer::wxGridCellFloatRenderer(int width,
                                                 int precision,
                                                 int format)
{
    SetWidth(width);
    SetPrecision(precision);
    SetFormat(format);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:8,代码来源:gridctrl.cpp

示例15: strcpy_s

void CFolderItem::GetDataFromDatabase(const TCHAR *szNotFound)
{
	char szSettingName[256];
	strcpy_s(szSettingName, _countof(szSettingName), m_szSection);
	strcat_s(szSettingName, _countof(szSettingName), m_szName);

	ptrT tszValue(db_get_tsa(NULL, ModuleName, szSettingName));
	SetFormat(tszValue != NULL ? tszValue : szNotFound);
}
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:9,代码来源:folderItem.cpp


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