Skip to content

Commit

Permalink
Merge branch 'master' into sanitizeBrowseableMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
seanbudd authored Jan 15, 2025
2 parents 6fad00c + 0a31499 commit 719bb3f
Show file tree
Hide file tree
Showing 37 changed files with 3,269 additions and 468 deletions.
2 changes: 1 addition & 1 deletion include/espeak
Submodule espeak updated 72 files
+13 −0 .github/dependabot.yml
+3 −3 .github/workflows/android.yml
+4 −4 .github/workflows/autoconf.yml
+11 −7 .github/workflows/ci.yml
+5 −5 .github/workflows/dist.yml
+6 −6 .github/workflows/fuzzing.yml
+2 −2 .github/workflows/gradle-wrapper-validation.yml
+43 −0 .github/workflows/windows-msbuild.yml
+2 −2 .github/workflows/windows.yml
+3 −0 .gitignore
+0 −18 .travis.yml
+1 −1 CMakeLists.txt
+12 −1 ChangeLog.md
+6 −0 README.md
+2 −2 android/AndroidManifest.xml
+1 −1 android/build.gradle
+1 −1 android/jni/include/config.h
+1 −1 configure.ac
+1 −0 dictsource/ca_emoji
+18,839 −211 dictsource/ca_list
+1,141 −159 dictsource/ca_rules
+50 −50 dictsource/cs_emoji
+2 −0 dictsource/de_list
+80 −0 dictsource/en_list
+53 −1 dictsource/en_rules
+466 −14 dictsource/extra/ru_listx
+32 −1 dictsource/fa_list
+10 −4 dictsource/he_list
+31 −0 dictsource/he_listx
+447 −32 dictsource/he_rules
+473 −40 dictsource/hu_rules
+31 −2 dictsource/nl_list
+625 −76 dictsource/pt_list
+1 −0 dictsource/ru_list
+0 −7 docs/add_language.md
+1 −1 docs/building.md
+5 −0 espeak-ng-data/lang/gmw/en-Shaw
+2 −0 espeak-ng-data/lang/roa/ca
+7 −0 espeak-ng-data/lang/roa/ca-ba
+6 −0 espeak-ng-data/lang/roa/ca-nw
+7 −0 espeak-ng-data/lang/roa/ca-va
+4 −0 phsource/mbrola/de6
+457 −12 phsource/ph_catalan
+490 −0 phsource/ph_catalan_ba
+160 −0 phsource/ph_catalan_nw
+282 −0 phsource/ph_catalan_va
+9 −1 phsource/phonemes
+1 −1 src/espeak-ng.c
+1 −1 src/include/espeak-ng/speak_lib.h
+36 −2 src/libespeak-ng/dictionary.c
+1 −0 src/libespeak-ng/dictionary.h
+2 −0 src/libespeak-ng/encoding.c
+21 −0 src/libespeak-ng/mbrowrap.c
+2 −0 src/libespeak-ng/readclause.c
+5 −0 src/libespeak-ng/spect.c
+1 −1 src/libespeak-ng/speech.h
+9 −1 src/libespeak-ng/ssml.c
+11 −5 src/libespeak-ng/synthesize.c
+3 −1 src/libespeak-ng/tr_languages.c
+3 −2 src/libespeak-ng/translate.c
+1 −1 src/libespeak-ng/translate.h
+2 −1 src/libespeak-ng/voices.c
+1 −1 src/libespeak-ng/wavegen.c
+3 −0 src/ucd-tools/CMakeLists.txt
+1 −1 src/windows/config.h
+4 −1 src/windows/data.vcxproj
+2 −2 tests/api.c
+5 −1 tests/language-phonemes.test
+9 −4 tests/language-pronunciation.test
+0 −1 tests/ssml/external-entity.expected
+0 −1 tests/ssml/spec-example-1.expected
+6 −0 tests/translate.test
8 changes: 4 additions & 4 deletions include/espeak.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Modifications will need to be made in [`nvdaHelper/espeak/sconscript`](../nvdaHe
1. Update our record of the version number and build.
1. Change back to the NVDA repo root
1. Update the `/DPACKAGE_VERSION` in [`nvdaHelper/espeak/sconscript`](../nvdaHelper/espeak/sconscript)
*-* The preprocessor definition is used to supply these definitions instead of [`nvdaHelper/espeak/config.h`](../nvdaHelper/espeak/config.h)
*-* [`nvdaHelper/espeak/config.h`](../nvdaHelper/espeak/config.h) must exist (despite being empty) since a "config.h" is included within eSpeak.
*-* Compare to eSpeak source config: [`include/espeak/src/windows/config.h`](./espeak/src/windows/config.h).
*-* Diff `src/windows/config.h` with the previous commit.
* The preprocessor definition is used to supply these definitions instead of [`nvdaHelper/espeak/config.h`](../nvdaHelper/espeak/config.h)
* [`nvdaHelper/espeak/config.h`](../nvdaHelper/espeak/config.h) must exist (despite being empty) since a "config.h" is included within eSpeak.
* Compare to eSpeak source config: [`include/espeak/src/windows/config.h`](./espeak/src/windows/config.h).
* Diff `src/windows/config.h` with the previous commit.
1. Update NVDA's [dev environment documentation](../projectDocs/dev/createDevEnvironment.md#git-submodules) and [changelog](../user_docs/en/changes.md) with eSpeak version and commit.
1. Build NVDA: `scons source`
* Expected warnings from eSpeak compilation:
Expand Down
2 changes: 1 addition & 1 deletion nvdaHelper/espeak/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ env.Append(
# Ignore all warnings as the code is not ours.
"/W0",
# Preprocessor definitions. Migrated from 'nvdaHelper/espeak/config.h'
'/DPACKAGE_VERSION=\\"1.52-dev 961454ff\\"', # See 'include/espeak/src/windows/config.h'
'/DPACKAGE_VERSION=\\"1.52.0\\"', # See 'include/espeak/src/windows/config.h'
"/DHAVE_STDINT_H=1",
"/D__WIN32__#1",
"/DLIBESPEAK_NG_EXPORT",
Expand Down
90 changes: 45 additions & 45 deletions nvdaHelper/local/wasapi.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This file is a part of the NVDA project.
URL: http://www.nvda-project.org/
Copyright 2023 James Teh.
Copyright 2023-2024 NV Access Limited, James Teh.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2.0, as published by
the Free Software Foundation.
Expand Down Expand Up @@ -45,6 +45,7 @@ const IID IID_IMMNotificationClient = __uuidof(IMMNotificationClient);
const IID IID_IAudioStreamVolume = __uuidof(IAudioStreamVolume);
const IID IID_IAudioSessionManager2 = __uuidof(IAudioSessionManager2);
const IID IID_IAudioSessionControl2 = __uuidof(IAudioSessionControl2);
const IID IID_IMMEndpoint = __uuidof(IMMEndpoint);

/**
* C++ RAII class to manage the lifecycle of a standard Windows HANDLE closed
Expand Down Expand Up @@ -167,9 +168,9 @@ class WasapiPlayer {

/**
* Constructor.
* Specify an empty (not null) deviceName to use the default device.
* Specify an empty (not null) endpointId to use the default device.
*/
WasapiPlayer(wchar_t* deviceName, WAVEFORMATEX format,
WasapiPlayer(wchar_t* endpointId, WAVEFORMATEX format,
ChunkCompletedCallback callback);

/**
Expand Down Expand Up @@ -229,7 +230,7 @@ class WasapiPlayer {
CComPtr<IAudioClock> clock;
// The maximum number of frames that will fit in the buffer.
UINT32 bufferFrames;
std::wstring deviceName;
std::wstring endpointId;
WAVEFORMATEX format;
ChunkCompletedCallback callback;
PlayState playState = PlayState::stopped;
Expand All @@ -246,9 +247,9 @@ class WasapiPlayer {
bool isUsingPreferredDevice = false;
};

WasapiPlayer::WasapiPlayer(wchar_t* deviceName, WAVEFORMATEX format,
WasapiPlayer::WasapiPlayer(wchar_t* endpointId, WAVEFORMATEX format,
ChunkCompletedCallback callback)
: deviceName(deviceName), format(format), callback(callback) {
: endpointId(endpointId), format(format), callback(callback) {
wakeEvent = CreateEvent(nullptr, false, false, nullptr);
}

Expand All @@ -266,7 +267,7 @@ HRESULT WasapiPlayer::open(bool force) {
}
CComPtr<IMMDevice> device;
isUsingPreferredDevice = false;
if (deviceName.empty()) {
if (endpointId.empty()) {
hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &device);
} else {
hr = getPreferredDevice(device);
Expand Down Expand Up @@ -491,48 +492,47 @@ HRESULT WasapiPlayer::getPreferredDevice(CComPtr<IMMDevice>& preferredDevice) {
if (FAILED(hr)) {
return hr;
}
CComPtr<IMMDeviceCollection> devices;
hr = enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &devices);
CComPtr<IMMDevice> device;
hr = enumerator->GetDevice(endpointId.c_str(), &device);
if (FAILED(hr)) {
return hr;
}
UINT count = 0;
devices->GetCount(&count);
for (UINT d = 0; d < count; ++d) {
CComPtr<IMMDevice> device;
hr = devices->Item(d, &device);
if (FAILED(hr)) {
return hr;
}
CComPtr<IPropertyStore> props;
hr = device->OpenPropertyStore(STGM_READ, &props);
if (FAILED(hr)) {
return hr;
}
PROPVARIANT val;
hr = props->GetValue(PKEY_Device_FriendlyName, &val);
if (FAILED(hr)) {
return hr;
}
// WinMM device names are truncated to MAXPNAMELEN characters, including the
// null terminator.
constexpr size_t MAX_CHARS = MAXPNAMELEN - 1;
if (wcsncmp(val.pwszVal, deviceName.c_str(), MAX_CHARS) == 0) {
PropVariantClear(&val);
preferredDevice = std::move(device);
return S_OK;
}
PropVariantClear(&val);

// We only want to use the device if it is plugged in and enabled.
DWORD state;
hr = device->GetState(&state);
if (FAILED(hr)) {
return hr;
} else if (state != DEVICE_STATE_ACTIVE) {
return E_NOTFOUND;
}
return E_NOTFOUND;

// We only want to use the device if it is an output device.
IMMEndpoint* endpoint;
hr = device->QueryInterface(IID_IMMEndpoint, (void**)&endpoint);
if (FAILED(hr)) {
return hr;
}
EDataFlow dataFlow;
hr = endpoint->GetDataFlow(&dataFlow);
if (FAILED(hr)) {
return hr;
} else if (dataFlow != eRender) {
return E_NOTFOUND;
}
preferredDevice = std::move(device);
endpoint->Release();
device.Release();
enumerator.Release();
return S_OK;
}

bool WasapiPlayer::didPreferredDeviceBecomeAvailable() {
if (
// We're already using the preferred device.
isUsingPreferredDevice ||
// A preferred device was not specified.
deviceName.empty() ||
endpointId.empty() ||
// A device hasn't recently changed state.
deviceStateChangeCount == notificationClient->getDeviceStateChangeCount()
) {
Expand Down Expand Up @@ -673,7 +673,7 @@ HRESULT WasapiPlayer::disableCommunicationDucking(IMMDevice* device) {
*/
class SilencePlayer {
public:
SilencePlayer(wchar_t* deviceName);
SilencePlayer(wchar_t* endpointId);
HRESULT init();
// Play silence for the specified duration.
void playFor(DWORD ms, float volume);
Expand All @@ -698,8 +698,8 @@ class SilencePlayer {
std::vector<INT16> whiteNoiseData;
};

SilencePlayer::SilencePlayer(wchar_t* deviceName):
player(deviceName, getFormat(), nullptr),
SilencePlayer::SilencePlayer(wchar_t* endpointId):
player(endpointId, getFormat(), nullptr),
whiteNoiseData(
SILENCE_BYTES / (
sizeof(INT16) / sizeof(unsigned char)
Expand Down Expand Up @@ -791,10 +791,10 @@ void SilencePlayer::terminate() {
* WasapiPlayer or SilencePlayer, with the exception of wasPlay_startup.
*/

WasapiPlayer* wasPlay_create(wchar_t* deviceName, WAVEFORMATEX format,
WasapiPlayer* wasPlay_create(wchar_t* endpointId, WAVEFORMATEX format,
WasapiPlayer::ChunkCompletedCallback callback
) {
return new WasapiPlayer(deviceName, format, callback);
return new WasapiPlayer(endpointId, format, callback);
}

void wasPlay_destroy(WasapiPlayer* player) {
Expand Down Expand Up @@ -855,9 +855,9 @@ HRESULT wasPlay_startup() {

SilencePlayer* silence = nullptr;

HRESULT wasSilence_init(wchar_t* deviceName) {
HRESULT wasSilence_init(wchar_t* endpointId) {
assert(!silence);
silence = new SilencePlayer(deviceName);
silence = new SilencePlayer(endpointId);
return silence->init();
}

Expand Down
2 changes: 1 addition & 1 deletion projectDocs/dev/createDevEnvironment.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ If you aren't sure, run `git submodule update` after every git pull, merge or ch

#### Run time dependencies

* [eSpeak NG](https://github.com/espeak-ng/espeak-ng), version 1.52-dev commit `961454ffaa894d981526f4d424daef1d3bc4175f`
* [eSpeak NG](https://github.com/espeak-ng/espeak-ng), version 1.52.0
* [Sonic](https://github.com/waywardgeek/sonic), commit `8694c596378c24e340c09ff2cd47c065494233f1`
* [IAccessible2](https://wiki.linuxfoundation.org/accessibility/iaccessible2/start), commit `3d8c7f0b833453f761ded6b12d8be431507bfe0b`
* [liblouis](http://www.liblouis.io/), version 3.31.0
Expand Down
Loading

0 comments on commit 719bb3f

Please sign in to comment.