Skip to content

Commit

Permalink
fix formatting and small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
terryzfeng committed Apr 26, 2024
2 parents bf74ded + b4d952c commit 37c1118
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ export default class Recorder {
};

Recorder.recorder.onstop = async () => {
// Convert buffer to wav blob
const blob = new Blob(Recorder.buffer, {
type: Recorder.recorder.mimeType,
});
const arrayBuffer = await blob.arrayBuffer();
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
const wavBlob = await convertAudioBufferToWavBlob(audioBuffer);

// Get current file and date:time (local)
// Get current filename and local date_time
const filename = ProjectSystem.activeFile
.getFilename()
.slice(0, -3);
Expand All @@ -84,6 +85,7 @@ export default class Recorder {
.replace(/\s/g, "");
const dateTime = `${date}_${time}`;

// Save file
const blobLink = getBlobLink(
wavBlob,
filename + "_" + dateTime + ".wav"
Expand All @@ -99,7 +101,7 @@ export default class Recorder {
static recordPressed() {
const numActiveShreds = VmMonitor.getNumShreds();

// Record FSM
// Record button FSM
switch (Recorder.state) {
case RecordState.stopped:
if (numActiveShreds === 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export async function startChuck() {

// Configure Recorder
recordGain = audioContext.createGain();
recordGain.gain.value = 0.96; // so it doesn't clip
theChuck.connect(recordGain);
recordGain.gain.value = .96; // so it doesn't clip
theChuck.connect(recordGain);
Recorder.configureRecorder(audioContext, recordGain);

// Start HID, mouse and keyboard on
Expand Down

0 comments on commit 37c1118

Please sign in to comment.