This project has moved and is read-only. For the latest updates, please go here.

Cue Reader Example

Aug 18, 2013 at 6: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:
I would be willing to make a small donation for an example.
Thanks, Wyatt
Aug 20, 2013 at 4: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 6:42 PM
Edited Aug 22, 2013 at 6: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
Aug 28, 2013 at 8: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).
Aug 28, 2013 at 8:29 PM
This document describes how cues are stored:

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.

Aug 29, 2013 at 12:25 AM
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
Sep 2, 2013 at 5: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 10: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