This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MSHealthBot | |
{ | |
public class Sleep | |
{ | |
public Sleepactivity[] sleepActivities { get; set; } | |
public int itemCount { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Convert floating point audio data in the range -1.0 to 1.0 to signed 16-bit audio data | |
/// and populate the provided stream | |
/// </summary> | |
/// <param name="audioData"></param> | |
/// <param name="stream"></param> | |
/// <returns></returns> | |
int BufferConvertedData(float[] audioData, Stream stream) | |
{ | |
// Can't just do a block copy here as we need to convert from float[-1.0f, 1.0f] to 16bit PCM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task<string> GetTokenAsync() | |
{ | |
string key = "--- YOUR API KEY HERE ---";// Environment.GetEnvironmentVariable("SKYPE_KEY"); | |
if (string.IsNullOrEmpty(key)) | |
{ | |
Debug.Log("Please set an environment variable named 'SKYPE_KEY' to your Skype api key"); | |
return string.Empty; | |
} | |
// First retrieve a time-restricted key to use to access the API (will need to write code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var httpClient = new HttpClient()) | |
{ | |
var response = await httpClient.GetAsync("https://dev.microsofttranslator.com/languages?api-version=1.0&scope=text,tts,speech"); | |
response.EnsureSuccessStatusCode(); | |
var jsonString = await response.Content.ReadAsStringAsync(); | |
dynamic obj = JsonConvert.DeserializeObject(jsonString); | |
// Do some stuff with obj... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
future<shared_ptr<GraphNode>> RootPageViewModel::LoadFileAsync() | |
{ | |
auto fop = ref new FileOpenPicker(); | |
fop->FileTypeFilter->Append(".glb"); | |
fop->FileTypeFilter->Append(".gltf"); | |
auto file = co_await fop->PickSingleFileAsync(); | |
if (file == nullptr) | |
co_return nullptr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <functional> | |
#include "sub_token.h" | |
using namespace std::placeholders; | |
using namespace std; | |
template <typename... Args> | |
class subject | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I can declare a variable like this | |
subject<SceneManager const&> SceneChanged; | |
// subscribe for changes using an arbitrary function signature | |
sub_token RegisterForUpdates(function<void(SceneManager const&)> slot) | |
{ | |
return SceneChanged.subscribe(slot); | |
} | |
// Then when changes happen, notify observers like this.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef HAS_METALROUGHNESSMAP | |
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel. | |
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data | |
float4 mrSample = metallicRoughnessTexture.Sample(metallicRoughnessSampler, input.texcoord); | |
perceptualRoughness = mrSample.g * perceptualRoughness; | |
metallic = mrSample.b * metallic; | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MeshNode::CompileAndLoadPixelShader() | |
{ | |
// Create a shader descriptor which we can use to either find the shader in the | |
// shader cache or create and add it. | |
// The hash used for lookup is generated from the shader name and defines passed | |
// when it is compiled | |
ShaderDescriptor descriptor("pbrpixel.hlsl", DevResources()); | |
auto textures = _material->Textures(); | |
// Allocate the defines map... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void GLTF_Parser::ParseFile(StorageFile^ storageFile) | |
{ | |
// try to get an IStorageItemHandleAccess interface from the StorageFile | |
ComPtr<IUnknown> unknown(reinterpret_cast<IUnknown*>(storageFile)); | |
ComPtr<IStorageItemHandleAccess> fileAccessor; | |
ThrowIfFailed(unknown.As(&fileAccessor)); | |
// Use the IStorageItemHandleAccess::Create method to retrieve an OS HANDLE | |
shared_ptr<void> fileHandle; | |
HANDLE file = nullptr; |
OlderNewer