diff org/add-new-device.org @ 0:f9476ff7637e

initial forking of open-al to create multiple listeners
author Robert McIntyre <rlm@mit.edu>
date Tue, 25 Oct 2011 13:02:31 -0700
parents
children 3caceef436ea
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/org/add-new-device.org	Tue Oct 25 13:02:31 2011 -0700
     1.3 @@ -0,0 +1,103 @@
     1.4 +#+title: all the steps to add a device to open-al
     1.5 +#+author: Robert McIntyre
     1.6 +#+email: rlm@mit.edu
     1.7 +#+description: how to add a new device to open-al
     1.8 +#+SETUPFILE: ../../aurellem/org/setup.org
     1.9 +#+INCLUDE: ../../aurellem/org/level-0.org
    1.10 +
    1.11 +
    1.12 +* How to add a new backend device
    1.13 +
    1.14 +* In Alc/backends/<your-device>.c 
    1.15 +   
    1.16 +#+begin_src C
    1.17 +static const ALCchar <your-device>_device[] = <your-device-name>;
    1.18 +
    1.19 +ALCboolean alc_<your-device>_init(BackendFuncs *func_list)
    1.20 +void alc_<your-device>_deinit(void)
    1.21 +
    1.22 +static ALCboolean <your-device>_open_playback(ALCdevice *device, const ALCchar *deviceName)
    1.23 +static void <your-device>_close_playback(ALCdevice *device)
    1.24 +static ALCboolean <your-device>_reset_playback(ALCdevice *device)
    1.25 +static void <your-device>_stop_playback(ALCdevice *device)
    1.26 +#+end_src
    1.27 +
    1.28 +#+begin_src C
    1.29 +void alc_<your-device>_probe(enum DevProbe type)
    1.30 +{
    1.31 +    switch(type)
    1.32 +    {
    1.33 +        case DEVICE_PROBE:
    1.34 +            AppendDeviceList(<your-device>Device);
    1.35 +            break;
    1.36 +        case ALL_DEVICE_PROBE:
    1.37 +            AppendAllDeviceList(<your-device>Device);
    1.38 +            break;
    1.39 +        case CAPTURE_DEVICE_PROBE:
    1.40 +            break;
    1.41 +    }
    1.42 +}
    1.43 +#+end_src
    1.44 +
    1.45 +#+begin_src C
    1.46 +static const BackendFuncs <your-device>_funcs = {
    1.47 +    <your-device>_open_playback,
    1.48 +    <your-device>_close_playback,
    1.49 +    <your-device>_reset_playback,
    1.50 +    <your-device>_stop_playback,
    1.51 +    NULL,
    1.52 +    NULL,
    1.53 +    NULL,
    1.54 +    NULL,
    1.55 +    NULL,
    1.56 +    NULL
    1.57 +};
    1.58 +#+end_src
    1.59 +
    1.60 +
    1.61 +* In OpenAL32/Include/alMain.h :
    1.62 +
    1.63 +#+begin_src C
    1.64 +ALCboolean alc_<your-device>_init(BackendFuncs *func_list);
    1.65 +void alc_<your-device>_deinit(void);
    1.66 +void alc_<your-device>_probe(enum DevProbe type);
    1.67 +
    1.68 +#+end_src
    1.69 +  
    1.70 +* In Alc/ALc.c :
    1.71 + #+begin_src C
    1.72 +     { "<your-device>", alc_<your-device>_init, 
    1.73 +	 alc_<your-device>_deinit, alc_<your-device>_probe, EmptyFuncs },
    1.74 +
    1.75 + #+end_src
    1.76 +
    1.77 +* In CMakeLists.txt
    1.78 +#+begin_src cmake
    1.79 +SET(ALC_OBJS  Alc/ALc.c
    1.80 +              Alc/ALu.c
    1.81 +              Alc/alcConfig.c
    1.82 +              Alc/alcDedicated.c
    1.83 +              Alc/alcEcho.c
    1.84 +              Alc/alcModulator.c
    1.85 +              Alc/alcReverb.c
    1.86 +              Alc/alcRing.c
    1.87 +              Alc/alcThread.c
    1.88 +              Alc/bs2b.c
    1.89 +              Alc/helpers.c
    1.90 +              Alc/hrtf.c
    1.91 +              Alc/mixer.c
    1.92 +              Alc/panning.c
    1.93 +              # Default backends, always available
    1.94 +              Alc/backends/loopback.c
    1.95 +              Alc/backends/null.c
    1.96 +	      # : add <your-device> device
    1.97 +	      Alc/backends/<your-device>.c
    1.98 +)
    1.99 +#+end_src
   1.100 +
   1.101 +
   1.102 +* In ~/.alsoftrc
   1.103 +
   1.104 +#+begin_src conf
   1.105 +drivers = <your-device>
   1.106 +#+end_src