godotengine / godotengine/godot-docs

Custom audiostream boilerplate not compiling.

Open
#6,170 2 comments 0 reactions 0 assignees View on GitHub
area:engine details bug
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**

3.6-beta, Also tried with 3.4.5

**Issue description:**

I was following the tutorial here: https://docs.godotengine.org/en/3.6/development/cpp/custom_audiostreams.html, but the files don't compile.

scons -j8 platform=linuxbsd
scons: Reading SConscript files ...
Platform "linuxbsd" is still called "x11" in Godot 3.x. Building for platform "x11".
Warning: Speech Dispatcher development libraries not found. Disabling Text-to-Speech support.
Note: Building a debug binary (which will run slowly). Use `target=release_debug` to build an optimized release binary.
Warning: module 'x11' uses a deprecated `can_build` signature in its config.py file, it should be `can_build(env, platform)`.
Checking for C header file mntent.h... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
[ 30%] Compiling ==> modules/audiostream/audiostream.cpp
[ 30%] Compiling ==> modules/audiostream/audiostreamplayer.cpp
[ 46%] modules/audiostream/audiostream.cpp: In member function 'virtual Ref AudioStreamMyTone::instance_playback()':
modules/audiostream/audiostream.cpp:10:13: error: 'AudioStreamPlaybackMyTone' was not declared in this scope; did you mean 'AudioStreamPlaybackResampled'?
10 | Ref talking_tree;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| AudioStreamPlaybackResampled
modules/audiostream/audiostream.cpp:10:39: error: template argument 1 is invalid
10 | Ref talking_tree;
| ^
modules/audiostream/audiostream.cpp:11:22: error: request for member 'instance' in 'talking_tree', which is of non-class type 'int'
11 | talking_tree.instance();
| ^~~~~~~~
modules/audiostream/audiostream.cpp:12:21: error: base operand of '->' is not a pointer
12 | talking_tree->base = Ref(this);
| ^~
modules/audiostream/audiostream.cpp:13:16: error: could not convert 'talking_tree' from 'int' to 'Ref'
13 | return talking_tree;
| ^~~~~~~~~~~~
| |
| int
[ 46%] In file included from modules/audiostream/audiostreamplayer.cpp:3:
modules/audiostream/audiostreamplayer.h:21:13: error: 'AudioStreamMyTone' was not declared in this scope
21 | Ref base;
| ^~~~~~~~~~~~~~~~~~
modules/audiostream/audiostreamplayer.h:21:31: error: template argument 1 is invalid
21 | Ref base;
| ^
[ 46%] modules/audiostream/audiostreamplayer.cpp: In constructor 'AudioStreamPlaybackMyTone::AudioStreamPlaybackMyTone()':
modules/audiostream/audiostreamplayer.cpp:12:9: error: 'zeromem' was not declared in this scope
12 | zeromem(pcm_buffer, PCM_BUFFER_SIZE);
| ^~~~~~~
modules/audiostream/audiostreamplayer.cpp: In member function 'virtual void AudioStreamPlaybackMyTone::stop()':
modules/audiostream/audiostreamplayer.cpp:23:13: error: base operand of '->' is not a pointer
23 | base->reset();
| ^~
modules/audiostream/audiostreamplayer.cpp: In member function 'virtual void AudioStreamPlaybackMyTone::seek(float)':
modules/audiostream/audiostreamplayer.cpp:34:13: error: base operand of '->' is not a pointer
34 | base->set_position(uint64_t(p_time * base->mix_rate) << MIX_FRAC_BITS);
| ^~
modules/audiostream/audiostreamplayer.cpp:34:50: error: base operand of '->' is not a pointer
34 | base->set_position(uint64_t(p_time * base->mix_rate) << MIX_FRAC_BITS);
| ^~
modules/audiostream/audiostreamplayer.cpp:30:15: warning: unused variable 'max' [-Wunused-variable]
30 | float max = get_length();
| ^~~
[ 46%] modules/audiostream/audiostreamplayer.cpp: In member function 'virtual void AudioStreamPlaybackMyTone::mix(AudioFrame*, float, int)':
modules/audiostream/audiostreamplayer.cpp:41:9: error: 'zeromem' was not declared in this scope
41 | zeromem(pcm_buffer, PCM_BUFFER_SIZE);
| ^~~~~~~
modules/audiostream/audiostreamplayer.cpp:43:13: error: base operand of '->' is not a pointer
43 | base->gen_tone(buf, p_frames);
| ^~
[ 60%] Compiling ==> platform/osx/export/export.cpp
[ 60%] Compiling ==> platform/osx/export/lipo.cpp
[ 60%] Compiling ==> platform/osx/export/macho.cpp
[ 60%] Compiling ==> platform/osx/export/plist.cpp
[ 60%] Compiling ==> platform/uwp/export/export.cpp
[ 60%] Compiling ==> platform/windows/export/export.cpp
scons: *** [modules/audiostream/audiostream.x11.tools.64.o] Error 1
scons: *** [modules/audiostream/audiostreamplayer.x11.tools.64.o] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:00:05.713]

The SCsub, config.py, and register_types files are set up according to this: https://docs.godotengine.org/en/3.6/development/cpp/custom_modules_in_cpp.html#doc-custom-modules-in-c

I'm no C++ expert. Why is AudioStreamPlaybackMyTone not declared in this scope? In audiostream_mytone.h it looks like it is declared as "friend class AudioStreamPlaybackMyTone"

I have tried changing the folder name to something other than audiostream, as well as changing AudioStreamMyTone and AudioStreamPlaybackMyTone to see if there was some conflict with existing AudioStream object.

Could the documentation be improved?

**URL to the documentation page (if already existing):**

https://docs.godotengine.org/en/3.6/development/cpp/custom_audiostreams.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.