Skip to content

Commit 2c90fcf

Browse files
committed
Merge branch 'dev/windows_fixes' into dev/restructure
2 parents a45f6b9 + f3db5d5 commit 2c90fcf

16 files changed

Lines changed: 133 additions & 58 deletions

File tree

cmake/yup_modules.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,9 @@ function (yup_add_module module_path modules_definitions module_group)
735735

736736
# ==== Fetch Python if needed
737737
if (module_needs_python)
738-
if (NOT YUP_BUILD_WHEEL)
738+
if (YUP_ENABLE_STATIC_PYTHON_LIBS)
739+
list (APPEND module_libs ${Python_LIBRARIES})
740+
elseif (NOT YUP_BUILD_WHEEL)
739741
list (APPEND module_libs Python::Python)
740742
if (YUP_PLATFORM_MAC)
741743
list (APPEND module_link_options "-Wl,-weak_reference_mismatches,weak")

cmake/yup_python.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function (yup_prepare_python_stdlib target_name python_tools_path output_variabl
4040
set (python_embeddable_url "https://www.python.org/ftp/python/${python_version_string}/python-${python_version_string}-embed-amd64.zip")
4141
FetchContent_Declare (python_embed_env URL ${python_embeddable_url})
4242
if (NOT python_embed_env_POPULATED)
43-
FetchContent_Populate(python_embed_env)
43+
FetchContent_MakeAvailable (python_embed_env)
4444
endif()
4545

4646
get_filename_component (python_root_path "${python_embed_env_SOURCE_DIR}" REALPATH)

cmake/yup_standalone.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,11 @@ function (yup_standalone_app)
228228
${additional_libraries}
229229
${YUP_ARG_MODULES})
230230

231+
# ==== Post build steps, workaround for python*.dll
232+
if ("yup::yup_python" IN_LIST YUP_ARG_MODULES AND YUP_PLATFORM_WINDOWS AND NOT YUP_ENABLE_STATIC_PYTHON_LIBS AND Python_RUNTIME_LIBRARY_RELEASE)
233+
add_custom_command (TARGET ${target_name} POST_BUILD
234+
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${Python_RUNTIME_LIBRARY_RELEASE}" "$<TARGET_FILE_DIR:${target_name}>"
235+
COMMENT "Copying Python DLL next to executable")
236+
endif()
237+
231238
endfunction()

examples/graphics/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ endif()
4848

4949
# ==== Prepare target
5050
set (additional_modules "")
51-
if (YUP_PLATFORM_DESKTOP)
51+
if (YUP_PLATFORM_DESKTOP AND NOT YUP_PLATFORM_WINDOWS)
5252
set (additional_modules yup::yup_python)
5353
endif()
5454

examples/graphics/source/examples/Audio.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ class AudioExample
364364
slider->setRange (0.0f, 1.0f);
365365
slider->setDefaultValue (0.0f);
366366

367-
slider->onValueChanged = [this, i] (float value)
367+
slider->onValueChanged = [this, i] (double value)
368368
{
369-
harmonicSynth.setHarmonicAmplitude (i, value * 0.4f); // Scale down to prevent clipping
369+
harmonicSynth.setHarmonicAmplitude (i, (float) value * 0.4f); // Scale down to prevent clipping
370370
};
371371

372372
addAndMakeVisible (slider);
@@ -410,9 +410,9 @@ class AudioExample
410410
volumeSlider->setRange ({ 0.0f, 1.0f });
411411
volumeSlider->setDefaultValue (0.5f);
412412

413-
volumeSlider->onValueChanged = [this] (float value)
413+
volumeSlider->onValueChanged = [this] (double value)
414414
{
415-
masterVolume = value;
415+
masterVolume = (float) value;
416416
};
417417
volumeSlider->setValue (0.5f); // Set initial volume to 50%
418418
addAndMakeVisible (*volumeSlider);

examples/graphics/source/examples/ConvolutionDemo.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ class ConvolutionDemo
353353

354354
wetGainSlider.setRange (0.0, 2.0);
355355
wetGainSlider.setValue (1.0);
356-
wetGainSlider.onValueChanged = [this] (float value)
356+
wetGainSlider.onValueChanged = [this] (double value)
357357
{
358-
wetGain.setTargetValue (value);
358+
wetGain.setTargetValue ((float) value);
359359
};
360360
addAndMakeVisible (wetGainSlider);
361361

@@ -366,9 +366,9 @@ class ConvolutionDemo
366366

