View Single Post
Old 02 December 2013, 06:05   #29
xArtx
Registered User
 
Join Date: Jun 2013
Location: Australia
Posts: 637
So C might not be your language, but the math would be familiar, if what you are talking about.
Filling the audio buffer at run time using 68000, and sending the buffer to Paula.
or computing the wave only once, and managing Agnus in a manner that repeatedly sends the buffer.

Code:
   double theta = viewController->theta;
    double theta_increment =
        2.0 * M_PI * viewController->frequency / viewController->sampleRate;
 
    // This is a mono tone generator so we only need the first buffer
    const int channel = 0;
    Float32 *buffer = (Float32 *)ioData->mBuffers[channel].mData;
     
    // Generate the samples
    for (UInt32 frame = 0; frame < inNumberFrames; frame++) 
    {
        buffer[frame] = sin(theta) * amplitude;
         
        theta += theta_increment;
        if (theta > 2.0 * M_PI)
        {
            theta -= 2.0 * M_PI;
        }
    }
xArtx is offline  
 
Page generated in 0.07372 seconds with 9 queries