Click here to Skip to main content
12,078,070 members (47,299 online)
See more: C++
Please give me an example of using a callback the code is as following.

typedef struct ASIOCallbacks
    void (*bufferSwitch) (long doubleBufferIndex, ASIOBool directProcess);
        // bufferSwitch indicates that both input and output are to be processed.
        // the current buffer half index (0 for A, 1 for B) determines
        // - the output buffer that the host should start to fill. the other buffer
        //   will be passed to output hardware regardless of whether it got filled
        //   in time or not.
        // - the input buffer that is now filled with incoming data. Note that
        //   because of the synchronicity of i/o, the input always has at
        //   least one buffer latency in relation to the output.
        // directProcess suggests to the host whether it should immedeately
        // start processing (directProcess == ASIOTrue), or whether its process
        // should be deferred because the call comes from a very low level
        // (for instance, a high level priority interrupt), and direct processing
        // would cause timing instabilities for the rest of the system. If in doubt,
        // directProcess should be set to ASIOFalse.
        // Note: bufferSwitch may be called at interrupt time for highest efficiency.

    void (*sampleRateDidChange) (ASIOSampleRate sRate);
        // gets called when the AudioStreamIO detects a sample rate change
        // If sample rate is unknown, 0 is passed (for instance, clock loss
        // when externally synchronized).

    long (*asioMessage) (long selector, long value, void* message, double* opt);
        // generic callback for various purposes, see selectors below.
        // note this is only present if the asio version is 2 or higher
Closed because this post is not a question, or has not been phrased in a way that allows a reasonable answer to be provided. Reported by Chris Maunder, Sergey Alexandrovich Kryukov on Wednesday, February 27, 2013 4:58pm
Posted 27-Feb-13 8:23am
Edited 27-Feb-13 10:32am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.160212.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100