Cue Reader Example

Aug 18, 2013 at 5:43 PM
Hi All,
I was wondering if anyone might have a simple example on how the cue reader works. Let's say I have a wav file, or a raw .DAT( 16bit Stereo) that has cues embedded in it. How could I read those cues and display them in a listbox, or something simple:
Messagebox.show(mycuelist)
I would be willing to make a small donation for an example.
Thanks, Wyatt
Coordinator
Aug 20, 2013 at 3:12 PM
Try something like this:
using(var reader = new CueWaveFileReader("audio.wav"))
{
   for(int n = 0; n < reader.Cues.Count; n++)
   {
       var cue = reader.Cues[n];
       Console.WriteLine("Cue {0} at position {1}", cue.Label, cue.Position);
   }
}
Aug 22, 2013 at 5:42 PM
Edited Aug 22, 2013 at 5:53 PM
Thanks Mark. That worked to display in my listbox. I know your busy. Another question. How could I seek or skip to next cue position or cue label?
Or wavestream.Position = cue.Label ?
Sorry for the noob questions.
Many Thanks, Wyatt
Coordinator
Aug 28, 2013 at 7:19 PM
Good question. I don't know whether the cue positions are in bytes or samples. If samples you might need to multiply by 2 for 16 bit (and maybe by 2 again for stereo).
Coordinator
Aug 28, 2013 at 7:29 PM
This document describes how cues are stored:
http://www.sonicspot.com/guide/wavefiles.html#cue

the NAudio cue support was actually a third party contribution so I don't know exactly how it works. It does seem that cues use byte offsets though so I would hope that
wavestream.Position = cue.Position
ought to do the right thing. The label is the name of the cue.

Mark
Aug 28, 2013 at 11:25 PM
I'm pretty sure it listed in samples. The only way I've found so far to skip to the next cue is using the code you provided above to put them in a listbox, and then:

Private wave As NAudio.Wave.WaveFileReader`
wave.Seek(wave.WaveFormat.AverageBytesPerSecond * cue.position \44100, SeekOrigin.Begin)
` Would this way be accurate?
More questions:

How could I display the cues from a rawstream (.DAT file from DDP fileset)
Could the third party person be contacted?

Thanks, Wyatt
Coordinator
Sep 2, 2013 at 4:15 PM
hi, I'm afraid I have no idea how the .DAT files are formatted, so without that it would not be possible to extract the cues
Sep 2, 2013 at 9:24 PM
Thanks Mark.
The .DAT file from a DDP fileset that I'm using for my player are always in the following format:
Audio format is 44100Hz, 16-bit, stereo