Пример #1
0
ALvoid  alBufferDataStaticProc(const ALint bid, ALenum format, ALvoid* data, ALsizei size, ALsizei freq)
{
#if TARGET_OS_MACOSX == 1
	static	alBufferDataStaticProcPtr	proc = NULL;
    
    if (proc == NULL) {
        proc = (alBufferDataStaticProcPtr) alcGetProcAddress(NULL, (const ALCchar*) "alBufferDataStatic");
    }
    
    if (proc)
        proc(bid, format, data, size, freq);
	
#elif (TARGET_OS_IPHONE == 1) || (TARGET_IPHONE_SIMULATOR == 1)
	static	alBufferDataStaticProcPtr	proc = NULL;
    
    if (proc == NULL) {
        proc = (alBufferDataStaticProcPtr) alcGetProcAddress(NULL, (const ALCchar*) "alBufferDataStatic");
    }
    
    if (proc)
        proc(bid, format, data, size, freq);
#endif
	
    return;
}
Пример #2
0
/* initialize the plugin's class */
static void
gst_openal_sink_class_init (GstOpenALSinkClass * klass)
{
    GObjectClass *gobject_class = (GObjectClass *) klass;
    GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
    GstAudioSinkClass *gstaudiosink_class = (GstAudioSinkClass *) klass;
    GParamSpec *spec;

    if (alcIsExtensionPresent (NULL, "ALC_EXT_thread_local_context")) {
        palcSetThreadContext = alcGetProcAddress (NULL, "alcSetThreadContext");
        palcGetThreadContext = alcGetProcAddress (NULL, "alcGetThreadContext");
    }

    GST_DEBUG_CATEGORY_INIT (openalsink_debug, "openalsink", 0, "OpenAL sink");

    gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_openal_sink_dispose);
    gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_openal_sink_finalize);
    gobject_class->set_property =
        GST_DEBUG_FUNCPTR (gst_openal_sink_set_property);
    gobject_class->get_property =
        GST_DEBUG_FUNCPTR (gst_openal_sink_get_property);

    spec = g_param_spec_string ("device-name", "Device name",
                                "Opened OpenAL device name", "", G_PARAM_READABLE);
    g_object_class_install_property (gobject_class, PROP_DEVICE_NAME, spec);

    spec = g_param_spec_string ("device", "Device", "OpenAL device string",
                                DEFAULT_DEVICE, G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class, PROP_DEVICE, spec);

    spec = g_param_spec_pointer ("device-handle", "ALCdevice",
                                 "Custom playback device", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
    g_object_class_install_property (gobject_class, PROP_DEVICE_HDL, spec);

    spec = g_param_spec_pointer ("context-handle", "ALCcontext",
                                 "Custom playback context", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
    g_object_class_install_property (gobject_class, PROP_CONTEXT_HDL, spec);

    spec = g_param_spec_uint ("source-id", "Source ID", "Custom playback sID",
                              0, UINT_MAX, 0, G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class, PROP_SOURCE_ID, spec);

    parent_class = g_type_class_peek_parent (klass);

    gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_openal_sink_getcaps);

    gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_openal_sink_open);
    gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_openal_sink_close);
    gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_openal_sink_prepare);
    gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_openal_sink_unprepare);
    gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_openal_sink_write);
    gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_openal_sink_delay);
    gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_openal_sink_reset);
}
Пример #3
0
static void printHRTFInfo(ALCdevice *device)
{
    LPALCGETSTRINGISOFT alcGetStringiSOFT;
    ALCint num_hrtfs;

    if(alcIsExtensionPresent(device, "ALC_SOFT_HRTF") == ALC_FALSE)
    {
        printf("HRTF extension not available\n");
        return;
    }

    alcGetStringiSOFT = alcGetProcAddress(device, "alcGetStringiSOFT");

    alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &num_hrtfs);
    if(!num_hrtfs)
        printf("No HRTFs found\n");
    else
    {
        ALCint i;
        printf("Available HRTFs:\n");
        for(i = 0;i < num_hrtfs;++i)
        {
            const ALCchar *name = alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i);
            printf("    %s\n", name);
        }
    }
    checkALCErrors(device);
}
Пример #4
0
static
void* get_proc(const char *namez) {
	void* proc = (void*)alGetProcAddress(namez);

	if (!proc)
		proc = (void*)alcGetProcAddress(device, namez);

    return proc;
}
Пример #5
0
ALvoid alBufferDataStaticProc(const ALint bid, ALenum format, ALvoid *data, ALsizei size, ALsizei freq)
{
	static alBufferDataStaticProcPtr proc = NULL;

	if (proc == NULL)
		proc = (alBufferDataStaticProcPtr)alcGetProcAddress(NULL, (const ALCchar *)"alBufferDataStatic");

	if (proc != NULL)
		proc(bid, format, data, size, freq);
}
Пример #6
0
ALvoid alcMacOSXMixerOutputRateProc(const ALdouble value)
{
	static alcMacOSXMixerOutputRateProcPtr proc = NULL;

	if (proc == NULL)
		proc = (alcMacOSXMixerOutputRateProcPtr)alcGetProcAddress(NULL, (const ALCchar *)"alcMacOSXMixerOutputRate");

	if (proc != NULL)
		proc(value);
}
Пример #7
0
ALCvoid* CDECL wine_alcGetProcAddress(ALCdevice *device, const ALCchar *funcname)
{
    void *proc;
    int i;

    /* Make sure the host implementation has the requested function */
    proc = alcGetProcAddress(device, funcname);
    if(!proc)
        return NULL;

    for(i = 0;ALCFuncs[i].name;i++)
    {
        if(strcmp(funcname, ALCFuncs[i].name) == 0)
            return ALCFuncs[i].proc;
    }
    FIXME("Could not find function in list: %s\n", funcname);
    return NULL;
}
Пример #8
0
FSoundManager::FSoundManager( UI32 iMaxSoundHash, I32 iDelState  ) : iMaxHash( iMaxSoundHash ), iMaxSources( 0 ), lpSources( NULL ), lpSoundHash( NULL ), lpDevice( NULL ), lpContext( NULL ), iDelState( iDelState )
{
    const ALCchar * lpDevices = alcGetString( NULL, ALC_DEVICE_SPECIFIER );
    NSLog( @"Dev: %s", lpDevices );
    
    lpDevice = alcOpenDevice( lpDevices );
    if( lpDevice )
    {
        lpContext = alcCreateContext( lpDevice, NULL );
        alcMakeContextCurrent( lpContext );
    }
    
    const ALCchar * lpName = "alBufferDataStatic";
    alBufferDataStatic = (alBufferDataStaticProcPtr)alcGetProcAddress( lpDevice, lpName );
    
    lpSoundHash = (Node **)malloc( sizeof( Node * )*iMaxHash );
    for( I32 i = 0;i < iMaxHash;i++ )
        lpSoundHash[i] = NULL;
    
    CreateSources();
}
Пример #9
0
static void
gst_openal_sink_class_init (GstOpenALSinkClass * klass)
{
  GObjectClass *gobject_class = (GObjectClass *) klass;
  GstElementClass *gstelement_class = (GstElementClass *) klass;
  GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
  GstAudioSinkClass *gstaudiosink_class = (GstAudioSinkClass *) klass;

  if (alcIsExtensionPresent (NULL, "ALC_EXT_thread_local_context")) {
    palcSetThreadContext = alcGetProcAddress (NULL, "alcSetThreadContext");
    palcGetThreadContext = alcGetProcAddress (NULL, "alcGetThreadContext");
  }

  gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_openal_sink_dispose);
  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_openal_sink_finalize);
  gobject_class->set_property =
      GST_DEBUG_FUNCPTR (gst_openal_sink_set_property);
  gobject_class->get_property =
      GST_DEBUG_FUNCPTR (gst_openal_sink_get_property);

  gst_openal_sink_parent_class = g_type_class_peek_parent (klass);

  gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_openal_sink_getcaps);

  gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_openal_sink_open);
  gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_openal_sink_close);
  gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_openal_sink_prepare);
  gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_openal_sink_unprepare);
  gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_openal_sink_write);
  gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_openal_sink_delay);
  gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_openal_sink_reset);

  g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
      g_param_spec_string ("device-name", "Device name",
          "Human-readable name of the opened device", "", G_PARAM_READABLE));

  g_object_class_install_property (gobject_class, PROP_DEVICE,
      g_param_spec_string ("device", "Device",
          "Human-readable name of the device", OPENAL_DEFAULT_DEVICE,
          G_PARAM_READWRITE));

  g_object_class_install_property (gobject_class, PROP_USER_DEVICE,
      g_param_spec_pointer ("user-device", "ALCdevice", "User device",
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_USER_CONTEXT,
      g_param_spec_pointer ("user-context", "ALCcontext", "User context",
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property (gobject_class, PROP_USER_SOURCE,
      g_param_spec_uint ("user-source", "ALsource", "User source", 0, UINT_MAX,
          0, G_PARAM_READWRITE));

  gst_element_class_set_static_metadata (gstelement_class, "OpenAL Audio Sink",
      "Sink/Audio", "Output audio through OpenAL",
      "Juan Manuel Borges Caño <*****@*****.**>");

  gst_element_class_add_pad_template (gstelement_class,
      gst_static_pad_template_get (&openalsink_factory));

}
Пример #10
0
static inline void LoadALCProc(ALCdevice *dev, const char *name, T **ptr)
{
    *ptr = reinterpret_cast<T*>(alcGetProcAddress(dev, name));
}
Пример #11
0
AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName)
{
    if(!funcName)
        return NULL;
    return alcGetProcAddress(NULL, funcName);
}
Пример #12
0
static inline void GetDeviceProc(T **func, ALCdevice *device, const char *name)
{ *func = reinterpret_cast<T*>(alcGetProcAddress(device, name)); }
Пример #13
0
static inline void LoadALCFunc(ALCdevice *device, T **func, const char *name)
{ *func = reinterpret_cast<T*>(alcGetProcAddress(device, name)); }