#1 Burning Software

It is currently Wed Dec 18, 2024 10:58 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Audio Compress on-the-fly using starburn.dll
PostPosted: Tue Feb 02, 2010 3:25 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
My goal is to perform on-the-fly compression (wma) of audio CDs. I see I can do this pretty easily using StarburnX and the GrabTrackAsAudio function. However, we are currently using the starburn.dll for burning and would prefer to stay with this rather than include the StarburnX dll. It appears the route would involve using the StarWave functionality, but this just provides conversion of an already grabbed wav file. I've trolled the board and sdk manual, but can't find a sample to demonstrate a direct grab from a CD drive to compressed audio file. Can you recommend a sample or place in the manual to look for try to mimic the GrabTrackAsAudio function using the starburn.dll functions? I'm developing in .Net (C# or VB.Net).
Thanks.


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Tue Feb 02, 2010 3:58 pm 
Offline

Joined: Thu Dec 13, 2007 8:44 am
Posts: 609
Hello,

1) It seems starburn.dll ( StarBurn SDK) does not provide the magic function smt. like GrabTrackAsAudio :) you should use ( at least ) the next two functions :

StarBurn_CdvdBurnerGrabber_GrabTrack and StarBurn_StarWave_UncompressedFileCompress.

2) Look into the MSVS C++ examples - AudioGarabber and AudioCompressor ( they are located in the \Samples\StarBurn Core\MSVC\ folder )

Regards,

Dmitry


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Wed Feb 03, 2010 4:03 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
Dmitry,
Thanks for your response. I originally thought the GrabtrackAsAudio was performing an on-the-fly conversion in the sense that it was encoding chunks as it grabbed the wav file. From the source in the MSVS samples it appears it grabs the entire wav file before sending it for compression. This is fine, I just had it wrong in my mind.

I've implemented the GrabTrack and it works fine, but I'm having a problem with converting the StarBurn_StarWave_UncompressedFileCompress function to C#. The following are the pieces of code I'm using. The problem is I'm not sure how to properly define the PSTARBURN_STARWAVE_CALLBACK parameter. I was hoping you may be able to provide some guidance.

Code:

        [DllImport("StarBurn.dll")]
        private static extern ulong StarBurn_StarWave_UncompressedFileCompress
        (
           string p__PCHAR__SourceUncompressedFileName,
           string p__PCHAR__DestinationCompressedFileName,
           ulong p__ULONG__WorkingBufferSizeInUCHARs,
           PSTARBURN_STARWAVE_CALLBACK p__PSTARBURN_STARWAVE_CALLBACK,
           uint p__PVOID__Context,
           STARBURN_STARWAVE_COMPRESSION p__STARBURN_STARWAVE_COMPRESSION
         );

        public enum STARBURN_STARWAVE_CALLBACK_REASON  :uint
        {
            STARBURN_STARWAVE_CALLBACK_REASON_UNKNOWN = 0, // Unknown call reason
            STARBURN_STARWAVE_CALLBACK_REASON_PROGRESS // Progress indication reason
        }

        public ulong CompressorCallback(
            ulong p__ULONG__Reason,
            ulong p__ULONG__Parameter,
            IntPtr p__PVOID__Context)
        { return  0; }

        public delegate uint PSTARBURN_STARWAVE_CALLBACK(
             uint p__ULONG__Reason,
             uint p__ULONG__Parameter,
             IntPtr p__PVOID__Context);


// *** calling function in my compression sub
                 l__ULONG__Status = StarBurn_StarWave_UncompressedFileCompress
                (
                    destPath,
                    System.IO.Path.ChangeExtension(destPath, ".wma"),
                    STARBURN_STARWAVE_IO_BUFFER_SIZE_IN_UCHARS,
                   (PSTARBURN_STARWAVE_CALLBACK)CompressorCallback,    // [color=#BF0000]<===  I'm not sure how to define this[/color]
                    0,
                    STARBURN_STARWAVE_COMPRESSION.STARBURN_STARWAVE_COMPRESSION_WMA_LOSSLESS_VBR_Q100
                  );
             



Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Thu Feb 04, 2010 3:31 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
I found the problem. I needed to change the ulong declarations to uint in the following.
public ulong CompressorCallback(
ulong p__ULONG__Reason,
ulong p__ULONG__Parameter,
IntPtr p__PVOID__Context)
{ return 0; }


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Thu Feb 04, 2010 4:46 pm 
Offline

Joined: Thu Dec 13, 2007 8:44 am
Posts: 609
Hello,

Hmmm it seems should be System.UInt32=>uint :))

Regards,


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Fri Feb 05, 2010 1:34 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
Dmitry,
I'm making progress but decided to take it a bit further and have bumped into another problem. Rather than grab the wav file and then send it to the compressor, I'd like to do this on the fly. I see now that the StarBurn_CdvdBurnerGrabber_GrabTrackEx function has a call back with the data chunks as it rips. I assume then I can compress these on the fly by first creating the CompressedFileWriterObject when the p__PSTARBURN_CreateFILE_CALLBACK is called and then actually compress the chunks when the p__PSTARBURN_WRITEFILE_CALLBACK is called using the returned value of lpBuffer and nNumberOfBytesToWrite from the callback.

