Changing Audio Length in Effect Plugin

Discussions for GoldWave plug-in development
Post Reply
suchit
Posts: 4
Joined: Sun Oct 28, 2007 3:15 am
Contact:

Changing Audio Length in Effect Plugin

Post by suchit »

Hi!

A long time GoldWave customer, I have recently begun developing my plugin for GoldWave.

All I want to do is open audio file and add append additional sound to it.

I am using flag aChangesLength and have implemented Scan(), and Read() functions. How do I change length of audio now?

I don't see any direct way by which I can continue reading audio and keep modifying it. Any help? Am I missing something here?

Regards,
Suchit

http://www.Suchit-Tiwari.Org
http://www.codeproject.com/script/Artic ... rid=299328
GoldWave Inc.
Site Admin
Posts: 4372
Joined: Wed Mar 10, 2004 6:43 pm
Location: St. John's, NL
Contact:

Re: Changing Audio Length in Effect Plugin

Post by GoldWave Inc. »

When you call the source Read() function in your own Read() function, you'll eventually get zero samples returned (or less than the requested amount). At that point, you'd start filling the destination buffer with the audio you want to append. In the simplest case, you'd have something like:

Code: Select all

if ( source->Read( dest, samples ) == 0 ) // End of original source?
{
    memcpy( dest, new_audio, samples * sizeof(audio) * channels )
    return samples;  // Return number of samples appended during this call
}
In the world real case, you'd need to start appending audio when Read() returns less than the requested number of samples and return zero when there are no more samples to append. Be careful not to cause any buffer overruns when transitioning from the source audio to the new appended audio.

You do not need a Scan() function just to append samples.

Chris
suchit
Posts: 4
Joined: Sun Oct 28, 2007 3:15 am
Contact:

Post by suchit »

Hi Chris,

Thank you for this one. It worked.
I am posting another question regarding a callback procedure for my UI page - where GoldWave crashes. Please look at that too.

Regards,
Suchit
Post Reply