Debian Codegraph @

melder/melder_audio.h

raw symbols SCIP
1 #cxx . . $ `<file>/melder/melder_audio.h`/ifndef _melder_audio_h_
2 #define _melder_audio_h_cxx . . $ `melder/melder_audio.h:2:9`!
3 /* melder_audio.h
4 *
5 * Copyright (C) 1992-2019,2021 Paul Boersma
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 void MelderAudio_setInputSoundSystemcxx . . $ MelderAudio_setInputSoundSystem(1b219e7f3e764b3b). (enum kMelder_inputSoundSystemcxx . . $ kMelder_inputSoundSystem# inputSoundSystem);
22 enum kMelder_inputSoundSystemcxx . . $ kMelder_inputSoundSystem# MelderAudio_getInputSoundSystemcxx . . $ MelderAudio_getInputSoundSystem(b002a9b809d5560e). ();
23
24 void MelderAudio_setOutputSoundSystemcxx . . $ MelderAudio_setOutputSoundSystem(bda361b99daaddf). (enum kMelder_outputSoundSystemcxx . . $ kMelder_outputSoundSystem# outputSoundSystem);
25 enum kMelder_outputSoundSystemcxx . . $ kMelder_outputSoundSystem# MelderAudio_getOutputSoundSystemcxx . . $ MelderAudio_getOutputSoundSystem(39883f4cf88fac7). ();
26
27 #if defined (_WIN32)
28 #define kMelderAudio_outputSilenceBefore_DEFAULT 0.0
29 #define kMelderAudio_outputSilenceAfter_DEFAULT 0.1
30 // in order to get rid of the click on some cards
31 #elif defined (macintosh)
32 #define kMelderAudio_outputSilenceBefore_DEFAULT 0.0
33 // in order to switch off the BOING caused by the automatic gain control
34 #define kMelderAudio_outputSilenceAfter_DEFAULT 0.0
35 // in order to reduce the BOING caused by the automatic gain control when the user replays immediately after a sound has finished
36 #elif defined (linuxcxx . . $ `<built-in>:480:9`!)
37 #define kMelderAudio_outputSilenceBefore_DEFAULTcxx . . $ `melder/melder_audio.h:37:10`! 0.0
38 #define kMelderAudio_outputSilenceAfter_DEFAULTcxx . . $ `melder/melder_audio.h:38:10`! 0.1
39 // in order to get rid of double playing of a sounding buffer (?)
40 #else
41 #define kMelderAudio_outputSilenceBefore_DEFAULT 0.0
42 #define kMelderAudio_outputSilenceAfter_DEFAULT 0.0
43 #endif
44 void MelderAudio_setOutputSilenceBeforecxx . . $ MelderAudio_setOutputSilenceBefore(ba8836b59fb42830). (double silenceBefore);
45 double MelderAudio_getOutputSilenceBeforecxx . . $ MelderAudio_getOutputSilenceBefore(31fa7155c10fdd13). ();
46 void MelderAudio_setOutputSilenceAftercxx . . $ MelderAudio_setOutputSilenceAfter(ba8836b59fb42830). (double silenceAfter);
47 double MelderAudio_getOutputSilenceAftercxx . . $ MelderAudio_getOutputSilenceAfter(31fa7155c10fdd13). ();
48
49 integercxx . . $ integer# MelderAudio_getOutputBestSampleRatecxx . . $ MelderAudio_getOutputBestSampleRate(8ce0d1b217db7fd1). (integercxx . . $ integer# fsamp);
50
51 inline bool MelderAudio_isPlayingcxx . . $ MelderAudio_isPlaying.;
52 inline bool MelderAudio_hasBeenInitializedcxx . . $ MelderAudio_hasBeenInitialized.;
53 void MelderAudio_play16cxx . . $ MelderAudio_play16(4eeb2eee1b9aa526). (int16cxx . . $ int16# *buffer, integercxx . . $ integer# sampleRate, integercxx . . $ integer# numberOfSamples, integercxx . . $ integer# numberOfChannels,
54 bool (*playCallback) (void *playClosure, integercxx . . $ integer# numberOfSamplesPlayed), // return true to continue, false to stop
55 void *playClosure);
56 bool MelderAudio_stopPlayingcxx . . $ MelderAudio_stopPlaying(efaadfb7dc14930a). (bool isExplicit); // returns true if sound was playing
57 #define MelderAudio_IMPLICITcxx . . $ `melder/melder_audio.h:57:9`! false
58 #define MelderAudio_EXPLICITcxx . . $ `melder/melder_audio.h:58:9`! true
59 integercxx . . $ integer# MelderAudio_getSamplesPlayedcxx . . $ MelderAudio_getSamplesPlayed(da6335ded91d79c2). ();
60 bool MelderAudio_stopWasExplicitcxx . . $ MelderAudio_stopWasExplicit(c9857a73d68e59ba). ();
61
62 void Melder_audio_prefscxx . . $ Melder_audio_prefs(49f6e7a06ebc5aa8). (); // in init file
63
64 #pragma mark - ASYNCHRONICITY
65
66 void MelderAudio_setOutputMaximumAsynchronicitycxx . . $ MelderAudio_setOutputMaximumAsynchronicity(b9ec3c4c219f7acd). (enum kMelder_asynchronicityLevelcxx . . $ kMelder_asynchronicityLevel# maximumAsynchronicity);
67 enum kMelder_asynchronicityLevelcxx . . $ kMelder_asynchronicityLevel# MelderAudio_getOutputMaximumAsynchronicitycxx . . $ MelderAudio_getOutputMaximumAsynchronicity(87adc80345cd79f7). ();
68
69 class autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity# {
70 bool _disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned.;
71 enum kMelder_asynchronicityLevelcxx . . $ kMelder_asynchronicityLevel# _savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity.;
72 public:
73 autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#autoMelderAudioSaveMaximumAsynchronicity(49f6e7a06ebc5aa8). () {
74 ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity. = MelderAudio_getOutputMaximumAsynchronicitycxx . . $ MelderAudio_getOutputMaximumAsynchronicity(87adc80345cd79f7). ();
75 tracecxx . . $ `melder/melder_debug.h:60:10`! (U"value was ", (int) ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicity);
76 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned. = false;
77 }
78 ~cxx . . $ autoMelderAudioSaveMaximumAsynchronicity#`~autoMelderAudioSaveMaximumAsynchronicity`(ced63f7c635d850d).autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity# () {
79 MelderAudio_setOutputMaximumAsynchronicitycxx . . $ MelderAudio_setOutputMaximumAsynchronicity(b9ec3c4c219f7acd). (ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity.);
80 tracecxx . . $ `melder/melder_debug.h:60:10`! (U"value set to ", (int) ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicity);
81 }
82 /*
83 Disable copying.
84 */
85 autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#autoMelderAudioSaveMaximumAsynchronicity(2600cac9b6cf3cf6). (const autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#&) = delete; // disable copy constructor
86 autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#& operatorcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#`operator=`(5959a247f019929b).= (const autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#&) = delete; // disable copy assignment
87 /*
88 Enable moving.
89 */
90 autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#autoMelderAudioSaveMaximumAsynchronicity(1be3b33f1df6cb90). (autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#&& other) noexcept { // enable move constructor
91 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned. = other._disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned.;
92 ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity. = other._savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity.;
93 other._disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned. = true;
94 }
95 autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#& operatorcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#`operator=`(507321c71fb74d39).= (autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#&& other) noexcept { // enable move assignment
96 if (& other != this) {
97 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned. = other._disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned.;
98 ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity. = other._savedAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_savedAsynchronicity.;
99 other._disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned. = true; // needed only if you insist on keeping the source in a valid state
100 }
101 return *this;
102 }
103 autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#&& movecxx . . $ autoMelderAudioSaveMaximumAsynchronicity#move(8f0d100e8d70f5dd). () noexcept { return static_cast <autoMelderAudioSaveMaximumAsynchronicitycxx . . $ autoMelderAudioSaveMaximumAsynchronicity#&&> (*this); }
104 void releaseToAmbiguousOwnercxx . . $ autoMelderAudioSaveMaximumAsynchronicity#releaseToAmbiguousOwner(49f6e7a06ebc5aa8). () {
105 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAudioSaveMaximumAsynchronicity#_disowned. = true;
106 }
107 };
108
109 /*
110 True if specified by the "asynchronous" directive in a script.
111 */
112 inline bool Melder_asynchronouscxx . . $ Melder_asynchronous.;
113
114 class autoMelderAsynchronouscxx . . $ autoMelderAsynchronous# {
115 bool _disownedcxx . . $ autoMelderAsynchronous#_disowned.;
116 bool _savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity.;
117 public:
118 autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#autoMelderAsynchronous(49f6e7a06ebc5aa8). () {
119 ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity. = Melder_asynchronouscxx . . $ Melder_asynchronous.;
120 Melder_asynchronouscxx . . $ Melder_asynchronous. = true;
121 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAsynchronous#_disowned. = false;
122 }
123 ~cxx . . $ autoMelderAsynchronous#`~autoMelderAsynchronous`(ced63f7c635d850d).autoMelderAsynchronouscxx . . $ autoMelderAsynchronous# () {
124 if (! _disownedcxx . . $ autoMelderAsynchronous#_disowned.) {
125 Melder_asynchronouscxx . . $ Melder_asynchronous. = _savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity.;
126 }
127 }
128 /*
129 Disable copying.
130 */
131 autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#autoMelderAsynchronous(d77e69157299ae45). (const autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#&) = delete; // disable copy constructor
132 autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#& operatorcxx . . $ autoMelderAsynchronous#`operator=`(fdf6192d0ea2c51d).= (const autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#&) = delete; // disable copy assignment
133 /*
134 Enable moving.
135 */
136 autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#autoMelderAsynchronous(1d40144796052bd3). (autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#&& other) noexcept { // enable move constructor
137 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAsynchronous#_disowned. = other._disownedcxx . . $ autoMelderAsynchronous#_disowned.;
138 ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity. = other._savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity.;
139 other._disownedcxx . . $ autoMelderAsynchronous#_disowned. = true;
140 }
141 autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#& operatorcxx . . $ autoMelderAsynchronous#`operator=`(ff77b214ffb9dc91).= (autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#&& other) noexcept { // enable move assignment
142 if (& other != this) {
143 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAsynchronous#_disowned. = other._disownedcxx . . $ autoMelderAsynchronous#_disowned.;
144 ourcxx . . $ `melder/melder.h:42:9`! _savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity. = other._savedAsynchronicitycxx . . $ autoMelderAsynchronous#_savedAsynchronicity.;
145 other._disownedcxx . . $ autoMelderAsynchronous#_disowned. = true; // needed only if you insist on keeping the source in a valid state
146 }
147 return *this;
148 }
149 autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#&& movecxx . . $ autoMelderAsynchronous#move(d73893df1bc7c24c). () noexcept { return static_cast <autoMelderAsynchronouscxx . . $ autoMelderAsynchronous#&&> (*this); }
150 void releaseToAmbiguousOwnercxx . . $ autoMelderAsynchronous#releaseToAmbiguousOwner(49f6e7a06ebc5aa8). () {
151 ourcxx . . $ `melder/melder.h:42:9`! _disownedcxx . . $ autoMelderAsynchronous#_disowned. = true;
152 }
153 };
154
155 /* End of file melder_audio.h */
156 #endif