|
| 1 | +/** |
| 2 | +* ============================================================================= |
| 3 | +* Source Python |
| 4 | +* Copyright (C) 2012-2015 Source Python Development Team. All rights reserved. |
| 5 | +* ============================================================================= |
| 6 | +* |
| 7 | +* This program is free software; you can redistribute it and/or modify it under |
| 8 | +* the terms of the GNU General Public License, version 3.0, as published by the |
| 9 | +* Free Software Foundation. |
| 10 | +* |
| 11 | +* This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 13 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 14 | +* details. |
| 15 | +* |
| 16 | +* You should have received a copy of the GNU General Public License along with |
| 17 | +* this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | +* |
| 19 | +* As a special exception, the Source Python Team gives you permission |
| 20 | +* to link the code of this program (as well as its derivative works) to |
| 21 | +* "Half-Life 2," the "Source Engine," and any Game MODs that run on software |
| 22 | +* by the Valve Corporation. You must obey the GNU General Public License in |
| 23 | +* all respects for all other code used. Additionally, the Source.Python |
| 24 | +* Development Team grants this exception to all derivative works. |
| 25 | +*/ |
| 26 | + |
| 27 | +//--------------------------------------------------------------------------------- |
| 28 | +// Includes. |
| 29 | +//--------------------------------------------------------------------------------- |
| 30 | +// Source.Python |
| 31 | +#include "export_main.h" |
| 32 | +#include "utilities/conversions.h" |
| 33 | +#include "engines.h" |
| 34 | +#include ENGINE_INCLUDE_PATH(engines_wrap.h) |
| 35 | + |
| 36 | +// SDK |
| 37 | +#include "toolframework/ienginetool.h" |
| 38 | +#include "engine/IEngineTrace.h" |
| 39 | + |
| 40 | +//--------------------------------------------------------------------------------- |
| 41 | +// External variables |
| 42 | +//--------------------------------------------------------------------------------- |
| 43 | +extern IEngineTool* enginetool; |
| 44 | + |
| 45 | +//--------------------------------------------------------------------------------- |
| 46 | +// Forward declarations. |
| 47 | +//--------------------------------------------------------------------------------- |
| 48 | +void export_engine_tool(scope); |
| 49 | + |
| 50 | +//--------------------------------------------------------------------------------- |
| 51 | +// Declare the _tool module |
| 52 | +//--------------------------------------------------------------------------------- |
| 53 | +DECLARE_SP_SUBMODULE(_engines, _tool) |
| 54 | +{ |
| 55 | + export_engine_tool(_tool); |
| 56 | +} |
| 57 | + |
| 58 | +//--------------------------------------------------------------------------------- |
| 59 | +// Exports IEngineTool |
| 60 | +//--------------------------------------------------------------------------------- |
| 61 | +void export_engine_tool(scope _tool) |
| 62 | +{ |
| 63 | + class_<IEngineTool, boost::noncopyable>("_EngineTool", no_init) |
| 64 | + .def("get_sound_duration_by_path", |
| 65 | + GET_METHOD(float, IEngineTool, GetSoundDuration, const char*), |
| 66 | + "Returns the duration of the given sound sample.", |
| 67 | + args("sampleName") |
| 68 | + ) |
| 69 | + |
| 70 | + .def("get_sound_duration_by_guid", |
| 71 | + GET_METHOD(float, IEngineTool, GetSoundDuration, int), |
| 72 | + "Returns the duration of the sound tied to the given GUID.", |
| 73 | + args("guid") |
| 74 | + ) |
| 75 | + |
| 76 | + .def("is_sound_still_playing", |
| 77 | + &IEngineTool::IsSoundStillPlaying, |
| 78 | + "Returns true if the given sound is still playing", |
| 79 | + args("sound_guid") |
| 80 | + ) |
| 81 | + |
| 82 | + .def("stop_sound_by_guid", |
| 83 | + &IEngineTool::StopSoundByGuid, |
| 84 | + "Stops a sound by GUID.", |
| 85 | + args("guid") |
| 86 | + ) |
| 87 | + |
| 88 | + .def("is_looping_sound", |
| 89 | + &IEngineTool::IsLoopingSound, |
| 90 | + "Returns true if the sound is looping.", |
| 91 | + args("guid") |
| 92 | + ) |
| 93 | + |
| 94 | + .def("reload_sound", |
| 95 | + &IEngineTool::ReloadSound, |
| 96 | + "Reloads the given sound from the disk.", |
| 97 | + args("sound_path") |
| 98 | + ) |
| 99 | + |
| 100 | + .def("stop_all_sounds", |
| 101 | + &IEngineTool::StopAllSounds, |
| 102 | + "Stops all sounds that are currently playing." |
| 103 | + ) |
| 104 | + |
| 105 | + ADD_MEM_TOOLS(IEngineTool) |
| 106 | + ; |
| 107 | + |
| 108 | + _tool.attr("engine_tool") = object(ptr(enginetool)); |
| 109 | +} |
| 110 | + |
0 commit comments