Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
577f3695
Commit
577f3695
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Several fixes. Now plays stock .ton files just fine. :-)
parent
05aad3aa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/playtone.js
+14
-25
14 additions, 25 deletions
exec/playtone.js
with
14 additions
and
25 deletions
exec/playtone.js
+
14
−
25
View file @
577f3695
...
...
@@ -4,9 +4,6 @@
const
REVISION
=
"
$Revision$
"
.
split
(
'
'
)[
1
];
const
NOT_ABORTABLE
=
(
1
<<
0
)
const
SHOW_DOT
=
(
1
<<
1
)
const
SHOW_FREQ
=
(
1
<<
2
)
const
NO_VISUAL
=
(
1
<<
3
)
var
mode
=
0
;
/* Optional modes */
...
...
@@ -30,19 +27,19 @@ function play(freq, dur)
dur
=
"
0
"
;
d
=
parseInt
(
dur
);
if
((
f
=
parseInt
(
freq
))
!=
0
)
if
(
isNaN
(
f
=
parseInt
(
freq
.
charAt
(
0
)))
)
switch
(
freq
.
charAt
(
0
).
toUpperCase
())
{
case
'
O
'
:
/* default octave */
if
(
parseInt
(
dur
))
if
(
Number
(
dur
.
charAt
(
0
)
))
octave
=
d
;
else
octave
+=
d
;
return
;
case
'
P
'
:
/* pitch variation */
if
(
parseInt
(
dur
))
pitch
=
at
of
(
dur
)
/
32.0
;
if
(
Number
(
dur
.
charAt
(
0
)
))
pitch
=
parseFlo
at
(
dur
)
/
32.0
;
else
pitch
+=
at
of
(
dur
);
pitch
+=
parseFlo
at
(
dur
);
return
;
case
'
Q
'
:
/* quit */
exit
(
0
);
...
...
@@ -50,7 +47,7 @@ function play(freq, dur)
f
=
0
;
break
;
case
'
S
'
:
/* stacato */
if
(
parseInt
(
dur
))
if
(
Number
(
dur
.
charAt
(
0
)
))
s
=
d
;
else
s
+=
d
;
...
...
@@ -63,7 +60,7 @@ function play(freq, dur)
return
;
truncsp
(
dur
);
if
(
dur
.
charAt
(
dur
.
length
-
1
)
==
'
\\
'
)
write
(
dur
);
write
(
truncstr
(
dur
,
'
\\
'
)
);
else
writeln
(
dur
);
return
;
...
...
@@ -81,14 +78,6 @@ function play(freq, dur)
break
;
}
if
(
f
&&
mode
&
SHOW_FREQ
)
{
for
(
i
=
0
;
freq
[
i
]
>
'
'
;
i
++
)
;
freq
[
i
]
=
0
;
printf
(
"
%-4.4s
"
,
freq
);
}
if
(
mode
&
SHOW_DOT
)
printf
(
"
.
"
);
if
(
t
>
10
)
len
=
(
d
*
t
)
-
(
d
*
s
);
else
...
...
@@ -108,10 +97,10 @@ function play(freq, dur)
}
printf
(
"
\n
Tone Generation Module
%s
Copyright 2003 Rob Swindell
\n\n
"
,
REVISION
);
printf
(
"
\n
Synchronet
Tone Generation Module %s
\n\n
"
,
REVISION
);
if
(
argc
<
1
)
{
alert
(
"
!
No filename specified
"
);
alert
(
"
No filename specified
"
);
exit
();
}
...
...
@@ -120,7 +109,7 @@ if(!file.exists)
file
.
name
=
system
.
exec_dir
+
file
.
name
;
writeln
(
"
Opening
"
+
file
.
name
);
if
(
!
file
.
open
(
"
r
"
))
{
alert
(
"
!
Error
"
+
file
.
error
+
"
opening
"
+
file
.
name
);
alert
(
"
Error
"
+
file
.
error
+
"
opening
"
+
file
.
name
);
exit
();
}
...
...
@@ -131,9 +120,9 @@ for(i in text) {
if
(
js
.
terminated
)
break
;
// writeln(text[i]);
token
=
text
[
i
].
split
(
/
\s
+/
);
c
md
=
token
[
0
]
;
token
.
shift
(
);
play
(
cmd
,
token
.
join
(
'
'
));
if
(
text
[
i
].
charAt
(
0
)
==
'
:
'
)
/* comment */
c
ontinue
;
token
=
truncsp
(
text
[
i
]).
split
(
/
\s
+/
);
play
(
token
.
shift
()
,
token
.
join
(
'
'
));
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment