[ create a new paste ] login | about

Link: http://codepad.org/rArgvPZC    [ raw code | fork ]

C, pasted on Apr 24:
typedef interface IASIO IASIO;
interface IASIO : public IUnknown
{
    virtual ASIOBool init(void *sysHandle)     = 0;
    virtual void getDriverName(char *name)     = 0;
    virtual long getDriverVersion()            = 0;
    virtual void getErrorMessage(char *string) = 0;
    virtual ASIOError start() = 0;
    virtual ASIOError stop()  = 0;
    virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0;
    virtual ASIOError getLatencies(long *inputLatency, long *outputLatency)        = 0;
    virtual ASIOError getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity) = 0;
    virtual ASIOError canSampleRate(ASIOSampleRate sampleRate)   = 0;
    virtual ASIOError getSampleRate(ASIOSampleRate * sampleRate) = 0;
    virtual ASIOError setSampleRate(ASIOSampleRate sampleRate)   = 0;
    virtual ASIOError getClockSources(ASIOClockSource * clocks, long *numSources) = 0;
    virtual ASIOError setClockSource(long reference) = 0;
    virtual ASIOError getSamplePosition(ASIOSamples * sPos, ASIOTimeStamp * tStamp) = 0;
    virtual ASIOError getChannelInfo(ASIOChannelInfo * info) = 0;
    virtual ASIOError createBuffers(ASIOBufferInfo * bufferInfos, long numChannels, long bufferSize, ASIOCallbacks * callbacks) = 0;
    virtual ASIOError disposeBuffers() = 0;
    virtual ASIOError controlPanel()   = 0;
    virtual ASIOError future(long selector, void *opt) = 0;
    virtual ASIOError outputReady() = 0;
};

class Resolver
{
    IASIO* that_;
    
    bool Resolver::init(void *sysHandle)  /* syshandle is null */
    {
        bool result;
        int funcOffset = 12;
        void *this_ = that_;                
        
        __asm {                            
            mov     eax, sysHandle        ;
            push    eax                   ;
            mov     ecx, this_            ;
            mov     eax, [ecx]            ;
            call    [eax+funcOffset]      ;
            mov     result, eax       ;
        }    
        
        return result;
    }    
}


Create a new paste based on this one


Comments: