Skip to content

Commit

Permalink
Merge pull request #61 from Ritika8081/web-worker
Browse files Browse the repository at this point in the history
Implemented web worker and added support for Giga R1 device.
  • Loading branch information
lorforlinux authored Dec 20, 2024
2 parents 9db53c8 + 854e02c commit 0ffe76d
Show file tree
Hide file tree
Showing 13 changed files with 532 additions and 474 deletions.
18 changes: 13 additions & 5 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// next.config.mjs
export default {
reactStrictMode: true,
output: 'export', // This is key for static export
output: 'export',
images: {
unoptimized: true,
remotePatterns: [
Expand All @@ -11,6 +11,14 @@ const nextConfig = {
},
],
},
webpack(config, { isServer }) {
// If this is the server-side bundle, we don’t need to process worker files
if (!isServer) {
config.module.rules.push({
test: /\.worker\.(js|ts)$/,
use: { loader: 'worker-loader' },
});
}
return config;
},
};
/* module.exports = nextConfig*/
export default nextConfig;
96 changes: 48 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "Chords",
"version": "2.3.0a",
"name": "chords",
"version": "2.3.2a",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
Expand Down Expand Up @@ -39,7 +40,7 @@
"html2canvas": "^1.4.1",
"jszip": "^3.10.1",
"lucide-react": "^0.460.0",
"next": "14.2.10",
"next": "14.2.20",
"next-themes": "^0.3.0",
"react": "^18",
"react-dom": "^18",
Expand Down
2 changes: 1 addition & 1 deletion src/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Link from "next/link";
const FourOFourPage = async () => {
return (
<div className="">
<Navbar />
<Navbar isDisplay={true}/>
<div className="flex flex-col min-h-[85vh] mx-auto justify-center items-center size-full">
<div className="text-center py-10 px-4 sm:px-6 lg:px-8">
<h1 className="text-7xl font-bold sm:text-9xl text-primary">404</h1>
Expand Down
2 changes: 2 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from "react";
import Navbar from "../components/Navbar";
import { Skeleton } from "../components/ui/skeleton";
Expand Down
6 changes: 4 additions & 2 deletions src/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const Canvas = forwardRef(
return samplingRate * 4;
case "fourteen":
return samplingRate * 4;
case "sixteen":
return samplingRate * 4;
default:
return 0; // Or any other fallback value you'd like
}
Expand All @@ -82,7 +84,7 @@ const Canvas = forwardRef(
if (array3DRef.current[activebuffer.current][i].length >= numX) {
array3DRef.current[activebuffer.current][i] = [];
}
array3DRef.current[activebuffer.current][i].push(incomingData[i+1]);
array3DRef.current[activebuffer.current][i].push(incomingData[i + 1]);

if (array3DRef.current[activebuffer.current][i].length < numX && !pauseRef.current) {
array3DRef.current[activebuffer.current][i] = [];
Expand Down Expand Up @@ -289,7 +291,7 @@ const Canvas = forwardRef(
// Use a separate sweep position for each line
currentSweepPos.current[i] = sweepPositions.current[i];
// Plot the new data at the current sweep position
line.setY(currentSweepPos.current[i] % line.numPoints, data[i+1]);
line.setY(currentSweepPos.current[i] % line.numPoints, data[i + 1]);

// Clear the next point to create a gap (optional, for visual effect)
const clearPosition = (currentSweepPos.current[i] + (numX / 100)) % line.numPoints;
Expand Down
Loading

0 comments on commit 0ffe76d

Please sign in to comment.