[futurebasic] Re: [FB] Anyone done any Core Audio work in FB

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2005 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Mon, 21 Nov 2005 10:18:13 -0500
Bill Sanford asked:

>So, I need to somehow figure out how to move into core audio...
>
>All I need is very basic playback and recording to and from disk, but this
>looks to be quite a task using Core Audio...


In a recent thread Robert Purves wrote concerning 
FB glue code for framework functions:

>...Load the framework, get the function pointer,
>call it via glue, comment out your definition of
>OSADoScriptFile, sigh...


I first sighed, then wrote the following.

How far off am I?

Ken


/*
  *  QTGetComponentPropertyInfo()
  *
  *  Availability:
  *    Mac OS X:         in version 10.3 (or QuickTime 6.4) and later in
QuickTime.framework
  *    CarbonLib:        not available
  *    Non-Carbon CFM:   not available
  */

/*
  *  QTGetComponentProperty()
  *
  *  Availability:
  *    Mac OS X:         in version 10.3 (or QuickTime 6.4) and later in
QuickTime.framework
  *    CarbonLib:        not available
  *    Non-Carbon CFM:   not available
  */


begin globals
dim as CFBundleRef gQuickTimeBundle
dim as pointer     gQTGetComponentPropertyInfo
dim as pointer     gQTGetComponentProperty
end globals

gQuickTimeBundle = fn CreateBundleForFramework( "QuickTime.framework" )

/*
ComponentResult QTGetComponentPropertyInfo (
    ComponentInstance         inComponent,
    ComponentPropertyClass    inPropClass,
    ComponentPropertyID       inPropID,
    ComponentValueType        *outPropType,
    ByteCount                 *outPropValueSize,
    UInt32                    *outPropertyFlags );
*/

gQTGetComponentPropertyInfo =¬
fn GetMachFunctionFromBundle( gQuickTimeBundle,¬
                    "QTGetComponentPropertyInfo" )

// quick-and-dirty glue to call QTGetComponentPropertyInfo
local fn QTGetComponentPropertyInfo( a&, b&, c&, d&, e&, f& )
beginassem
    lwz    r12,^gQTGetComponentPropertyInfo
    mtspr  ctr,r12
    mr     r31,r2
    bctrl
    mr     r2,r31
endassem
end fn // ComponentResult


/*
QTGetComponentProperty

Returns the value of a specific component property.

ComponentResult QTGetComponentProperty (
    ComponentInstance         inComponent,
    ComponentPropertyClass    inPropClass,
    ComponentPropertyID       inPropID,
    ByteCount                 inPropValueSize,
    ComponentValuePtr         outPropValueAddress,
    ByteCount                 *outPropValueSizeUsed );
*/

gQTGetComponentProperty =¬
fn GetMachFunctionFromBundle( gQuickTimeBundle,¬
                        "QTGetComponentProperty" )

local fn QTGetComponentProperty( a&, b&, c&, d&, e&, f& )
beginassem
    lwz    r12,^gQTGetComponentProperty
    mtspr  ctr,r12
    mr     r31,r2
    bctrl
    mr     r2,r31
endassem
end fn // ComponentResult