Click here to Skip to main content
See more: C++
Hello,
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 Sergey Alexandrovich Kryukov, Chris Maunder on Wednesday, February 27, 2013 3:58pm.
Posted 27-Feb-13 7:23am
Edited 27-Feb-13 9:32am
v2

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

  Print Answers RSS
0 Maciej Los 200
1 Kornfeld Eliyahu Peter 175
2 BillWoodruff 160
3 George Jonsson 140
4 OriginalGriff 126


Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
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