diff options
| author | manuel <manuel@mausz.at> | 2017-07-23 16:59:43 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-07-23 16:59:43 +0200 |
| commit | 4c3251ec645c8b71820dab7e51e612e5919d4e75 (patch) | |
| tree | 9533268a93e58fc2e16de1b8ee3fafe3784e5225 /xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | |
| parent | f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (diff) | |
| download | kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.gz kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.bz2 kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h | 204 |
1 files changed, 0 insertions, 204 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h deleted file mode 100644 index d4ea283..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +++ /dev/null | |||
| @@ -1,204 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2005-2014 Team KODI | ||
| 4 | * http://kodi.tv | ||
| 5 | * | ||
| 6 | * This Program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | * any later version. | ||
| 10 | * | ||
| 11 | * This Program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with KODI; see the file COPYING. If not, see | ||
| 18 | * <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string> | ||
| 23 | #include <vector> | ||
| 24 | #include <string.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include "kodi_adsp_types.h" | ||
| 28 | #include "libXBMC_addon.h" | ||
| 29 | |||
| 30 | class CAddonSoundPlay | ||
| 31 | { | ||
| 32 | public: | ||
| 33 | CAddonSoundPlay(AddonCB* hdl, AddonInstance_AudioDSP* cb, const char* filename) | ||
| 34 | : m_Filename(filename), | ||
| 35 | m_Handle(hdl), | ||
| 36 | m_cb(cb) | ||
| 37 | { | ||
| 38 | m_PlayHandle = nullptr; | ||
| 39 | if (!hdl || !cb) | ||
| 40 | fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play is called with NULL handle !!!\n"); | ||
| 41 | else | ||
| 42 | { | ||
| 43 | m_PlayHandle = m_cb->toKodi.SoundPlay_GetHandle(m_cb->toKodi.kodiInstance, m_Filename.c_str()); | ||
| 44 | if (!m_PlayHandle) | ||
| 45 | fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play can't get callback table from KODI !!!\n"); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | ~CAddonSoundPlay() | ||
| 50 | { | ||
| 51 | if (m_PlayHandle) | ||
| 52 | m_cb->toKodi.SoundPlay_ReleaseHandle(m_cb->toKodi.kodiInstance, m_PlayHandle); | ||
| 53 | } | ||
| 54 | |||
| 55 | /*! play the sound this object represents */ | ||
| 56 | void Play() | ||
| 57 | { | ||
| 58 | if (m_PlayHandle) | ||
| 59 | m_cb->toKodi.SoundPlay_Play(m_cb->toKodi.kodiInstance, m_PlayHandle); | ||
| 60 | } | ||
| 61 | |||
| 62 | |||
| 63 | /*! stop playing the sound this object represents */ | ||
| 64 | void Stop() | ||
| 65 | { | ||
| 66 | if (m_PlayHandle) | ||
| 67 | m_cb->toKodi.SoundPlay_Stop(m_cb->toKodi.kodiInstance, m_PlayHandle); | ||
| 68 | } | ||
| 69 | |||
| 70 | /*! return true if the sound is currently playing */ | ||
| 71 | bool IsPlaying() | ||
| 72 | { | ||
| 73 | if (!m_PlayHandle) | ||
| 74 | return false; | ||
| 75 | |||
| 76 | return m_cb->toKodi.SoundPlay_IsPlaying(m_cb->toKodi.kodiInstance, m_PlayHandle); | ||
| 77 | } | ||
| 78 | |||
| 79 | /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */ | ||
| 80 | void SetChannel(AE_DSP_CHANNEL channel) | ||
| 81 | { | ||
| 82 | if (m_PlayHandle) | ||
| 83 | m_cb->toKodi.SoundPlay_SetChannel(m_cb->toKodi.kodiInstance, m_PlayHandle, channel); | ||
| 84 | } | ||
| 85 | |||
| 86 | /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */ | ||
| 87 | AE_DSP_CHANNEL GetChannel() | ||
| 88 | { | ||
| 89 | if (!m_PlayHandle) | ||
| 90 | return AE_DSP_CH_INVALID; | ||
| 91 | return m_cb->toKodi.SoundPlay_GetChannel(m_cb->toKodi.kodiInstance, m_PlayHandle); | ||
| 92 | } | ||
| 93 | |||
| 94 | /*! set the playback volume of this sound */ | ||
| 95 | void SetVolume(float volume) | ||
| 96 | { | ||
| 97 | if (m_PlayHandle) | ||
| 98 | m_cb->toKodi.SoundPlay_SetVolume(m_cb->toKodi.kodiInstance, m_PlayHandle, volume); | ||
| 99 | } | ||
| 100 | |||
| 101 | /*! get the current playback volume of this sound */ | ||
| 102 | float GetVolume() | ||
| 103 | { | ||
| 104 | if (!m_PlayHandle) | ||
| 105 | return 0.0f; | ||
| 106 | |||
| 107 | return m_cb->toKodi.SoundPlay_GetVolume(m_cb->toKodi.kodiInstance, m_PlayHandle); | ||
| 108 | } | ||
| 109 | |||
| 110 | private: | ||
| 111 | std::string m_Filename; | ||
| 112 | AddonCB* m_Handle; | ||
| 113 | AddonInstance_AudioDSP *m_cb; | ||
| 114 | ADSPHANDLE m_PlayHandle; | ||
| 115 | }; | ||
| 116 | |||
| 117 | class CHelper_libKODI_adsp | ||
| 118 | { | ||
| 119 | public: | ||
| 120 | CHelper_libKODI_adsp(void) | ||
| 121 | { | ||
| 122 | m_Handle = nullptr; | ||
| 123 | m_Callbacks = nullptr; | ||
| 124 | } | ||
| 125 | |||
| 126 | ~CHelper_libKODI_adsp(void) | ||
| 127 | { | ||
| 128 | } | ||
| 129 | |||
| 130 | /*! | ||
| 131 | * @brief Resolve all callback methods | ||
| 132 | * @param handle Pointer to the add-on | ||
| 133 | * @return True when all methods were resolved, false otherwise. | ||
| 134 | */ | ||
| 135 | bool RegisterMe(void* handle) | ||
| 136 | { | ||
| 137 | m_Handle = static_cast<AddonCB*>(handle); | ||
| 138 | if (m_Handle) | ||
| 139 | m_Callbacks = (AddonInstance_AudioDSP*)m_Handle->ADSPLib_RegisterMe(m_Handle->addonData); | ||
| 140 | if (!m_Callbacks) | ||
| 141 | fprintf(stderr, "libKODI_adsp-ERROR: ADSLib_RegisterMe can't get callback table from Kodi !!!\n"); | ||
| 142 | |||
| 143 | return m_Callbacks != nullptr; | ||
| 144 | } | ||
| 145 | |||
| 146 | /*! | ||
| 147 | * @brief Add or replace a menu hook for the context menu for this add-on | ||
| 148 | * @param hook The hook to add | ||
| 149 | */ | ||
| 150 | void AddMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 151 | { | ||
| 152 | return m_Callbacks->toKodi.AddMenuHook(m_Callbacks->toKodi.kodiInstance, hook); | ||
| 153 | } | ||
| 154 | |||
| 155 | /*! | ||
| 156 | * @brief Remove a menu hook for the context menu for this add-on | ||
| 157 | * @param hook The hook to remove | ||
| 158 | */ | ||
| 159 | void RemoveMenuHook(AE_DSP_MENUHOOK* hook) | ||
| 160 | { | ||
| 161 | return m_Callbacks->toKodi.RemoveMenuHook(m_Callbacks->toKodi.kodiInstance, hook); | ||
| 162 | } | ||
| 163 | |||
| 164 | /*! | ||
| 165 | * @brief Add or replace master mode information inside audio dsp database. | ||
| 166 | * Becomes identifier written inside mode to iModeID if it was 0 (undefined) | ||
| 167 | * @param mode The master mode to add or update inside database | ||
| 168 | */ | ||
| 169 | void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 170 | { | ||
| 171 | return m_Callbacks->toKodi.RegisterMode(m_Callbacks->toKodi.kodiInstance, mode); | ||
| 172 | } | ||
| 173 | |||
| 174 | /*! | ||
| 175 | * @brief Remove a master mode from audio dsp database | ||
| 176 | * @param mode The Mode to remove | ||
| 177 | */ | ||
| 178 | void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode) | ||
| 179 | { | ||
| 180 | return m_Callbacks->toKodi.UnregisterMode(m_Callbacks->toKodi.kodiInstance, mode); | ||
| 181 | } | ||
| 182 | |||
| 183 | /*! | ||
| 184 | * @brief Open a sound playing class | ||
| 185 | * @param filename The wav filename to open | ||
| 186 | */ | ||
| 187 | CAddonSoundPlay* GetSoundPlay(const char *filename) | ||
| 188 | { | ||
| 189 | return new CAddonSoundPlay(m_Handle, m_Callbacks, filename); | ||
| 190 | } | ||
| 191 | |||
| 192 | /*! | ||
| 193 | * @brief Remove a played file class | ||
| 194 | * @param p The playback to remove | ||
| 195 | */ | ||
| 196 | void ReleaseSoundPlay(CAddonSoundPlay* p) | ||
| 197 | { | ||
| 198 | delete p; | ||
| 199 | } | ||
| 200 | |||
| 201 | private: | ||
| 202 | AddonCB* m_Handle; | ||
| 203 | AddonInstance_AudioDSP *m_Callbacks; | ||
| 204 | }; | ||
