Skip to content

Instantly share code, notes, and snippets.

#include <M5Unified.h>
extern const uint8_t wav_with_header[125304];
static constexpr size_t maxRecordTimeMs = 3000; // 最大録音時間[ms]
static constexpr size_t sampleRate = 16000;
static constexpr size_t recordBufferSize = maxRecordTimeMs / 1000 * sampleRate * 2; // maxRecordTime [s] * sampleRate [数/s] * byte数 * (モノラル 1 or ステレオ 2)
static int16_t *recordBuffer;
static size_t recordBufferIndex = 0;
static constexpr size_t bufferLengthPerRecord = 200; // 1回の録音で記録するデータ数 2byte 単位で取得するため 400byte
## CoreBluetoothForUnity をカスタマイズして使いやすくする
using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
//切り替わるオブジェクト
public GameObject blueObject;
public GameObject redObject;
//現在のオブジェクト
using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
public GameObject blueObject;
public GameObject redObject;
private GameObject currentObject;
using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
int currentState = 0; // 0: Blue 1: Red
void Update () {
// state: Blue
int currentState = 0; // 0:Angry 1:Smile
void Update () {
// state : Angry
if (currentState == 0) {
Debug.Log (&quot;Angry!&quot;);
//Smileになる条件
if (Input.GetKeyDown (KeyCode.S)) {
// state : Angry
if (currentState == 0) {
Debug.Log ("Angry!");
//Smileになる条件
if (Input.GetKeyDown (KeyCode.S)) {
currentState = 1;
}
}