59 | | The following compile time settings/macros have introduced to manage compatibility between old and new API and to assist migration of application and/or sound device implementation to the new API. |
60 | | |
61 | | '''Setting 1) {{{PJMEDIA_AUDIO_API = PJMEDIA_AUDIO_API_NEW_ONLY}}}''' :: |
62 | | This setting will completely deprecate the use of old API, and inclusion of {{{<pjmedia/sound.h>}}} in the code will raise compilation error. |
63 | | |
64 | | Use this setting if: |
65 | | - you are accessing sound devices which have been implemented using the '''new''' API |
66 | | - you have completely ported your application to use the new API |
67 | | |
68 | | '''Setting 2) {{{PJMEDIA_AUDIO_API = PJMEDIA_AUDIO_API_HAS_OLD_API}}}''' :: |
69 | | With this setting (this is the default setting), application can use the old sound device API to access audio devices provided by the new audio device API. |
70 | | |
71 | | Use this setting if: |
72 | | - you are accessing sound devices which have been ported to the new API |
73 | | - you want to access the sound device using '''both''' old or new API's. |
74 | | |
75 | | What this setting does: |
76 | | - it creates a sound device implementation based on the old API, but the implementation uses/accesses the new audio device API. |
77 | | |
78 | | '''Setting 3) {{{PJMEDIA_AUDIO_API = PJMEDIA_AUDIO_API_HAS_OLD_DEVICE}}}''' :: |
79 | | This setting enables old sound device implementation to be accessed via '''both''' old and new API's. |
80 | | |
81 | | Use this setting if: |
82 | | - you have your own sound device implementation, using the old API |
83 | | - you want to access the sound device using '''both''' old or new API's. |
84 | | |
85 | | What this setting does: |
86 | | - the new audio device API will create a wrapper for the old sound device implementation, effectively enabling the sound device implementation to be accessed via old or new API. |
| 62 | Two compile-time macros have been introduced to enable or disable the compatibility layers. The default values for the settings enable existing application to work unchanged, |
| 63 | |
| 64 | '''{{{PJMEDIA_HAS_LEGACY_SOUND_API}}}''' :: |
| 65 | |
| 66 | Location: pjmedia/config.h |
| 67 | Default: 1 |
| 68 | Purpose: to enable application to access the sound device using the old (sound.h) API. |
| 69 | Description: This macro controls whether the legacy sound device API is to be supported, for applications that still use the old sound device API (sound.h). If this macro is set to non-zero, the sound_legacy.c will be included in the compilation. The sound_legacy.c is an implementation of old sound device (sound.h) using the new Audio Device API. |
| 70 | |
| 71 | '''{{{PJMEDIA_AUDIO_DEV_HAS_LEGACY_DEVICE}}}''' |
| 72 | |
| 73 | Location: pjmedia-audiodev/config.h |
| 74 | Default: 0 |
| 75 | Purpose: to enable sound device implemented using the old API to be accessed using the new API. |
| 76 | Description: This setting controls whether the Audio Device API should support device implementation that is based on the old sound device API (sound.h). |
| 77 | |
150 | | 1. Change in {{{pjsua_enum_snd_devs()}}} signature. Old API: |
151 | | {{{ |
152 | | PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_snd_dev_info info[], unsigned *count); |
153 | | }}} |
154 | | New API (notice the type difference in the ''info'' argument): |
155 | | {{{ |
156 | | PJ_DECL(pj_status_t) pjsua_enum_snd_devs(pjmedia_aud_dev_info info[], unsigned *count); |
157 | | }}} |
158 | | |
159 | | 2. Add '''pjmedia-audiodev''' library to the link specifications of your application. |
160 | | 3. '''Latency''' setting. Old code may set latency directly accessing PJMEDIA API: |
| 141 | 1. Add '''pjmedia-audiodev''' library to the link specifications of your application. |
| 142 | 2. '''Latency''' setting. Old code may set latency directly accessing PJMEDIA API: |