本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例8: m_hWnd
CClipboard::CClipboard(HWND hWnd, LPCSTR Format) :
m_hWnd(hWnd)
{
m_hWnd = NULL;
SetFormat(Format);
memset(&m_Owner, 0, sizeof(GUID));
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}
}
示例13: Init
TLvColumn::TLvColumn(const tstring& text, int width, TFormat how, int subitemIndex)
{
Init();
SetText(text);
SetWidth(width, text);
SetFormat(how);
SetSubItem(subitemIndex);
}
示例14: SetWidth
wxGridCellFloatRenderer::wxGridCellFloatRenderer(int width,
int precision,
int format)
{
SetWidth(width);
SetPrecision(precision);
SetFormat(format);
}
示例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);
}