Skip to content

Instantly share code, notes, and snippets.

@kshala-ford
kshala-ford / openssl-maker.sh
Last active January 26, 2021 12:26 — forked from letiemble/openssl-maker.sh
A bash script to generate "all-in-one" OpenSSL static libraries for OS X and iOS. The script produces fat static libraries (i386, x86_64 for OS X) and (i386, x86_64, armv7, armv7s, arm64 for iOS) suitable for integration in both OS X and iOS project.
#!/bin/bash
###############################################################################
## ##
## Build and package OpenSSL static libraries for OSX/iOS ##
## ##
## This script is in the public domain. ##
## Creator : Laurent Etiemble ##
## ##
###############################################################################
@kshala-ford
kshala-ford / Language Update.m
Last active November 24, 2020 14:04
Get SDL language from iOS app language
// this method must be added into the class which implements SDLManagerDelegate
// at least you should return an empty object if you support the language.
- (nullable SDLLifecycleConfigurationUpdate *)managerShouldUpdateLifecycleToLanguage:(SDLLanguage)language hmiLanguage:(SDLLanguage)hmiLanguage {
SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] init];
return update;
}
@kshala-ford
kshala-ford / crop_samplebuffer.m
Created February 19, 2019 10:14
Crop a sample buffer to a view and return a pixel buffer
+ (CVPixelBufferRef)croppedPixelBufferFromSampleBuffer:(CMSampleBufferRef)buffer frame:(CGRect)frame {
if (buffer == nil) return nil;
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(buffer);
if (imageBuffer == nil) return nil;
CIImage *ciImage = [CIImage imageWithCVPixelBuffer:imageBuffer];
ciImage = [ciImage imageByCroppingToRect:frame];
CFDictionaryRef empty; // empty value for attr IOSurface
@kshala-ford
kshala-ford / main.m
Last active October 22, 2018 13:54
Use the audio IO manager
// how to create an audio IO manager. You should do this right after the SDL manager is created
self.audioManager = [[SDLAudioIOManager alloc] initWithManager:self.sdlManager delegate:self];
self.audioManager.inputStreamPrompt = [[SDLTTSChunk alloc] initWithText:SDLPrerecordedSpeechListen type:SDLSpeechCapabilitiesPrerecorded];
self.audioManager.inputStreamText = @"Listening...";
// how to start the audio IO manager. Whenever the user presses the mic button on the screen
[self.audioManager startInputStream]; // this is it
// how to stop the audio IO manager if you have recognized user input
[self.audioManager stopInputStream];