private void timer_Tick(object sender, System.EventArgs e) { FMOD.RESULT result; FMOD.OPENSTATE openstate = 0; uint percentbuffered = 0; bool starving = false; bool busy = false; if (soundcreated) { result = sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); ERRCHECK(result); if (openstate == FMOD.OPENSTATE.READY && channel == null) { result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel); ERRCHECK(result); } } if (channel != null) { uint ms = 0; bool playing = false; bool paused = false; for (;;) { FMOD.TAG tag = new FMOD.TAG(); if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { textBox.Text = tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + " (" + tag.datalen + " bytes)"; } else { break; } } result = channel.getPaused(ref paused); ERRCHECK(result); result = channel.isPlaying(ref playing); ERRCHECK(result); result = channel.getPosition(ref ms, FMOD.TIMEUNIT.MS); ERRCHECK(result); statusBar.Text = "Time " + (ms / 1000 / 60) + ":" + (ms / 1000 % 60) + ":" + (ms / 10 % 100) + (openstate == FMOD.OPENSTATE.BUFFERING ? " Buffering..." : (openstate == FMOD.OPENSTATE.CONNECTING ? " Connecting..." : (paused ? " Paused " : (playing ? " Playing " : " Stopped ")))) + "(" + percentbuffered + "%)" + (starving ? " STARVING" : " "); } if (system != null) { system.update(); } }
private void timer_Tick(object sender, System.EventArgs e) { FMOD.RESULT result; FMOD.OPENSTATE openstate = 0; if (soundcreated) { uint percentbuffered = 0; bool starving = false; bool busy = false; result = sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); ERRCHECK(result); if (openstate == FMOD.OPENSTATE.READY && channel == null) { result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel); ERRCHECK(result); } } if (channel != null) { uint ms = 0; bool playing = false; bool paused = false; int tagsupdated = 0; int numtags = 0; result = sound.getNumTags(ref numtags, ref tagsupdated); ERRCHECK(result); if (tagsupdated != 0) { for (;;) { FMOD.TAG tag = new FMOD.TAG(); if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { FMOD.SOUND_FORMAT format = FMOD.SOUND_FORMAT.NONE; int channels = 0; int bits = 0; sound.getFormat(ref gSoundType, ref format, ref channels, ref bits); if (tag.name == "ARTIST") { if (Marshal.PtrToStringAnsi(tag.data) != gCurrentTrackArtist) { gCurrentTrackArtist = Marshal.PtrToStringAnsi(tag.data); gUpdateFileName = true; } } if (tag.name == "TITLE") { if (Marshal.PtrToStringAnsi(tag.data) != gCurrentTrackTitle) { gCurrentTrackTitle = Marshal.PtrToStringAnsi(tag.data); gUpdateFileName = true; } } break; } else { break; } } } result = channel.isPlaying(ref playing); if (result != FMOD.RESULT.OK || !playing) { sound.release(); sound = null; channel = null; } else { result = channel.getPaused(ref paused); ERRCHECK(result); result = channel.getPosition(ref ms, FMOD.TIMEUNIT.MS); ERRCHECK(result); statusBar.Text = "Time " + (ms / 1000 / 60) + ":" + (ms / 1000 % 60) + ":" + (ms / 10 % 100) + (paused ? " Paused " : playing ? " Playing" : " Stopped"); } } if (sound != null) { uint percentbuffered = 0; bool starving = false; bool busy = false; sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); if (openstate == FMOD.OPENSTATE.ERROR) { sound.release(); sound = null; channel = null; } } if (openstate == FMOD.OPENSTATE.ERROR) { statusBar.Text = "Error occurred or stream ended. Restarting stream.."; result = system.createSound(url, (FMOD.MODE.HARDWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | FMOD.MODE.NONBLOCKING), ref exinfo, ref sound); ERRCHECK(result); } if (system != null) { system.update(); } }
private void timer_Tick(object sender, System.EventArgs e) { FMOD.RESULT result; FMOD.OPENSTATE openstate = 0; uint percentbuffered = 0; bool starving = false; bool busy = false; if (soundcreated) { result = sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); ERRCHECK(result); if (openstate == FMOD.OPENSTATE.READY && channel == null) { result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel); ERRCHECK(result); } } if (channel != null) { uint ms = 0; bool playing = false; bool paused = false; for (;;) { FMOD.TAG tag = new FMOD.TAG(); if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { textBox.Text = tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + " (" + tag.datalen + " bytes)"; } else { break; } } result = channel.getPaused(ref paused); ERRCHECK(result); result = channel.isPlaying(ref playing); ERRCHECK(result); result = channel.getPosition(ref ms, FMOD.TIMEUNIT.MS); ERRCHECK(result); statusBar.Text = "Time " + (ms /1000 / 60) + ":" + (ms / 1000 % 60) + ":" + (ms / 10 % 100) + (openstate == FMOD.OPENSTATE.BUFFERING ? " Buffering..." : (openstate == FMOD.OPENSTATE.CONNECTING ? " Connecting..." : (paused ? " Paused " : (playing ? " Playing " : " Stopped ")))) + "(" + percentbuffered + "%)" + (starving ? " STARVING" : " "); } if (system != null) { system.update(); } }
private void ReadTags_Load(object sender, System.EventArgs e) { FMOD.TAG tag = new FMOD.TAG(); int numtags = 0, numtagsupdated = 0; uint version = 0; FMOD.RESULT result; /* Create a System object and initialize. */ result = FMOD.Factory.System_Create(ref system); ERRCHECK(result); result = system.getVersion(ref version); ERRCHECK(result); if (version < FMOD.VERSION.number) { MessageBox.Show("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + FMOD.VERSION.number.ToString("X") + "."); Application.Exit(); } result = system.init(100, FMOD.INITFLAGS.NORMAL, (IntPtr)null); ERRCHECK(result); /* Open the specified file. Use FMOD_CREATESTREAM and FMOD_DONTPREBUFFER so it opens quickly */ result = system.createSound("../../../../../examples/media/wave.mp3", (FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | FMOD.MODE.OPENONLY), ref sound); ERRCHECK(result); /* Read and display all tags associated with this file */ for (;;) { /* An index of -1 means "get the first tag that's new or updated". If no tags are new or updated then getTag will return FMOD_ERR_TAGNOTFOUND. This is the first time we've read any tags so they'll all be new but after we've read them, they won't be new any more. */ if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { listBox.Items.Add(tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + " (" + tag.datalen + " bytes)"); } else { listBox.Items.Add(tag.name + " = <binary> (" + tag.datalen + " bytes)"); } } listBox.Items.Add(" "); /* Read all the tags regardless of whether they're updated or not. Also show the tag type. */ result = sound.getNumTags(ref numtags, ref numtagsupdated); ERRCHECK(result); for (int count=0; count < numtags; count++) { string tagtext = null; result = sound.getTag(null, count, ref tag); ERRCHECK(result); switch (tag.type) { case FMOD.TAGTYPE.UNKNOWN : tagtext = "FMOD_TAGTYPE_UNKNOWN "; break; case FMOD.TAGTYPE.ID3V1 : tagtext = "FMOD_TAGTYPE_ID3V1 "; break; case FMOD.TAGTYPE.ID3V2 : tagtext = "FMOD_TAGTYPE_ID3V2 "; break; case FMOD.TAGTYPE.VORBISCOMMENT : tagtext = "FMOD_TAGTYPE_VORBISCOMMENT "; break; case FMOD.TAGTYPE.SHOUTCAST : tagtext = "FMOD_TAGTYPE_SHOUTCAST "; break; case FMOD.TAGTYPE.ICECAST : tagtext = "FMOD_TAGTYPE_ICECAST "; break; case FMOD.TAGTYPE.ASF : tagtext = "FMOD_TAGTYPE_ASF "; break; case FMOD.TAGTYPE.FMOD : tagtext = "FMOD_TAGTYPE_FMOD "; break; case FMOD.TAGTYPE.USER : tagtext = "FMOD_TAGTYPE_USER "; break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { tagtext += (tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + "(" + tag.datalen + " bytes)"); } else { tagtext += (tag.name + " = ??? (" + tag.datalen + " bytes)"); } listBox.Items.Add(tagtext); } listBox.Items.Add(" "); /* Find a specific tag by name. Specify an index > 0 to get access to multiple tags of the same name. */ result = sound.getTag("ARTIST", 0, ref tag); ERRCHECK(result); listBox.Items.Add(tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + " (" + tag.datalen + " bytes)"); }
/// <summary> /// Gets the tag info from a specific tag /// </summary> /// <param name="tag"></param> /// <param name="tagInfo"></param> /// <returns></returns> private void SetSongInfo(FMOD.TAG tag, TagInfo tagInfo) { string data = null; if (tag.datatype == FMOD.TAGDATATYPE.STRING) { data = Marshal.PtrToStringAnsi(tag.data); } else if (tag.datatype == FMOD.TAGDATATYPE.STRING_UTF16) { data = Marshal.PtrToStringUni(tag.data); } else if (tag.datatype == FMOD.TAGDATATYPE.INT) { data = Marshal.ReadInt32(tag.data).ToString(); } if (tag.type == FMOD.TAGTYPE.ASF) { //where does it go? switch (tag.name) { case ASFFrames.ARTIST: tagInfo.Artist = data; break; case ASFFrames.ALBUM: tagInfo.Album = data; break; case ASFFrames.TITLE: tagInfo.Title = data; break; case ASFFrames.TRACK: tagInfo.Track = data; break; default: break; } } else if (tag.type == FMOD.TAGTYPE.ID3V1 || tag.type == FMOD.TAGTYPE.ID3V2) { //get ID3 v1 tags first. these are usually replaced with ID3v2, unless ID3v2 doesn't exist if (tag.type == FMOD.TAGTYPE.ID3V1) { //where does it go? switch (tag.name) { case ID3v1Frames.ARTIST: tagInfo.Artist = data; break; case ID3v1Frames.ALBUM: tagInfo.Album = data; break; case ID3v1Frames.TITLE: tagInfo.Title = data; break; case ID3v1Frames.TRACK: tagInfo.Track = data; break; default: break; } } if (tag.type == FMOD.TAGTYPE.ID3V2) { //where does it go? switch (tag.name) { case ID3v2Frames.ARTIST: tagInfo.Artist = data; break; case ID3v2Frames.ALBUM: tagInfo.Album = data; break; case ID3v2Frames.TITLE: tagInfo.Title = data; break; case ID3v1Frames.TRACK: tagInfo.Track = data; break; default: break; } } } }
private void timer_Tick(object sender, System.EventArgs e) { FMOD.RESULT result; FMOD.OPENSTATE openstate = 0; if (soundcreated) { uint percentbuffered = 0; bool starving = false; bool busy = false; result = sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); ERRCHECK(result); if (openstate == FMOD.OPENSTATE.READY && channel == null) { result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel); ERRCHECK(result); } } if (channel != null) { uint ms = 0; bool playing = false; bool paused = false; int tagsupdated = 0; int numtags = 0; result = sound.getNumTags(ref numtags, ref tagsupdated); ERRCHECK(result); if (tagsupdated != 0) { for (;;) { FMOD.TAG tag = new FMOD.TAG(); if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { FMOD.SOUND_FORMAT format = FMOD.SOUND_FORMAT.NONE; int channels = 0; int bits = 0; sound.getFormat(ref gSoundType, ref format, ref channels, ref bits); if (tag.name == "ARTIST") { if (Marshal.PtrToStringAnsi(tag.data) != gCurrentTrackArtist) { gCurrentTrackArtist = Marshal.PtrToStringAnsi(tag.data); gUpdateFileName = true; } } if (tag.name == "TITLE") { if (Marshal.PtrToStringAnsi(tag.data) != gCurrentTrackTitle) { gCurrentTrackTitle = Marshal.PtrToStringAnsi(tag.data); gUpdateFileName = true; } } break; } else { break; } } } result = channel.isPlaying(ref playing); if (result != FMOD.RESULT.OK || !playing) { sound.release(); sound = null; channel = null; } else { result = channel.getPaused(ref paused); ERRCHECK(result); result = channel.getPosition(ref ms, FMOD.TIMEUNIT.MS); ERRCHECK(result); statusBar.Text = "Time " + (ms /1000 / 60) + ":" + (ms / 1000 % 60) + ":" + (ms / 10 % 100) + (paused ? " Paused " : playing ? " Playing" : " Stopped"); } } if (sound != null) { uint percentbuffered = 0; bool starving = false; bool busy = false; sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); if (openstate == FMOD.OPENSTATE.ERROR) { sound.release(); sound = null; channel = null; } } if (openstate == FMOD.OPENSTATE.ERROR) { statusBar.Text = "Error occurred or stream ended. Restarting stream.."; result = system.createSound(url, (FMOD.MODE.HARDWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | FMOD.MODE.NONBLOCKING), ref exinfo, ref sound); ERRCHECK(result); } if (system != null) { system.update(); } }
private void ReadTags_Load(object sender, System.EventArgs e) { FMOD.TAG tag = new FMOD.TAG(); int numtags = 0, numtagsupdated = 0; uint version = 0; FMOD.RESULT result; /* * Create a System object and initialize. */ result = FMOD.Factory.System_Create(ref system); ERRCHECK(result); result = system.getVersion(ref version); ERRCHECK(result); if (version < FMOD.VERSION.number) { MessageBox.Show("Error! You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + FMOD.VERSION.number.ToString("X") + "."); Application.Exit(); } result = system.init(100, FMOD.INITFLAGS.NORMAL, (IntPtr)null); ERRCHECK(result); /* * Open the specified file. Use FMOD_CREATESTREAM and FMOD_DONTPREBUFFER so it opens quickly */ result = system.createSound("../../../../../examples/media/wave.mp3", (FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.CREATESTREAM | FMOD.MODE.OPENONLY), ref sound); ERRCHECK(result); /* * Read and display all tags associated with this file */ for (;;) { /* * An index of -1 means "get the first tag that's new or updated". * If no tags are new or updated then getTag will return FMOD_ERR_TAGNOTFOUND. * This is the first time we've read any tags so they'll all be new but after we've read them, * they won't be new any more. */ if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { listBox.Items.Add(tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + " (" + tag.datalen + " bytes)"); } else { listBox.Items.Add(tag.name + " = <binary> (" + tag.datalen + " bytes)"); } } listBox.Items.Add(" "); /* * Read all the tags regardless of whether they're updated or not. Also show the tag type. */ result = sound.getNumTags(ref numtags, ref numtagsupdated); ERRCHECK(result); for (int count = 0; count < numtags; count++) { string tagtext = null; result = sound.getTag(null, count, ref tag); ERRCHECK(result); switch (tag.type) { case FMOD.TAGTYPE.UNKNOWN: tagtext = "FMOD_TAGTYPE_UNKNOWN "; break; case FMOD.TAGTYPE.ID3V1: tagtext = "FMOD_TAGTYPE_ID3V1 "; break; case FMOD.TAGTYPE.ID3V2: tagtext = "FMOD_TAGTYPE_ID3V2 "; break; case FMOD.TAGTYPE.VORBISCOMMENT: tagtext = "FMOD_TAGTYPE_VORBISCOMMENT "; break; case FMOD.TAGTYPE.SHOUTCAST: tagtext = "FMOD_TAGTYPE_SHOUTCAST "; break; case FMOD.TAGTYPE.ICECAST: tagtext = "FMOD_TAGTYPE_ICECAST "; break; case FMOD.TAGTYPE.ASF: tagtext = "FMOD_TAGTYPE_ASF "; break; case FMOD.TAGTYPE.FMOD: tagtext = "FMOD_TAGTYPE_FMOD "; break; case FMOD.TAGTYPE.USER: tagtext = "FMOD_TAGTYPE_USER "; break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { tagtext += (tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + "(" + tag.datalen + " bytes)"); } else { tagtext += (tag.name + " = ??? (" + tag.datalen + " bytes)"); } listBox.Items.Add(tagtext); } listBox.Items.Add(" "); /* * Find a specific tag by name. Specify an index > 0 to get access to multiple tags of the same name. */ result = sound.getTag("ARTIST", 0, ref tag); ERRCHECK(result); listBox.Items.Add(tag.name + " = " + Marshal.PtrToStringAnsi(tag.data) + " (" + tag.datalen + " bytes)"); }
/// <summary> /// Die Informationen (TOC) einer CD auslesen /// </summary> public CDInfo ReadCDInformation(char driveLetter) { if (Settings.Current.UseMCI) { return(ReadCDInformationMCI(driveLetter)); } CDInfo mciCDInfo = ReadCDInformationMCI(driveLetter); if (mciCDInfo.Tracks.Any(x => x.TrackType != TrackType.Audio)) // Bei einer Daten-CD nehmen wir MCI { return(mciCDInfo); } string drive = string.Format("{0}:", driveLetter); FMOD.Sound cdSound = null; FMOD.RESULT result = system.createStream(drive, FMOD.MODE.OPENONLY, ref cdSound); if (result != FMOD.RESULT.OK || cdSound == null) { return(mciCDInfo); } int numberOfTracks = 0; cdSound.getNumSubSounds(ref numberOfTracks); FMOD.CDTOC cdToc = new FMOD.CDTOC(); int numtags = 0; int numtagsupdated = 0; cdSound.getNumTags(ref numtags, ref numtagsupdated); for (int i = 0; i < numtags; i++) { FMOD.TAG tag = new FMOD.TAG(); if (cdSound.getTag(null, i, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.CDTOC) { cdToc = (FMOD.CDTOC)Marshal.PtrToStructure(tag.data, typeof(FMOD.CDTOC)); break; } } CDInfo cdInfo = new CDInfo(); int trackNr = 0; for (; trackNr < numberOfTracks; trackNr++) { CDInfoTrack track = new CDInfoTrack(); track.StartTime = (((cdToc.min[trackNr] * 60 + cdToc.sec[trackNr]) * 75 + cdToc.frame[trackNr]) * 1000 + 74) / 75; if (trackNr > 0) { cdInfo.Tracks[trackNr - 1].Length = track.StartTime - cdInfo.Tracks[trackNr - 1].StartTime; } track.TrackType = TrackType.Audio; cdInfo.Tracks.Add(track); } cdInfo.TotalLength = (((cdToc.min[numberOfTracks] * 60 + cdToc.sec[numberOfTracks]) * 75 + cdToc.frame[numberOfTracks]) * 1000 + 74) / 75; cdInfo.Tracks[trackNr - 1].Length = cdInfo.TotalLength - cdInfo.Tracks[trackNr - 1].StartTime; cdSound.release(); /*StringBuilder volumeName = new StringBuilder(1000); * StringBuilder fileSystemNameBuffer = new StringBuilder(1000); * uint serialNumber = 0; * uint maximumComponentLength = 0; * uint fileSystemFlags = 0; * GetVolumeInformation(drive, volumeName, 1000, ref serialNumber, ref maximumComponentLength, ref fileSystemFlags, fileSystemNameBuffer, 1000); * * cdInfo.Identity = serialNumber.ToString();*/ cdInfo.Identity = mciCDInfo.Identity; return(cdInfo); }
public static void GetSoundTags(string filename, SoundFileInformation soundFileInfo) { FMOD.Sound sound = null; FMOD.RESULT res = SoundEngine.Instance.system.createStream(filename, FMOD.MODE.OPENONLY, ref sound); if (sound != null) { int numtags = 0; int num2tags = 0; sound.getNumTags(ref numtags, ref num2tags); for (int i = 0; i < numtags; i++) { FMOD.TAG tag2 = new FMOD.TAG(); res = sound.getTag(null, i, ref tag2); if (res != FMOD.RESULT.ERR_TAGNOTFOUND) { string tagName = tag2.name.ToLower(); if (tagName == "title") { soundFileInfo.Title = Marshal.PtrToStringAnsi(tag2.data); } if (tagName == "author" || tagName == "artist") { soundFileInfo.Artist = Marshal.PtrToStringAnsi(tag2.data); } if (tagName == "wm/tracknumber" || tagName == "tracknumber") { if (tag2.datatype == FMOD.TAGDATATYPE.STRING) { soundFileInfo.TrackNumber = Big3.Hitbase.Miscellaneous.Misc.Atoi(Marshal.PtrToStringAnsi(tag2.data)); } if (tag2.datatype == FMOD.TAGDATATYPE.INT) { soundFileInfo.TrackNumber = Convert.ToInt32(Marshal.ReadInt32(tag2.data)); } } if (tagName == "wm/composer") { soundFileInfo.Composer = Marshal.PtrToStringAnsi(tag2.data); } if (tagName == "wm/albumtitle" || tagName == "album") { soundFileInfo.Album = Marshal.PtrToStringAnsi(tag2.data); } if (tagName == "wm/year") { soundFileInfo.Year = Big3.Hitbase.Miscellaneous.Misc.Atoi(Marshal.PtrToStringAnsi(tag2.data)); } if (tagName == "wm/genre" || tagName == "genre") { soundFileInfo.Genre = Marshal.PtrToStringAnsi(tag2.data); } } } sound.release(); } }
/// <summary> /// Returns a specific tag by its index. /// </summary> /// <param name="index">Index of the tag</param> /// <returns>Tag object</returns> public FMOD.TAG GetFMODTag(int index) { FMOD.RESULT result; try { if (BaseSound != null) { FMOD.TAG tag = new FMOD.TAG(); result = BaseSound.getTag(null, index, ref tag); System.CheckForError(result); return tag; } } catch (Exception ex) { throw ex; } return new FMOD.TAG(); }
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { FMOD.RESULT result; FMOD.OPENSTATE openstate = 0; uint percentbuffered = 0; bool starving = false; bool busy = false; if (soundcreated) { result = sound.getOpenState(ref openstate, ref percentbuffered, ref starving, ref busy); ERRCHECK(result); if (openstate == FMOD.OPENSTATE.READY && channel == null) { result = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel); ERRCHECK(result); } } if (channel != null) { uint ms = 0; bool playing = false; bool paused = false; bool metadataupdated = false; for (; ; ) { FMOD.TAG tag = new FMOD.TAG(); if (sound.getTag(null, -1, ref tag) != FMOD.RESULT.OK) { break; } if (tag.datatype == FMOD.TAGDATATYPE.STRING) { switch (tag.name.ToLower()) { case "title": _title = Marshal.PtrToStringAnsi(tag.data); metadataupdated = true; break; case "artist": _artist = Marshal.PtrToStringAnsi(tag.data); metadataupdated = true; break; } } else { break; } } if (metadataupdated) if (MetadataChanged != null) MetadataChanged(this, new PlaybackMetaDataChangedEventArgs() { Artist = _artist, Track = _title }); result = channel.getPaused(ref paused); ERRCHECK(result); result = channel.isPlaying(ref playing); ERRCHECK(result); result = channel.getPosition(ref ms, FMOD.TIMEUNIT.MS); ERRCHECK(result); if (playing != _playing) { _playing = playing; if (PlaybackStatusChanged != null) PlaybackStatusChanged(this, EventArgs.Empty); } //statusBar.Text = "Time " + (ms / 1000 / 60) + ":" + (ms / 1000 % 60) + ":" + (ms / 10 % 100) + (openstate == FMOD.OPENSTATE.BUFFERING ? " Buffering..." : (openstate == FMOD.OPENSTATE.CONNECTING ? " Connecting..." : (paused ? " Paused " : (playing ? " Playing " : " Stopped ")))) + "(" + percentbuffered + "%)" + (starving ? " STARVING" : " "); } if (system != null) { system.update(); } }