The problem is when I attempt to compress the chunk using the StarBurn_StarWave_CompressedFileWriterObjectWrite function with these 2 values I keep getting a "Header is bad" error. I believe I'm creating the CompressedFileWriterObject properly since the LOG shows it being created properly. Below is the snippet from the log when I call the StarBurn_StarWave_CompressedFileWriterObjectWrite function using:
parameters:
previously created CompressedFileWriterObject
lpBuffer (exact value returned in the p__PSTARBURN_WRITEFILE_CALLBACK)
nNumberOfBytesToWrite (exact value returned in the p__PSTARBURN_WRITEFILE_CALLBACK)

Again, I'm trying to do this in C#. Any idea why I would be getting this error?
Thanks.

StarWave_CompressedFileWriterObjectWrite(): >>> ENTERed
StarWave_CompressedFileWriterObjectWrite(): p__PVOID__CompressedFileWriterObject == 0x013BAB64
StarWave_CompressedFileWriterObjectWrite(): p__PVOID__WriteDataBuffer == 0x08C3C4A4
StarWave_CompressedFileWriterObjectWrite(): p__ULONG__WriteSizeInUCHARs == 61152 ( 0xeee0 )
StarWave_CompressedFileWriterObjectWrite(): Header is bad, got 0x3cfff0 instead of expected 0x48435752, failed, status 87 ( 0x57 )
StarWave_CompressedFileWriterObjectWrite(): <<< EXITing with success


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Fri Feb 05, 2010 8:49 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
This means the pointer you pass as an object is invalid.


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Mon Feb 08, 2010 2:35 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
Thanks Anton, I wasn't handling one of the "out" parameters correctly, I've got it working now.

I've noticed the rip speed is pretty slow. I'm a little confused about the functions. I assume the GrabTrackEx function performs the error correction processes I've read about in the forum and potentially why it's a bit slow. Does the ReadRaw function perform the same type of error correction or is this a straight read? Is it any faster? The basis is an audio CD ripping program. I'm wondering if I should be using a different function than GrabTrackEx. I wasn't too clear as to the difference in GrabTrackEx, ReadRaw and ReadCooked, excepted that in the Read functions you can specify the specific sectors.
thanks


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Mon Feb 08, 2010 8:47 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Slow - is very relative thing... 1) Did you set maximum possible performance before ripping? 2) Do you have other programs ripping CDs much faster?
Error correction is not used with AudioCDs as there's no such thing as "error correction" in context of AudioCD at all.


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Mon Feb 08, 2010 9:31 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
Anton, Thanks, you're correct speed is relative. I was testing with a ripping program called CDEX and it appeared to extract a bit faster, probably approx. 20-30% faster on the same PC with the same drives. I'm not sure this is a big deal, I just wanted to make sure I was using the proper functions for the job I'm trying to accomplish and there wasn't a better approach.

I must have missunderstood regarding the error correction. I was referring to an old post were you stated the following with regard to a question about accuracy of ripping. Maybe this is no longer relevant.

Quote:
I do not know much about app called "EAC" (and too lazy to Google it and pretend I know but StarBurn uses own EDC/ECC software engine. Thus we turn off drive's hardware error correction and process all the data in software only. Results better grabbing results (faster and less errors). Also we have the code to amplify weak sectors.


All said it seems to be working very well, both grabbing and compression.


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Tue Feb 09, 2010 10:44 am 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Audio ripping software can use intermediate buffer (similar to what we do when burning) so they keep two threads, one ripping the data from the CD and storing it to the cycle buffer and other thread fetching the data from the buffer and storing it to the disk. We use one thread doing read and write sequentially so it could be *possibly* we're not that fast as special AudioCD ripping applications. Another point is still - setting maximum speed with StarBurn SDK before ripping :)


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Tue Feb 09, 2010 1:18 pm 
Offline

Joined: Tue Feb 02, 2010 3:11 pm
Posts: 7
Anton, Thanks for the explanation.

I'm attempting to set the read speed using StarBurn_CdvdBurnerGrabber_SetSpeeds and using a value of 65535 for the read speed. I think I pulled this from a sample project. I assume this is correct.

When creating the grabberobject using StarBurn_CdvdBurnerGrabber_CreateEx, I'm setting the CacheSize to 32MB. I'm not sure if this matters or not. I see it set to either 1MB or 32MB in the samples. Would this effect performance?


Top
 Profile  
 
 Post subject: Re: Audio Compress on-the-fly using starburn.dll
PostPosted: Tue Feb 09, 2010 1:20 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
It's for write only. We don't use cached reads.

ranger wrote:
Anton, Thanks for the explanation.

I'm attempting to set the read speed using StarBurn_CdvdBurnerGrabber_SetSpeeds and using a value of 65535 for the read speed. I think I pulled this from a sample project. I assume this is correct.

When creating the grabberobject using StarBurn_CdvdBurnerGrabber_CreateEx, I'm setting the CacheSize to 32MB. I'm not sure if this matters or not. I see it set to either 1MB or 32MB in the samples. Would this effect performance?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group