| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __SOUND_MIXER_H______ |
| 20 | #define __SOUND_MIXER_H______cxx . . $ `sndlib/mixer.h:20:9`! |
| 21 | |
| 22 | #include "ssl_lib.h"cxx . . $ `<file>/sndlib/ssl_lib.h`/ |
| 23 | |
| 24 | class sound_buffercxx . . $ sound_buffer# { |
| 25 | public: |
| 26 | virtual int GetNumBufferBytescxx . . $ sound_buffer#GetNumBufferBytes(b126dc7c1de90089).(void) = 0; |
| 27 | virtual void Writecxx . . $ sound_buffer#Write(fc0f0e1646c32816).(uint8_tcxx . . $ uint8_t# *buffer, int amount) = 0; |
| 28 | |
| 29 | private: |
| 30 | }; |
| 31 | |
| 32 | struct DSLOOPSTREAMcxx . . $ DSLOOPSTREAM# { |
| 33 | int playingcxx . . $ DSLOOPSTREAM#playing.; |
| 34 | int please_closecxx . . $ DSLOOPSTREAM#please_close.; |
| 35 | char *current_positioncxx . . $ DSLOOPSTREAM#current_position.; |
| 36 | int bytes_leftcxx . . $ DSLOOPSTREAM#bytes_left.; |
| 37 | int no_callbackscxx . . $ DSLOOPSTREAM#no_callbacks.; |
| 38 | int half_buffer_pointcxx . . $ DSLOOPSTREAM#half_buffer_point.; |
| 39 | int last_halfcxx . . $ DSLOOPSTREAM#last_half.; |
| 40 | int close_on_nextcxx . . $ DSLOOPSTREAM#close_on_next.; |
| 41 | char silence_bytecxx . . $ DSLOOPSTREAM#silence_byte.; |
| 42 | bool f_sample_16bitcxx . . $ DSLOOPSTREAM#f_sample_16bit.; |
| 43 | int num_writtencxx . . $ DSLOOPSTREAM#num_written.; |
| 44 | bool kill_mecxx . . $ DSLOOPSTREAM#kill_me.; |
| 45 | }; |
| 46 | |
| 47 | // Sound item info (cache list) |
| 48 | // override if you need to keep more information |
| 49 | class sound_buffer_infocxx . . $ sound_buffer_info# { |
| 50 | public: |
| 51 | sound_buffer_infocxx . . $ sound_buffer_info#sound_buffer_info(49f6e7a06ebc5aa8).() { |
| 52 | m_statuscxx . . $ sound_buffer_info#m_status. = SSF_UNUSEDcxx . . $ `sndlib/ssl_lib.h:416:9`!; |
| 53 | scxx . . $ sound_buffer_info#s. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 54 | } |
| 55 | |
| 56 | play_informationcxx . . $ play_information# *play_infocxx . . $ sound_buffer_info#play_info.; |
| 57 | |
| 58 | int m_sound_indexcxx . . $ sound_buffer_info#m_sound_index.; // Index of sound |
| 59 | int m_unique_idcxx . . $ sound_buffer_info#m_unique_id.; // Unique id for the currently playing sample |
| 60 | |
| 61 | // Not needed by the software mixer |
| 62 | volatile DSLOOPSTREAMcxx . . $ DSLOOPSTREAM# *scxx . . $ sound_buffer_info#s.; // Streaming info for a looping sample |
| 63 | |
| 64 | int16_t m_mixer_typecxx . . $ sound_buffer_info#m_mixer_type.; // ds3d, ds_8? |
| 65 | int16_t m_buffer_typecxx . . $ sound_buffer_info#m_buffer_type.; // Buffer type 2d or 3d |
| 66 | |
| 67 | char *sample_datacxx . . $ sound_buffer_info#sample_data.; |
| 68 | int sample_lengthcxx . . $ sound_buffer_info#sample_length.; // used for storage purposes. |
| 69 | |
| 70 | float m_volumecxx . . $ sound_buffer_info#m_volume.; |
| 71 | |
| 72 | bool stereocxx . . $ sound_buffer_info#stereo.; |
| 73 | int8_t bpscxx . . $ sound_buffer_info#bps.; |
| 74 | uint8_tcxx . . $ uint8_t# m_statuscxx . . $ sound_buffer_info#m_status.; // Sound status |
| 75 | uint8_tcxx . . $ uint8_t# padcxx . . $ sound_buffer_info#pad.; |
| 76 | }; |
| 77 | |
| 78 | struct tMixerInitcxx . . $ tMixerInit# { |
| 79 | sound_buffercxx . . $ sound_buffer# *primary_buffercxx . . $ tMixerInit#primary_buffer.; |
| 80 | int primary_frequencycxx . . $ tMixerInit#primary_frequency.; |
| 81 | int primary_alignmentcxx . . $ tMixerInit#primary_alignment.; |
| 82 | int *max_sounds_availablecxx . . $ tMixerInit#max_sounds_available.; // pointer to the variable that is updated with the # of sounds in the sound_cache |
| 83 | sound_buffer_infocxx . . $ sound_buffer_info# *sound_cachecxx . . $ tMixerInit#sound_cache.; // the array of sound information |
| 84 | |
| 85 | void (*fp_SetErrorcxx . . $ tMixerInit#fp_SetError.)(int code); |
| 86 | void (*fp_ErrorTextcxx . . $ tMixerInit#fp_ErrorText.)(const char *fmt, ...); |
| 87 | int *p_error_codecxx . . $ tMixerInit#p_error_code.; |
| 88 | |
| 89 | llsSystemcxx . . $ llsSystem# *ll_sound_ptrcxx . . $ tMixerInit#ll_sound_ptr.; |
| 90 | }; |
| 91 | |
| 92 | class software_mixercxx . . $ software_mixer# { |
| 93 | public: |
| 94 | software_mixercxx . . $ software_mixer#software_mixer(49f6e7a06ebc5aa8).(); |
| 95 | ~cxx . . $ software_mixer#`~software_mixer`(ced63f7c635d850d).software_mixercxx . . $ software_mixer#(); |
| 96 | |
| 97 | bool Initializecxx . . $ software_mixer#Initialize(f98e0e26c84ad24b).(tMixerInitcxx . . $ tMixerInit# *mi); |
| 98 | void DoFramecxx . . $ software_mixer#DoFrame(49f6e7a06ebc5aa8).(void); |
| 99 | |
| 100 | // The actual mixer code that sum's the sounds on each channel and does all the actual |
| 101 | // mixing and effects (writes data to the locked primary buffer) |
| 102 | void StreamMixercxx . . $ software_mixer#StreamMixer(a07d8cccb7673f5a).(char *ptr, int len); |
| 103 | |
| 104 | private: |
| 105 | llsSystemcxx . . $ llsSystem# *m_ll_sound_ptrcxx . . $ software_mixer#m_ll_sound_ptr.; |
| 106 | bool m_initcxx . . $ software_mixer#m_init.; |
| 107 | sound_buffercxx . . $ sound_buffer# *m_primary_buffercxx . . $ software_mixer#m_primary_buffer.; |
| 108 | int *Fast_mixercxx . . $ software_mixer#Fast_mixer.; |
| 109 | int Fast_mixer_lencxx . . $ software_mixer#Fast_mixer_len.; |
| 110 | int m_primary_alignmentcxx . . $ software_mixer#m_primary_alignment.; |
| 111 | int m_BufferSizecxx . . $ software_mixer#m_BufferSize.; |
| 112 | |
| 113 | uint8_tcxx . . $ uint8_t# *m_buffercxx . . $ software_mixer#m_buffer.; |
| 114 | |
| 115 | int *m_max_sounds_availablecxx . . $ software_mixer#m_max_sounds_available.; |
| 116 | sound_buffer_infocxx . . $ sound_buffer_info# *m_sound_cachecxx . . $ software_mixer#m_sound_cache.; |
| 117 | |
| 118 | void (*m_fpSetErrorcxx . . $ software_mixer#m_fpSetError.)(int code); |
| 119 | void (*m_fpErrorTextcxx . . $ software_mixer#m_fpErrorText.)(const char *fmt, ...); |
| 120 | int *m_error_codecxx . . $ software_mixer#m_error_code.; |
| 121 | }; |
| 122 | |
| 123 | #endif |