Skip to content

Commit

Permalink
v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Vareille committed Nov 9, 2017
1 parent fa17029 commit 837614f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions readme.txt
Expand Up @@ -11,9 +11,9 @@ Windows OSX Linux BSD Solaris Minix Raspbian

toot v1.0.5 (c) 2017 Guillaume Vareille http://ysengrin.com zlib licence

void toot(float aFrequence_Hz, int aLength_ms) ;
void toot(float aFrequency_Hz, int aLength_ms) ;

Usage: toot [-f frequence_Hz] [-l length_ms]
Usage: toot [-f frequency_Hz] [-l length_ms]
toot [-v] [--verbose]
toot [-h] [--help]
toot [--version]
Expand All @@ -23,7 +23,7 @@ Example: toot
the release tab contains windows and osx executables

make sure the volume is on (even if some beeps may use the hardware speaker)
if you can't adjust frequence or length (or if there is no beep)
if you can't adjust frequency or length (or if there is no beep)
on osx: you can install sox http://macappstore.org/sox
on unix: you can install pactl or speaker-test or sox

Expand Down
18 changes: 9 additions & 9 deletions toot.c
Expand Up @@ -149,28 +149,28 @@ static int playPresent()

#endif /* UNIX */

void toot(float aFrequence_Hz, int aLength_ms)
void toot(float aFrequency_Hz, int aLength_ms)
{
#ifndef _WIN32
char lDialogString[256];
FILE * lIn;
DIR * lDir;
#endif

aFrequence_Hz = aFrequence_Hz > 0 ? aFrequence_Hz : 440.f;
aFrequency_Hz = aFrequency_Hz > 0 ? aFrequency_Hz : 440.f;
aLength_ms = aLength_ms > 0 ? aLength_ms : 300;

#ifdef _WIN32
if (toot_verbose) printf("windows Beep %dHz %dms\n", (int)aFrequence_Hz, aLength_ms);
Beep((DWORD)aFrequence_Hz, aLength_ms);
if (toot_verbose) printf("windows Beep %dHz %dms\n", (int)aFrequency_Hz, aLength_ms);
Beep((DWORD)aFrequency_Hz, aLength_ms);
#else /* UNIX */

if ( pactlPresent() )
{
/*strcpy( lDialogString , "pactl load-module module-sine frequency=440;sleep .3;pactl unload-module module-sine" ) ;*/
sprintf(lDialogString,
"thnum=$(pactl load-module module-sine frequency=%d);sleep %f;pactl unload-module $thnum",
(int)aFrequence_Hz, aLength_ms / 1000.f);
(int)aFrequency_Hz, aLength_ms / 1000.f);
}
else if ( speakertestPresent() )
{
Expand All @@ -180,23 +180,23 @@ void toot(float aFrequence_Hz, int aLength_ms)
{
sprintf(lDialogString,
"(speaker-test -t sine -f %f > /dev/tty) & pid=$!;sleep %f;kill -9 $pid",
aFrequence_Hz, aLength_ms / 1000.f);
aFrequency_Hz, aLength_ms / 1000.f);
}
else
{
sprintf(lDialogString,
"(speaker-test -t sine -f %f) & pid=$!;sleep %f;kill -9 $pid",
aFrequence_Hz, aLength_ms / 1000.f);
aFrequency_Hz, aLength_ms / 1000.f);
}
}
else if ( beepexePresent() )
{
sprintf(lDialogString, "beep.exe %f %d\n", aFrequence_Hz, aLength_ms);
sprintf(lDialogString, "beep.exe %f %d\n", aFrequency_Hz, aLength_ms);
}
else if ( playPresent() )
{ /* play is part of sox */
sprintf(lDialogString, "play -n -r %d -c1 synth %f sine %f\n",
(int)(2.5f*aFrequence_Hz), aLength_ms/1000.f, aFrequence_Hz);
(int)(2.5f*aFrequency_Hz), aLength_ms/1000.f, aFrequency_Hz);
}
else if ( osascriptPresent() )
{
Expand Down
2 changes: 1 addition & 1 deletion toot.h
Expand Up @@ -34,7 +34,7 @@ extern char toot_version[8] ; /* contains tinyfd current version number */

extern int toot_verbose ; /* 0 (default) or 1 : prints the command line calls */

void toot(float aFrequence_Hz, int aLength_ms) ;
void toot(float aFrequency_Hz, int aLength_ms) ;

#ifdef __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions toot_cmd_line_main.c
Expand Up @@ -44,12 +44,12 @@ int main(int argc, char * argv[])
HANDLE lHStdOut;
#endif
int i;
float lFrequence = 0.f ;
float lFrequency = 0.f ;
int lLength = 0 ;

for (i = 0; i < argc; i++)
{
if (!strcmp(argv[i], "-f")) lFrequence = (float) atof(argv[i + 1]);
if (!strcmp(argv[i], "-f")) lFrequency = (float) atof(argv[i + 1]);
else if (!strcmp(argv[i], "-l")) lLength = atoi(argv[i + 1]);
else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") || !strcmp(argv[i], "--version")
|| !strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose") )
Expand All @@ -76,7 +76,7 @@ int main(int argc, char * argv[])
printf("toot v%s (c) 2017 Guillaume Vareille http://ysengrin.com zlib licence\n", toot_version);
printf("cross-platform library and command line tool to toot \"tooooot\"\n");
printf("OSX Windows Linux BSD Solaris Minix Raspbian\n");
printf("Usage:\ttoot [-f frequence_Hz] [-l length_ms]\n");
printf("Usage:\ttoot [-f frequency_Hz] [-l length_ms]\n");
printf("\ttoot [-v] [--verbose]\n");
printf("\ttoot [-h] [--help]\n");
printf("\ttoot [--version]\n");
Expand All @@ -86,7 +86,7 @@ int main(int argc, char * argv[])
}
}
}
toot( lFrequence , lLength ) ;
toot( lFrequency , lLength ) ;
}

/*
Expand Down

0 comments on commit 837614f

Please sign in to comment.