-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mgrcd-io-fsa): add functions about voices
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./image"; | ||
export * from "./model"; | ||
export * from "./scenario"; | ||
export * from "./voice"; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const voiceDirectoryPath = ["sound_native", "voice"] as const; | ||
const fullVoiceDirectoryPath = ["sound_native", "fullVoice"] as const; | ||
|
||
export async function* getVoiceFiles( | ||
resourceDirectory: FileSystemDirectoryHandle, | ||
) { | ||
const voiceDirectory = await voiceDirectoryPath.reduce( | ||
async (directory, name) => (await directory).getDirectoryHandle(name), | ||
Promise.resolve(resourceDirectory), | ||
); | ||
for await (const [name, entry] of voiceDirectory.entries()) { | ||
if (/\.hca/.test(name) && entry instanceof FileSystemFileHandle) { | ||
yield [name, entry] as [ | ||
name: typeof name, | ||
file: typeof entry, | ||
]; | ||
} | ||
} | ||
} | ||
|
||
export async function* getFullVoiceFiles( | ||
resourceDirectory: FileSystemDirectoryHandle, | ||
) { | ||
const fullVoiceDirectory = await fullVoiceDirectoryPath.reduce( | ||
async (directory, name) => (await directory).getDirectoryHandle(name), | ||
Promise.resolve(resourceDirectory), | ||
); | ||
for await (const [name, entry] of fullVoiceDirectory.entries()) { | ||
if (/\.hca/.test(name) && entry instanceof FileSystemFileHandle) { | ||
yield [name, entry] as [ | ||
name: typeof name, | ||
file: typeof entry, | ||
]; | ||
} | ||
} | ||
} |