本文整理汇总了C#中FMOD.TAG类的典型用法代码示例。如果您正苦于以下问题:C# TAG类的具体用法?C# TAG怎么用?C# TAG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TAG类属于FMOD命名空间,在下文中一共展示了TAG类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tag
public Tag(TAG tag)
: this()
{
Name = tag.name;
Type = (TagType)tag.type;
DataType = (TagDataType)tag.datatype;
Updated = tag.updated;
Data = new byte[tag.datalen];
Marshal.Copy(tag.data, Data, 0, (int)tag.datalen);
}
示例2: FMOD_Sound_GetTag
private static extern RESULT FMOD_Sound_GetTag(IntPtr sound, string name, int index, ref TAG tag);
示例3: getTag
public RESULT getTag(string name, int index, ref TAG tag)
{
return FMOD_Sound_GetTag(soundraw, name, index, ref tag);
}
示例4: FMOD_Sound_GetTag
public RESULT getTag (string name, int index, out TAG tag)
{
return FMOD_Sound_GetTag(rawPtr, name, index, out tag);
}
示例5: getTag
public RESULT getTag(string name, int index, ref TAG tag)
{
IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(tag));
RESULT result = FMOD_Sound_GetTag(soundraw, name, index, ptr);
if(result == RESULT.OK)
{
tag = (TAG)Marshal.PtrToStructure(ptr, typeof(TAG));
}
return result;
}
示例6: GetSoundName
private string GetSoundName(Sound sound)
{
//original implementation did not return all characters
//StringBuilder name = new StringBuilder(0x100);
//sound.getName(name, name.Capacity);
//begin custom implementation
string name = "";
var tagCount = 0;
var tagsUpdated = 0;
sound.getNumTags(ref tagCount, ref tagsUpdated);
TAG tag = new TAG();
for (var i = 0; i < tagCount; i++) {
sound.getTag(null, i, ref tag);
if (tag.name == "TIT2") {
name = Marshal.PtrToStringAnsi(tag.data);
break;
}
}
return name;
}
示例7: Update
private void Update(object sender)
{
if (sound == null) return;
invoke(new SoundDelegate(() =>
{
try
{
FMODExec(system.update());
TAG tag = new TAG();
int numTags = 0;
int numTagsUpdated = 0;
var res = sound.getNumTags(ref numTags, ref numTagsUpdated);
if (res == RESULT.OK && numTagsUpdated > 0)
{
for (int i=0; i < numTags; i++)
{
if (sound.getTag(null, i, ref tag) != RESULT.OK)
{
continue;
}
if (tag.type == TAGTYPE.FMOD && tag.name == "Sample Rate Change")
{
float newfreq = (float)Marshal.PtrToStructure(tag.data, typeof(float));
Logger.DebugLog("New stream frequency: " + newfreq.ToString("F" + 0));
channel.setFrequency(newfreq);
}
if (tag.datatype != TAGDATATYPE.STRING) continue;
// Tell listeners about the Stream tag. This can be
// displayed to the user.
if (OnStreamInfo != null)
OnStreamInfo(this, new StreamInfoArgs(tag.name.ToLower(), Marshal.PtrToStringAnsi(tag.data)));
}
}
}
catch (Exception ex)
{
Logger.DebugLog("Error getting stream tags: " + ex.Message);
}
}));
}
示例8: getTag
public RESULT getTag(string name, int index, out TAG tag)
{
return Sound.FMOD5_Sound_GetTag(this.rawPtr, name, index, out tag);
}
示例9: CheckTags
private void CheckTags(object sender)
{
if (sound == null) return;
invoke(new SoundDelegate(() =>
{
try
{
TAG tag = new TAG();
while (sound.getTag(null, -1, ref tag) == RESULT.OK)
{
if (tag.datatype != TAGDATATYPE.STRING) continue;
// Tell listeners about the Stream tag. This can be
// displayed to the user.
if (OnStreamInfo != null)
OnStreamInfo(this, new StreamInfoArgs(tag.name.ToLower(), Marshal.PtrToStringAnsi(tag.data)));
}
}
catch (Exception ex)
{
Logger.DebugLog("Error getting stream tags: " + ex.Message);
}
}));
}
示例10: GetProgress
public string GetProgress()
{
if (sound == null) return null;
RESULT result;
uint ms = 0;
uint lenms = 0;
bool playing = false;
bool paused = false;
if (channel != null)
{
result = channel.isPlaying(ref playing);
if ((result != RESULT.OK) && (result != RESULT.ERR_INVALID_HANDLE))
ERRCHECK(result);
result = channel.getPaused(ref paused);
if ((result != RESULT.OK) && (result != RESULT.ERR_INVALID_HANDLE))
ERRCHECK(result);
result = channel.getPosition(ref ms, TIMEUNIT.MS);
if ((result != RESULT.OK) && (result != RESULT.ERR_INVALID_HANDLE))
ERRCHECK(result);
result = sound.getLength(ref lenms, TIMEUNIT.MS);
if ((result != RESULT.OK) && (result != RESULT.ERR_INVALID_HANDLE))
ERRCHECK(result);
}
if (system != null)
system.update();
var duration = TimeSpan.FromMilliseconds(lenms);
var position = TimeSpan.FromMilliseconds(ms);
var songName = new StringBuilder(64);
sound.getName(songName, songName.Capacity);
int numTags = 0;
int blah = 0;
sound.getNumTags(ref numTags, ref blah);
var tags = new StringBuilder();
for (var i = 0; i < numTags; i++)
{
TAG tag = new TAG();
sound.getTag(null, i, ref tag);
tags.AppendFormat("{0} => {1}", tag.name, tag.data).AppendLine();
}
var status = string.Format(
@"{0:mm\:ss} / {1:mm\:ss}
{2}
{3}
{4}
",
position,
duration,
paused ? "Paused " : playing ? "Playing" : "Stopped",
songName,
tags
);
return status;
}