Skip to content

Missing External Libraries; Updated Audio.cpp to use new MiniAudio API #90

Closed
@bipucrucla

Description

@bipucrucla

Hello.
I don't know how to use Github so I'm not sure how to contribute fixes but to compile the v0.12.18 release from source on linux, I needed to do the following:

Added: jsmn, lodepng, miniaudiom, and stb external libraries to lib folder

In ui/Audio.cpp:

Changed all instances of ma_sine_wave() to ma_waveform()
Changed ma_sine_wave_read_f32(&waveform, frameCount, pOutput) -> ma_waveform_read_pcm_frames(&waveform, pOutput, frameCount)

Replaced ma_waveform_init(volume / 100.0, frequency, DEFAULT_SAMPLE_RATE, _tone) ->
ma_waveform_config config = ma_waveform_config_init(DEFAULT_FORMAT, DEFAULT_CHANNELS, DEFAULT_SAMPLE_RATE, ma_waveform_type_sine, volume / 100.0, frequency);
ma_waveform_init(&config, _tone);

Fixed typo: ma_sine_wave_rad_f32() -> ma_sine_wave_read_f32()

See MiniAudio documentation below:

The ma_sine_wave API has been replaced with a more general API called ma_waveform. This supports generation of different types of waveforms, including
sine, square, triangle and sawtooth. Use ma_waveform_init() in place of ma_sine_wave_init() to initialize the waveform object. This takes a configuration
object called ma_waveform_config which defines the properties of the waveform. Use ma_waveform_config_init() to initialize a ma_waveform_config object.
Use ma_waveform_read_pcm_frames() in place of ma_sine_wave_read_f32() and ma_sine_wave_read_f32_ex().

...

ma_waveform_read_pcm_frames(&waveform, pOutput, frameCount);

ma_waveform_config config = ma_waveform_config_init(FORMAT, CHANNELS, SAMPLE_RATE, ma_waveform_type_sine, amplitude, frequency);

ma_waveform waveform;
ma_result result = ma_waveform_init(&config, &waveform);
if (result != MA_SUCCESS) {
    // Error.
}

...

It compiles fine afterwards (SDL build) and the SOUND keyword works as expected.

Thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions