annotate 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
rev   line source
rlm@0 1 #+title: all the steps to add a device to open-al
rlm@0 2 #+author: Robert McIntyre
rlm@0 3 #+email: rlm@mit.edu
rlm@0 4 #+description: how to add a new device to open-al
rlm@0 5 #+SETUPFILE: ../../aurellem/org/setup.org
rlm@0 6 #+INCLUDE: ../../aurellem/org/level-0.org
rlm@0 7
rlm@0 8
rlm@0 9 * How to add a new backend device
rlm@0 10
rlm@0 11 * In Alc/backends/<your-device>.c
rlm@0 12
rlm@0 13 #+begin_src C
rlm@0 14 static const ALCchar <your-device>_device[] = <your-device-name>;
rlm@0 15
rlm@0 16 ALCboolean alc_<your-device>_init(BackendFuncs *func_list)
rlm@0 17 void alc_<your-device>_deinit(void)
rlm@0 18
rlm@0 19 static ALCboolean <your-device>_open_playback(ALCdevice *device, const ALCchar *deviceName)
rlm@0 20 static void <your-device>_close_playback(ALCdevice *device)
rlm@0 21 static ALCboolean <your-device>_reset_playback(ALCdevice *device)
rlm@0 22 static void <your-device>_stop_playback(ALCdevice *device)
rlm@0 23 #+end_src
rlm@0 24
rlm@0 25 #+begin_src C
rlm@0 26 void alc_<your-device>_probe(enum DevProbe type)
rlm@0 27 {
rlm@0 28 switch(type)
rlm@0 29 {
rlm@0 30 case DEVICE_PROBE:
rlm@0 31 AppendDeviceList(<your-device>Device);
rlm@0 32 break;
rlm@0 33 case ALL_DEVICE_PROBE:
rlm@0 34 AppendAllDeviceList(<your-device>Device);
rlm@0 35 break;
rlm@0 36 case CAPTURE_DEVICE_PROBE:
rlm@0 37 break;
rlm@0 38 }
rlm@0 39 }
rlm@0 40 #+end_src
rlm@0 41
rlm@0 42 #+begin_src C
rlm@0 43 static const BackendFuncs <your-device>_funcs = {
rlm@0 44 <your-device>_open_playback,
rlm@0 45 <your-device>_close_playback,
rlm@0 46 <your-device>_reset_playback,
rlm@0 47 <your-device>_stop_playback,
rlm@0 48 NULL,
rlm@0 49 NULL,
rlm@0 50 NULL,
rlm@0 51 NULL,
rlm@0 52 NULL,
rlm@0 53 NULL
rlm@0 54 };
rlm@0 55 #+end_src
rlm@0 56
rlm@0 57
rlm@0 58 * In OpenAL32/Include/alMain.h :
rlm@0 59
rlm@0 60 #+begin_src C
rlm@0 61 ALCboolean alc_<your-device>_init(BackendFuncs *func_list);
rlm@0 62 void alc_<your-device>_deinit(void);
rlm@0 63 void alc_<your-device>_probe(enum DevProbe type);
rlm@0 64
rlm@0 65 #+end_src
rlm@0 66
rlm@0 67 * In Alc/ALc.c :
rlm@0 68 #+begin_src C
rlm@0 69 { "<your-device>", alc_<your-device>_init,
rlm@0 70 alc_<your-device>_deinit, alc_<your-device>_probe, EmptyFuncs },
rlm@0 71
rlm@0 72 #+end_src
rlm@0 73
rlm@0 74 * In CMakeLists.txt
rlm@0 75 #+begin_src cmake
rlm@0 76 SET(ALC_OBJS Alc/ALc.c
rlm@0 77 Alc/ALu.c
rlm@0 78 Alc/alcConfig.c
rlm@0 79 Alc/alcDedicated.c
rlm@0 80 Alc/alcEcho.c
rlm@0 81 Alc/alcModulator.c
rlm@0 82 Alc/alcReverb.c
rlm@0 83 Alc/alcRing.c
rlm@0 84 Alc/alcThread.c
rlm@0 85 Alc/bs2b.c
rlm@0 86 Alc/helpers.c
rlm@0 87 Alc/hrtf.c
rlm@0 88 Alc/mixer.c
rlm@0 89 Alc/panning.c
rlm@0 90 # Default backends, always available
rlm@0 91 Alc/backends/loopback.c
rlm@0 92 Alc/backends/null.c
rlm@0 93 # : add <your-device> device
rlm@0 94 Alc/backends/<your-device>.c
rlm@0 95 )
rlm@0 96 #+end_src
rlm@0 97
rlm@0 98
rlm@0 99 * In ~/.alsoftrc
rlm@0 100
rlm@0 101 #+begin_src conf
rlm@0 102 drivers = <your-device>
rlm@0 103 #+end_src