367367
dryGainSlider.setRange (0.0, 2.0);
368368
dryGainSlider.setValue (0.3);
369-
dryGainSlider.onValueChanged = [this] (float value)
369+
dryGainSlider.onValueChanged = [this] (double value)
370370
{
371-
dryGain.setTargetValue (value);
371+
dryGain.setTargetValue ((float) value);
372372
};
373373
addAndMakeVisible (dryGainSlider);
374374

@@ -422,6 +422,9 @@ class ConvolutionDemo
422422

423423
// Create waveform data points
424424
const size_t numPoints = std::min (static_cast<size_t> (getWidth()), length);
425+
if (numPoints == 0)
426+
return;
427+
425428
const size_t stride = length / numPoints;
426429

427430
std::vector<yup::Point<double>> waveformData;

examples/graphics/source/examples/CrossoverDemo.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ class CrossoverDemo : public yup::Component
309309
freqSlider.setSkewFactorFromMidpoint (1000.0);
310310
freqSlider.setValue (1000.0);
311311
//freqSlider.setTextValueSuffix (" Hz");
312-
freqSlider.onValueChanged = [this] (float value)
312+
freqSlider.onValueChanged = [this] (double value)
313313
{
314-
crossoverFreq.setTargetValue (value);
314+
crossoverFreq.setTargetValue ((float) value);
315315
setCrossoverFrequency (value);
316316
};
317317
addAndMakeVisible (freqSlider);
@@ -326,9 +326,9 @@ class CrossoverDemo : public yup::Component
326326
lowGainSlider.setRange (0.0, 2.0);
327327
lowGainSlider.setValue (1.0);
328328
//lowGainSlider.setTextValueSuffix (" x");
329-
lowGainSlider.onValueChanged = [this] (float value)
329+
lowGainSlider.onValueChanged = [this] (double value)
330330
{
331-
lowGain.setTargetValue (value);
331+
lowGain.setTargetValue ((float) value);
332332
};
333333
addAndMakeVisible (lowGainSlider);
334334

@@ -342,9 +342,9 @@ class CrossoverDemo : public yup::Component
342342
highGainSlider.setRange (0.0, 2.0);
343343
highGainSlider.setValue (1.0);
344344
//highGainSlider.setTextValueSuffix (" x");
345-
highGainSlider.onValueChanged = [this] (float value)
345+
highGainSlider.onValueChanged = [this] (double value)
346346
{
347-
highGain.setTargetValue (value);
347+
highGain.setTargetValue ((float) value);
348348
};
349349
addAndMakeVisible (highGainSlider);
350350

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ ninja PROFILING="OFF":
3232

3333
[doc("generate and open project in Windows using Visual Studio")]
3434
win PROFILING="OFF":
35-
cmake -G "Visual Studio 17 2022" -B build -DYUP_ENABLE_PROFILING={{PROFILING}}
36-
-start build/yup.sln
35+
cmake -G "Visual Studio 18 2026" -B build -DYUP_ENABLE_PROFILING={{PROFILING}}
36+
-start build/yup.slnx
3737

3838
[doc("generate project in Linux using Ninja")]
3939
linux PROFILING="OFF":

modules/yup_audio_formats/formats/yup_WaveAudioFormat.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,12 @@ Array<String> WaveAudioFormat::getFileExtensions (Mode handleMode) const
487487
{
488488
switch (handleMode)
489489
{
490-
case Mode::forReading:
491-
return { ".wav", ".wave", ".bwf" };
492490
case Mode::forWriting:
493491
return { ".wav" };
492+
493+
case Mode::forReading:
494+
default:
495+
return { ".wav", ".wave", ".bwf" };
494496
}
495497
}
496498

modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,10 @@ class MediaFoundationInputByteStream final : public IMFByteStream
248248
}
249249

250250
asyncResult->SetStatus (hr);
251+
252+
// Use MFInvokeCallback to queue the callback on a work queue thread
251253
if (pCallback != nullptr)
252-
pCallback->Invoke (asyncResult);
254+
MFInvokeCallback (asyncResult);
253255

254256
asyncResult->Release();
255257
asyncState->Release();
@@ -527,8 +529,10 @@ class MediaFoundationOutputByteStream final : public IMFByteStream
527529
}
528530

529531
asyncResult->SetStatus (hr);
532+
533+
// Use MFInvokeCallback to queue the callback on a work queue thread
530534
if (pCallback != nullptr)
531-
pCallback->Invoke (asyncResult);
535+
MFInvokeCallback (asyncResult);
532536

533537
asyncResult->Release();
534538
asyncState->Release();

0 commit comments

Comments
 (0)