Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/bundles/sound/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ export function play_wave(wave: Wave, duration: number): AudioPlayed {
export function play(sound: Sound): AudioPlayed {
// Type-check sound
if (!is_sound(sound)) {
throw new Error(`play is expecting sound, but encountered ${sound}`);
throw new Error(`${play.name} is expecting sound, but encountered ${sound}`);
// If a sound is already playing, terminate execution.
} else if (isPlaying) {
throw new Error('play: audio system still playing previous sound');
throw new Error(`${play.name}: audio system still playing previous sound`);
} else if (get_duration(sound) < 0) {
throw new Error('play: duration of sound is negative');
throw new Error(`${play.name}: duration of sound is negative`);
} else {
// Instantiate audio context if it has not been instantiated.
if (!audioplayer) {
Expand Down Expand Up @@ -424,7 +424,7 @@ export function play_concurrently(sound: Sound): void {
// Type-check sound
if (!is_sound(sound)) {
throw new Error(
`play_concurrently is expecting sound, but encountered ${sound}`,
`${play_concurrently.name} is expecting sound, but encountered ${sound}`,
);
} else if (get_duration(sound) <= 0) {
// Do nothing
Expand Down
8 changes: 4 additions & 4 deletions src/bundles/stereo_sound/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,12 @@ export function play_waves(
export function play(sound: Sound): AudioPlayed {
// Type-check sound
if (!is_sound(sound)) {
throw new Error(`play is expecting sound, but encountered ${sound}`);
throw new Error(`${play.name} is expecting sound, but encountered ${sound}`);
// If a sound is already playing, terminate execution.
} else if (isPlaying) {
throw new Error('play: audio system still playing previous sound');
throw new Error(`${play.name}: audio system still playing previous sound`);
} else if (get_duration(sound) < 0) {
throw new Error('play: duration of sound is negative');
throw new Error(`${play.name}: duration of sound is negative`);
} else {
// Instantiate audio context if it has not been instantiated.
if (!audioplayer) {
Expand Down Expand Up @@ -484,7 +484,7 @@ export function play_concurrently(sound: Sound): void {
// Type-check sound
if (!is_sound(sound)) {
throw new Error(
`play_concurrently is expecting sound, but encountered ${sound}`,
`${play_concurrently.name} is expecting sound, but encountered ${sound}`,
);
} else if (get_duration(sound) <= 0) {
// Do nothing
Expand Down