| 1 | #cxx . . $ `<file>/foned/SoundRecorder.h`/ifndef _SoundRecorder_h_ |
| 2 | #define _SoundRecorder_h_cxx . . $ `foned/SoundRecorder.h:2:9`! |
| 3 | /* SoundRecorder.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2008-2013,2015-2017,2020,2022,2023,2025 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 3 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 | /* An editor-like object that allows the user to record sounds. */ |
| 22 | |
| 23 | #include "ScriptEditor.h"cxx . . $ `<file>/sys/ScriptEditor.h`/ |
| 24 | #include "Sound.h"cxx . . $ `<file>/fon/Sound.h`/ |
| 25 | |
| 26 | #include "SoundRecorder_enums.h"cxx . . $ `<file>/foned/SoundRecorder_enums.h`/ |
| 27 | |
| 28 | #include "../external/portaudio/portaudio.h"cxx . . $ `<file>/external/portaudio/portaudio.h`/ |
| 29 | #if defined (_WIN32) |
| 30 | #elif defined (macintosh) |
| 31 | #elif defined (linuxcxx . . $ `<built-in>:480:9`!) |
| 32 | #include <sys/types.h> |
| 33 | #include <sys/stat.h> |
| 34 | #include <sys/ioctl.h> |
| 35 | #include <fcntl.h> |
| 36 | #include <unistd.h> |
| 37 | #if ! defined (NO_AUDIO) |
| 38 | #if defined (__OpenBSD__) || defined (__NetBSD__) |
| 39 | #include <soundcard.h> |
| 40 | #else |
| 41 | #include <sys/soundcard.h> |
| 42 | #endif |
| 43 | #endif |
| 44 | #endif |
| 45 | |
| 46 | struct SoundRecorder_Devicecxx . . $ SoundRecorder_Device# { |
| 47 | static constexpr int maximumLengthOfFullNamecxx . . $ SoundRecorder_Device#maximumLengthOfFullName. = 60; |
| 48 | char32cxx . . $ char32# fullNamecxx . . $ SoundRecorder_Device#fullName. [1+maximumLengthOfFullNamecxx . . $ SoundRecorder_Device#maximumLengthOfFullName.]; |
| 49 | bool canDocxx . . $ SoundRecorder_Device#canDo.; |
| 50 | GuiRadioButtoncxx . . $ GuiRadioButton# buttoncxx . . $ SoundRecorder_Device#button.; |
| 51 | }; |
| 52 | |
| 53 | struct SoundRecorder_Fsampcxx . . $ SoundRecorder_Fsamp# { |
| 54 | double fsampcxx . . $ SoundRecorder_Fsamp#fsamp.; |
| 55 | bool canDocxx . . $ SoundRecorder_Fsamp#canDo.; |
| 56 | GuiRadioButtoncxx . . $ GuiRadioButton# buttoncxx . . $ SoundRecorder_Fsamp#button.; |
| 57 | }; |
| 58 | |
| 59 | #define SoundRecorder_IDEVICE_MAXcxx . . $ `foned/SoundRecorder.h:59:9`! 20 |
| 60 | |
| 61 | #define SoundRecorder_IFSAMP_8000cxx . . $ `foned/SoundRecorder.h:61:9`! 1 |
| 62 | #define SoundRecorder_IFSAMP_9800cxx . . $ `foned/SoundRecorder.h:62:9`! 2 |
| 63 | #define SoundRecorder_IFSAMP_11025cxx . . $ `foned/SoundRecorder.h:63:9`! 3 |
| 64 | #define SoundRecorder_IFSAMP_12000cxx . . $ `foned/SoundRecorder.h:64:9`! 4 |
| 65 | #define SoundRecorder_IFSAMP_16000cxx . . $ `foned/SoundRecorder.h:65:9`! 5 |
| 66 | #define SoundRecorder_IFSAMP_22050cxx . . $ `foned/SoundRecorder.h:66:9`! 6 |
| 67 | #define SoundRecorder_IFSAMP_22254cxx . . $ `foned/SoundRecorder.h:67:9`! 7 |
| 68 | #define SoundRecorder_IFSAMP_24000cxx . . $ `foned/SoundRecorder.h:68:9`! 8 |
| 69 | #define SoundRecorder_IFSAMP_32000cxx . . $ `foned/SoundRecorder.h:69:9`! 9 |
| 70 | #define SoundRecorder_IFSAMP_44100cxx . . $ `foned/SoundRecorder.h:70:9`! 10 |
| 71 | #define SoundRecorder_IFSAMP_48000cxx . . $ `foned/SoundRecorder.h:71:9`! 11 |
| 72 | #define SoundRecorder_IFSAMP_64000cxx . . $ `foned/SoundRecorder.h:72:9`! 12 |
| 73 | #define SoundRecorder_IFSAMP_96000cxx . . $ `foned/SoundRecorder.h:73:9`! 13 |
| 74 | #define SoundRecorder_IFSAMP_192000cxx . . $ `foned/SoundRecorder.h:74:9`! 14 |
| 75 | #define SoundRecorder_IFSAMP_MAXcxx . . $ `foned/SoundRecorder.h:75:9`! 14 |
| 76 | |
| 77 | Thing_definecxx . . $ SoundRecorder_Parent# (SoundRecorder, Editor) { |
| 78 | int numberOfChannelscxx . . $ structSoundRecorder#numberOfChannels.; |
| 79 | integercxx . . $ integer# nsampcxx . . $ structSoundRecorder#nsamp., nmaxcxx . . $ structSoundRecorder#nmax.; |
| 80 | integercxx . . $ integer# firstSamplecxx . . $ structSoundRecorder#firstSample., lastSamplecxx . . $ structSoundRecorder#lastSample.; // for the meter |
| 81 | bool synchronouscxx . . $ structSoundRecorder#synchronous., recordingcxx . . $ structSoundRecorder#recording.; |
| 82 | int lastLeftMaximumcxx . . $ structSoundRecorder#lastLeftMaximum., lastRightMaximumcxx . . $ structSoundRecorder#lastRightMaximum.; |
| 83 | integercxx . . $ integer# numberOfInputDevicescxx . . $ structSoundRecorder#numberOfInputDevices.; |
| 84 | struct SoundRecorder_Devicecxx . . $ SoundRecorder_Device# devicescxx . . $ structSoundRecorder#devices. [1+SoundRecorder_IDEVICE_MAXcxx . . $ `foned/SoundRecorder.h:59:9`!]; |
| 85 | struct SoundRecorder_Fsampcxx . . $ SoundRecorder_Fsamp# fsampscxx . . $ structSoundRecorder#fsamps. [1+SoundRecorder_IFSAMP_MAXcxx . . $ `foned/SoundRecorder.h:75:9`!]; |
| 86 | autovectorcxx . . $ autovector# <short> recordBuffercxx . . $ structSoundRecorder#recordBuffer.; |
| 87 | GuiRadioButtoncxx . . $ GuiRadioButton# monoButtoncxx . . $ structSoundRecorder#monoButton., stereoButtoncxx . . $ structSoundRecorder#stereoButton.; |
| 88 | GuiDrawingAreacxx . . $ GuiDrawingArea# metercxx . . $ structSoundRecorder#meter.; |
| 89 | GuiScalecxx . . $ GuiScale# progressScalecxx . . $ structSoundRecorder#progressScale.; |
| 90 | GuiButtoncxx . . $ GuiButton# recordButtoncxx . . $ structSoundRecorder#recordButton., stopButtoncxx . . $ structSoundRecorder#stopButton., playButtoncxx . . $ structSoundRecorder#playButton.; |
| 91 | GuiTextcxx . . $ GuiText# soundNamecxx . . $ structSoundRecorder#soundName.; |
| 92 | GuiButtoncxx . . $ GuiButton# cancelButtoncxx . . $ structSoundRecorder#cancelButton., applyButtoncxx . . $ structSoundRecorder#applyButton., okButtoncxx . . $ structSoundRecorder#okButton.; |
| 93 | GuiMenuItemcxx . . $ GuiMenuItem# meterIntensityButtoncxx . . $ structSoundRecorder#meterIntensityButton., meterCentreOfGravityVersusIntensityButtoncxx . . $ structSoundRecorder#meterCentreOfGravityVersusIntensityButton.; |
| 94 | autoGraphicscxx . . $ autoGraphics# graphicscxx . . $ structSoundRecorder#graphics.; |
| 95 | bool inputUsesPortAudiocxx . . $ structSoundRecorder#inputUsesPortAudio.; |
| 96 | |
| 97 | const PaDeviceInfo *deviceInfoscxx . . $ structSoundRecorder#deviceInfos. [1+SoundRecorder_IDEVICE_MAXcxx . . $ `foned/SoundRecorder.h:59:9`!]; |
| 98 | PaDeviceIndex deviceIndicescxx . . $ structSoundRecorder#deviceIndices. [1+SoundRecorder_IDEVICE_MAXcxx . . $ `foned/SoundRecorder.h:59:9`!]; |
| 99 | PaStream *portaudioStreamcxx . . $ structSoundRecorder#portaudioStream.; |
| 100 | |
| 101 | #if cocoacxx . . $ `sys/Gui.h:35:10`! |
| 102 | CFRunLoopTimerRef d_cocoaTimer; |
| 103 | #elif motifcxx . . $ `sys/Gui.h:34:10`! |
| 104 | XtWorkProcId workProcId; |
| 105 | #endif |
| 106 | #if defined (_WIN32) |
| 107 | HWAVEIN hWaveIn; |
| 108 | WAVEFORMATEX waveFormat; |
| 109 | WAVEHDR waveHeader [3]; |
| 110 | MMRESULT err; |
| 111 | short buffertje1 [1000*2], buffertje2 [1000*2]; |
| 112 | #elif defined (macintosh) |
| 113 | short macSource [1+8]; |
| 114 | Str255 hybridDeviceNames [1+8]; |
| 115 | int32 refNum; |
| 116 | #elif defined (linuxcxx . . $ `<built-in>:480:9`!) |
| 117 | int fdcxx . . $ structSoundRecorder#fd.; |
| 118 | #else |
| 119 | int fd; |
| 120 | #endif |
| 121 | |
| 122 | void v9_destroycxx . . $ structSoundRecorder#v9_destroy(ced63f7c635d850d). () noexcept |
| 123 | override; |
| 124 | bool v_hasEditMenucxx . . $ structSoundRecorder#v_hasEditMenu(c9857a73d68e59ba). () |
| 125 | override { return false; } |
| 126 | bool v_scriptablecxx . . $ structSoundRecorder#v_scriptable(c9857a73d68e59ba). () |
| 127 | override { return false; } |
| 128 | void v_createChildrencxx . . $ structSoundRecorder#v_createChildren(49f6e7a06ebc5aa8). () |
| 129 | override; |
| 130 | void v_createMenuscxx . . $ structSoundRecorder#v_createMenus(49f6e7a06ebc5aa8). () |
| 131 | override; |
| 132 | void v_createMenuItems_helpcxx . . $ structSoundRecorder#v_createMenuItems_help(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) |
| 133 | override; |
| 134 | |
| 135 | #include "SoundRecorder_prefs.h"cxx . . $ `<file>/foned/SoundRecorder_prefs.h`/ |
| 136 | }; |
| 137 | |
| 138 | autoSoundRecordercxx . . $ autoSoundRecorder# SoundRecorder_createcxx . . $ SoundRecorder_create(7cf06c42999cac48). (int numberOfChannels); |
| 139 | /* |
| 140 | Function: |
| 141 | create a SoundRecorder, which is an interactive window |
| 142 | for recording in 16-bit mono or stereo. |
| 143 | */ |
| 144 | |
| 145 | void SoundRecorder_preferencescxx . . $ SoundRecorder_preferences(49f6e7a06ebc5aa8). (); |
| 146 | integercxx . . $ integer# SoundRecorder_getBufferSizePref_MBcxx . . $ SoundRecorder_getBufferSizePref_MB(da6335ded91d79c2). (); |
| 147 | void SoundRecorder_setBufferSizePref_MBcxx . . $ SoundRecorder_setBufferSizePref_MB(1624ee8275b10bda). (integercxx . . $ integer# size); |
| 148 | |
| 149 | /* End of file SoundRecorder.h */ |
| 150 | #endif |