diff --git a/README.md b/README.md index b3a2d90..f714b7c 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,16 @@ Also see the [PortAudioBasic](samples/PortAudioBasic/src/PortAudioBasicApp.cpp) ### Enabling Windows ASIO backend -For ASIO support, download ASIO Sdk from the Steinberg website [here](https://www.steinberg.net/en/company/developers.html), unzip and move to a folder at `lib/ASIOSDK`. +For ASIO support on Windows, the simplest approach is to run the included `lib\install_msw_asio.ps1` from a Command Prompt: -Then make sure that the following preprocessor macro is defined in our project: +``` +cd +powershell lib\install_msw_asio.ps1 +``` + +Alternatively, the following can be done by hand. Download the ASIO SDK from the Steinberg website [here](https://www.steinberg.net/en/company/developers.html), unzip, and move to a folder at `lib/ASIOSDK`. + +Then make sure that the following preprocessor macro is defined in your project: ``` PA_USE_ASIO=1 @@ -49,7 +56,7 @@ lib/ASIOSDK/host/pc/asiolist.cpp ##### Enable Unicode Character Set -Most cinder projects are build with Unicode Character Set (Configuration Properties -> General -> Character Set) and to make ASIO compatible with this, you need to add the following line to the top of _lib/ASIOSDK/host/pc/asiolist.cpp_, directly above the <#include "windows.h>`: +Most Cinder projects are build with Unicode Character Set (Configuration Properties -> General -> Character Set) and to make ASIO compatible with this, you need to add the following line to the top of _lib/ASIOSDK/host/pc/asiolist.cpp_, directly above the `<#include "windows.h>`: ``` #undef UNICODE diff --git a/lib/install_msw_asio.ps1 b/lib/install_msw_asio.ps1 new file mode 100644 index 0000000..88107c9 --- /dev/null +++ b/lib/install_msw_asio.ps1 @@ -0,0 +1,20 @@ +if( ! (Test-Path "$PSScriptRoot\ASIOSDK2.3.2.zip" -PathType Leaf) ) { + Write-Host "Downloading ASIO SDK 2.3.2" + iwr -outf "$PSScriptRoot\ASIOSDK2.3.2.zip" http://www.steinberg.net/sdk_downloads/ASIOSDK2.3.2.zip +} + +if( ! (Test-Path "$PSScriptRoot\ASIOSDK" -PathType Container) ) { + Write-Host "Unzipping to lib\ASIOSDK" + Expand-Archive "$PSScriptRoot\ASIOSDK2.3.2.zip" "$PSScriptRoot\temp" + Move-Item $PSScriptRoot\temp\ASIOSDK2.3.2 $PSScriptRoot\ASIOSDK + Remove-Item $PSScriptRoot\temp + Remove-Item $PSScriptRoot\ASIOSDK2.3.2.zip +} + +$asiolistPath = "$PSScriptRoot\ASIOSDK\host\pc\asiolist.cpp" +if( !( Select-String -Pattern "#undef UNICODE" -Path $asiolistPath -Quiet ) ) { + Write-Host "Prepending `"#undef UNICODE`" to asiolist.cpp" + ((Get-Content $asiolistPath -Raw) -replace "#include ", "#undef UNICODE`r`n#include ") | Set-Content -Path $asiolistPath +} + +Write-Host "ASIO SDK downloaded and setup" \ No newline at end of file