This file contains 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 <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 |
This file contains 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
## CoreBluetoothForUnity をカスタマイズして使いやすくする |
This file contains 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 UnityEngine; | |
using System.Collections; | |
public class PlayerScript : MonoBehaviour { | |
//切り替わるオブジェクト | |
public GameObject blueObject; | |
public GameObject redObject; | |
//現在のオブジェクト |
This file contains 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 UnityEngine; | |
using System.Collections; | |
public class PlayerScript : MonoBehaviour { | |
public GameObject blueObject; | |
public GameObject redObject; | |
private GameObject currentObject; |
This file contains 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 UnityEngine; | |
using System.Collections; | |
public class PlayerScript : MonoBehaviour { | |
int currentState = 0; // 0: Blue 1: Red | |
void Update () { | |
// state: Blue |
This file contains 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
int currentState = 0; // 0:Angry 1:Smile | |
void Update () { | |
// state : Angry | |
if (currentState == 0) { | |
Debug.Log ("Angry!"); | |
//Smileになる条件 | |
if (Input.GetKeyDown (KeyCode.S)) { |
This file contains 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
// state : Angry | |
if (currentState == 0) { | |
Debug.Log ("Angry!"); | |
//Smileになる条件 | |
if (Input.GetKeyDown (KeyCode.S)) { | |
currentState = 1; | |
} | |
} |