2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* audio_driver_javascript.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2020-01-01 10:16:22 +00:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 01:10:30 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#ifndef AUDIO_DRIVER_JAVASCRIPT_H
|
|
|
|
#define AUDIO_DRIVER_JAVASCRIPT_H
|
|
|
|
|
2017-01-16 18:19:45 +00:00
|
|
|
#include "servers/audio_server.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-15 19:06:14 +00:00
|
|
|
class AudioDriverJavaScript : public AudioDriver {
|
2020-06-29 16:51:53 +00:00
|
|
|
float *internal_buffer = nullptr;
|
2017-10-27 01:34:49 +00:00
|
|
|
|
2020-06-29 16:51:53 +00:00
|
|
|
int _driver_id = 0;
|
|
|
|
int buffer_length = 0;
|
2018-10-08 18:46:21 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
2020-06-29 16:51:53 +00:00
|
|
|
static bool is_available();
|
2017-11-05 22:48:13 +00:00
|
|
|
void mix_to_js();
|
2018-10-08 18:46:21 +00:00
|
|
|
void process_capture(float sample);
|
|
|
|
|
2017-11-05 22:48:13 +00:00
|
|
|
static AudioDriverJavaScript *singleton;
|
2017-10-27 01:34:49 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual const char *get_name() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
virtual Error init();
|
|
|
|
virtual void start();
|
2019-01-20 13:25:15 +00:00
|
|
|
void resume();
|
2020-05-18 00:19:35 +00:00
|
|
|
virtual float get_latency();
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual int get_mix_rate() const;
|
2017-01-16 18:19:45 +00:00
|
|
|
virtual SpeakerMode get_speaker_mode() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual void lock();
|
|
|
|
virtual void unlock();
|
|
|
|
virtual void finish();
|
2020-05-01 12:45:45 +00:00
|
|
|
void finish_async();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-10-08 18:46:21 +00:00
|
|
|
virtual Error capture_start();
|
|
|
|
virtual Error capture_stop();
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
AudioDriverJavaScript();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|