Skip to content

Commit

Permalink
修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sigprogramming committed Oct 15, 2023
1 parent 14b9dbf commit 50d5822
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/helpers/singHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function getMeasureDuration(timeSignature: TimeSignature, tpqn: number) {
return tpqn * quarterNotesPerMeasure;
}

// TODO: getNumOfMeasuresに変更する
export function getMeasureNum(notes: Note[], measureDuration: number) {
if (notes.length === 0) {
return 0;
Expand All @@ -30,13 +31,13 @@ export function getNoteDuration(noteType: number, tpqn: number) {
}

export function getNoteTypeInfos(tpqn: number) {
const maxNoteType = 128;
const wholeNoteDuration = tpqn * 4;
const noteTypeInfos: {
noteType: number;
triplet: boolean;
}[] = [];
noteTypeInfos.push({ noteType: 1, triplet: false });
const maxNoteType = 128;
const wholeNoteDuration = tpqn * 4;
for (let noteType = 2; noteType <= maxNoteType; noteType *= 2) {
if (wholeNoteDuration % noteType !== 0) {
break;
Expand Down Expand Up @@ -80,12 +81,10 @@ export function baseYToNoteNumber(baseY: number, integer = true) {
export function getSnapTypeInfos(tpqn: number) {
return getNoteTypeInfos(tpqn)
.filter((value) => value.noteType <= 64)
.map((value) => {
return {
snapType: value.noteType,
triplet: value.triplet,
};
});
.map((value) => ({
snapType: value.noteType,
triplet: value.triplet,
}));
}

export function isValidSnapType(snapType: number, tpqn: number) {
Expand Down

0 comments on commit 50d5822

Please sign in to comment.