Skip to content

Commit

Permalink
updated signing scripts, ui now disappears also if mic is active, ove…
Browse files Browse the repository at this point in the history
…rsample mic input (is it really a good idea this way?... why not), updated to latest miniaudio
  • Loading branch information
kritzikratzi committed Jan 25, 2022
1 parent 6ef6c87 commit 30a1839
Show file tree
Hide file tree
Showing 8 changed files with 65,497 additions and 38,591 deletions.
3 changes: 1 addition & 2 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ then
echo "Loading signing/notarization config ..."
source ../../scripts/osx-config.sh
../../scripts/osx-sign.sh "Oscilloscope.app" "$DEVELOPER_IDENTITY" "../../Oscilloscope.entitlements"
../../scripts/osx-notarize.sh "Oscilloscope.app" "org.sd.oscilloscope" "$NOTARIZE_USER" "$NOTARIZE_PASSWORD" "../Oscilloscope-$version-$platform.zip"

../../scripts/osx-notarize.sh "Oscilloscope.app" "org.sd.oscilloscope" "$DEVELOPER_TEAMID" "$ASC_PROVIDER" "$NOTARIZE_USER" "$NOTARIZE_PASSWORD" "../Oscilloscope-$version-$platform.zip"
else
echo "Not signing. If you want to sign, please copy scripts/osx-config-template.sh to scripts/osx-config.sh"
echo "and edit username/password"
Expand Down
8 changes: 6 additions & 2 deletions scripts/osx-config-template.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# You can find the developer id in your keychain (i guess)
# Team-Id and Asc-Provider are shown with this command:
# xcrun altool --list-providers -u [email protected] -p your-app-specific-password
DEVELOPER_IDENTITY="Developer ID Application: hansi raber"
DEVELOPER_TEAMID="ABCD12EF"
ASC_PROVIDER="yourname12341234"

# Apple account user (your email address)
NOTARIZE_USER="invalid@invalid.com"
NOTARIZE_USER="your@apple-account.com"

# An app specific password (generated in your apple account settings)
NOTARIZE_PASSWORD="invalid-password"
NOTARIZE_PASSWORD="your-app-specific-password"
17 changes: 10 additions & 7 deletions scripts/osx-notarize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# otherwise you end up with things in weird places
appFolder="$1"
bundleId="$2"
username="$3"
password="$4"
zipDest="$5"
teamId="$3"
ascProvider="$4"
username="$5"
password="$6"
zipDest="$7"

if [[ -z "$appFolder" || -z "$bundleId" || -z "$username" || -z "$password" || -z "$zipDest" ]]
if [[ -z "$appFolder" || -z "$bundleId" || -z "$username" || -z "$password" || -z "$zipDest" || -z "$teamId" ]]
then
echo "Usage: $0 <application binary> <bundle-id> <username> <password> <zip-destination>"
echo "Usage: $0 <application binary> <bundle-id> <team-id> <asc-provider> <username> <password> <zip-destination>"
exit
fi

Expand All @@ -27,7 +29,8 @@ fi
ditto -c -k --keepParent "$appName.app" "$zipDest"

echo "Uploading for notarization..."
uuid="$(xcrun altool --notarize-app --primary-bundle-id "$bundleId" --username "$username" --password "$password" --file "$zipDest" 2>&1 | grep RequestUUID | cut -d " " -f 3)"
echo xcrun altool -asc-provider $ascProvider --team-id $teamId --notarize-app --primary-bundle-id "$bundleId" --username "$username" --password "$password" --file "$zipDest"
uuid="$(xcrun altool -asc-provider $ascProvider --team-id $teamId --notarize-app --primary-bundle-id "$bundleId" --username "$username" --password "$password" --file "$zipDest" 2>&1 | grep RequestUUID | cut -d " " -f 3)"

if [ -z "$uuid" ]
then
Expand All @@ -39,7 +42,7 @@ fi

while true
do
output="$(xcrun altool --notarization-info "$uuid" -u "$username" -p "$password" 2>&1)"
output="$(xcrun altool --team-id $teamId --notarization-info "$uuid" -u "$username" -p "$password" 2>&1)"
res=$(echo "$output" | grep "Status Message" | xargs | cut -d " " -f 3-99)
if [ -z "$res" ]
then
Expand Down
10 changes: 7 additions & 3 deletions scripts/osx-sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ me=$(dirname $0)

# you might want extra_options="--options=runtime"
# to sign an older binary which needs to be notarized
#extra_options="--options=runtime --entitlements $entitlements "
extra_options="--options=runtime --entitlements $entitlements "


Expand Down Expand Up @@ -82,9 +83,12 @@ signdir() {
done)
}

signdir "Contents/Frameworks/GLUT.framework"
#signdir ffmpeg.mac

find "$app" -name "*.dylib" -type f -print | sort -r \
| ( while read FOO; do
echo "sign dylib: $FOO"
sudo codesign $extra_options -f -s "$signingIdentity" -vvvv "$FOO"
done)

# finally sign $app
sudo codesign $extra_options -s "$signingIdentity" -vvvv --force "$app"
# Now the verification works
Expand Down
19 changes: 14 additions & 5 deletions src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void ofApp::startApplication(){
playDeviceConfig = ma_device_config_init(ma_device_type_playback);
playDeviceConfig.playback.format = ma_format_f32;
playDeviceConfig.playback.channels = 2;
playDeviceConfig.periodSizeInFrames = 0;
playDeviceConfig.periodSizeInFrames = 512;
playDeviceConfig.sampleRate = 0;

playDeviceConfig.dataCallback = [](ma_device* device, void* pOutput, const void* pInput, ma_uint32 frameCount) {
Expand Down Expand Up @@ -220,7 +220,7 @@ void ofApp::update(){
}
}

bool anythingGoingOn = globals.player.isPlaying || exporting>0;
bool anythingGoingOn = globals.player.isPlaying || exporting>0 || globals.micActive;
if( ofGetMousePressed() || !anythingGoingOn){
lastMouseMoved = lastUpdateTime;
}
Expand Down Expand Up @@ -943,13 +943,22 @@ void ofApp::startMic() {
micRight.clear();
micZMod.clear();

auto ma_min_max = [](const ma_device_info & d){
std::pair<int,int> res{1,1};
for(int i = 0; i < d.nativeDataFormatCount; i++){
res.first = min(res.first, (int)d.nativeDataFormats[i].channels);
res.second = max(res.second, (int)d.nativeDataFormats[i].channels);
}
return res;
};

auto info = playerOverlay->getSelectedMicDeviceInfo();
micChannels = info.info.maxChannels;
micChannels = ma_min_max(info.info).second;
micDeviceConfig = ma_device_config_init(info.type);
micDeviceConfig.capture.format = ma_format_f32;
micDeviceConfig.capture.channels = 0;
micDeviceConfig.periodSizeInFrames = 0;
micDeviceConfig.sampleRate = 0;
micDeviceConfig.periodSizeInFrames = 512;
micDeviceConfig.sampleRate = 222222; // oversample? :D
micDeviceConfig.dataCallback = [](ma_device* device, void* pOutput, const void* pInput, ma_uint32 frameCount) {
ofApp * app = (ofApp*)device->pUserData;
app->micChannels = device->capture.channels;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ConfigView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void ConfigView::addDeviceOptions() {
printf("Playback Devices\n");
for (iDevice = 0; iDevice < playbackDeviceCount; ++iDevice) {
ma_device_info dev = pPlaybackDeviceInfos[iDevice];
ma_context_get_device_info(&context, ma_device_type_playback, &dev.id, ma_share_mode_shared, &dev);
ma_context_get_device_info(&context, ma_device_type_playback, &dev.id, &dev);
auto btn = outDevicePicker->addOption(dev.name, dev.name)->button;
btn->setProperty<ma_device_info>(string("ma_device_info"), move(dev));
printf(" %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name);
Expand Down
19 changes: 15 additions & 4 deletions src/ui/PlayerOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,20 @@ void PlayerOverlay::populateMicMenu(FMenu<string> * menu) {
printf("Capture Devices\n");
addDevice("Default Microphone", "", ma_device_info(), ma_device_type_capture);

auto ma_min_max = [](const ma_device_info & d){
std::pair<int,int> res{1,1};
for(int i = 0; i < d.nativeDataFormatCount; i++){
res.first = min(res.first, (int)d.nativeDataFormats[i].channels);
res.second = max(res.second, (int)d.nativeDataFormats[i].channels);
}
return res;
};

for (iDevice = 0; iDevice < captureDeviceCount; ++iDevice) {
ma_device_info dev = pCaptureDeviceInfos[iDevice];
ma_context_get_device_info(&context, ma_device_type_capture, &dev.id, ma_share_mode_shared, &dev);
int ch = max(1, (int)max(dev.minChannels, dev.maxChannels));
ma_context_get_device_info(&context, ma_device_type_capture, &dev.id, &dev);
auto ch_limits = ma_min_max(dev);
int ch = max(1, (int)max(ch_limits.first, ch_limits.second));
addDevice("[" + ofToString(ch) + " ch] " + string(dev.name), dev.name, dev, ma_device_type_capture);
}

Expand All @@ -526,11 +536,12 @@ void PlayerOverlay::populateMicMenu(FMenu<string> * menu) {

for (iDevice = 0; iDevice < playbackDeviceCount; ++iDevice) {
ma_device_info dev = pPlaybackDeviceInfos[iDevice];
ma_context_get_device_info(&context, ma_device_type_capture, &dev.id, ma_share_mode_shared, &dev);
ma_context_get_device_info(&context, ma_device_type_capture, &dev.id, &dev);
// for now only allow loopbacks in wasapi
if (context.backend != ma_backend_wasapi) continue;

int ch = max(1, (int)max(dev.minChannels, dev.maxChannels));
auto ch_limits = ma_min_max(dev);
int ch = max(1, (int)max(ch_limits.first, ch_limits.second));
addDevice("[" + ofToString(ch) + " ch loopback] " + string(dev.name), dev.name, dev, ma_device_type_loopback);
}
}
Expand Down
Loading

0 comments on commit 30a1839

Please sign in to comment.