File aldo-0.7.8.obscpio of Package aldo
07070100000000000081A400000000000000000000000151E5218700000041000000000000000000000000000000000000001300000000aldo-0.7.8/AUTHORSGiuseppe "denever" Martino IZ8EQD <denever@users.sourceforge.net>070701000000010000A1FF00000000000000000000000151E5218700000020000000000000000000000000000000000000001300000000aldo-0.7.8/COPYING/usr/share/automake-1.11/COPYING07070100000002000081A400000000000000000000000151E5218700006AC2000000000000000000000000000000000000001500000000aldo-0.7.8/ChangeLog2012-03-31 13:42 Giuseppe Martino <denever@users.sourceforge.net>
* Added suggestion from Hannes Jochriem to print chars before koch
* Added patch from Jeremy W. Sherman to fix crash due to changes in libao
* Relased aldo 0.7.7
2009-01-16 17:42 Giuseppe Martino <denever@users.sourceforge.net>
* Added soundcard selection patch from Corey Minyard.
* Added a patch from Sam "SammytheSnake" Penny that adds support to upper-case and punctuation characters
* Added patch from Corey Minyard that changes default koch sequence
* Released aldo 0.7.6
2007-11-05 10:00 Giuseppe Martino <denever@users.sourceforge.net>
* Released aldo 0.7.5
2007-11-05 09:53 Giuseppe Martino <denever@users.sourceforge.net>
* configure.ac: Committed Diane VA3DB's patch
2007-10-03 19:54 Giuseppe Martino <denever@users.sourceforge.net>
* src/audioworkspace.cc: Committed Diane VA3DB's patch
2007-08-19 15:36 Giuseppe Martino <denever@users.sourceforge.net>
* src/: blocks.cc, keyer.cc, koch.cc, setup.cc, wave.cc: Removed
unused #include <iostream>
2007-07-01 09:25 Giuseppe Martino <denever@users.sourceforge.net>
* THANKS, src/audioworkspace.cc: Committed Jan-Simon Möller's
patch to smoth of audio output in aldo
2007-06-29 10:48 Giuseppe Martino <denever@users.sourceforge.net>
* src/main.cc: Added #include <cstdlib> in main.cc
2007-05-19 10:37 Giuseppe Martino <denever@users.sourceforge.net>
* debian/: control, copyright, docs: Update debian package info
2007-05-19 10:35 Giuseppe Martino <denever@users.sourceforge.net>
* include/koch.hh, src/koch.cc, src/koch_exc.cc, src/setup.cc:
Change Koch method difficulty advancing
2007-05-16 11:52 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, VERSION, configure.ac, src/textfile_exc.cc: Released
0.7.4
2007-05-16 11:43 Giuseppe Martino <denever@users.sourceforge.net>
* include/dialog.hh, src/check.cc, src/menu.cc, src/setup.cc,
src/textfile_exc.cc: Fixed EOF bug also in check.cc, setup.cc,
textfile_exc.cc
2007-05-16 11:13 Giuseppe Martino <denever@users.sourceforge.net>
* include/koch.hh, src/koch_exc.cc: (bug #19741) Fixed. Koch method
skill is never saved. Fixing this bug I discovered that aldo
doesn't save also speed, number of string, number of chars.
2007-05-16 10:50 Giuseppe Martino <denever@users.sourceforge.net>
* include/dialog.hh, src/menu.cc: (bug #19742) Fixed. EOF on
standard input sends program into infinite loop
2007-05-04 12:27 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog: Updated ChangeLog
2007-04-30 00:48 Thomas Herlea <maxthomax>
* src/check.cc: Put feedback legend for per-symbol statistics
between double quotes and separated it from the stats with an
empty line.
2007-04-30 00:44 Thomas Herlea <maxthomax>
* src/check.cc: Fixed the division by zero that could happen during
computing statistics if a certain symbol had (by chance) never
been keyed or if it had never been copied (regardless of whether
it had been keyed or not).
2007-04-29 23:51 Thomas Herlea <maxthomax>
* src/check.cc: Replaced algorithm for generating and displaying
the feedback for groups of symbols: - one loop for generating
feedback cells - another loop for displaying the cells taking
care of terminal width
2007-04-29 23:33 Thomas Herlea <maxthomax>
* include/resources.hh, src/check.cc: Added finer-grained feedback
per symbol: - two points of view for the statistics: * what
was keyed, to see which symbols tend not to be recognized *
what was copied, to see which symbols tend to be "heard" even
when they are not keyed - both count breakdown and percentage
breakdown for each
2007-04-29 23:16 Thomas Herlea <maxthomax>
* src/check.cc: Expanded feedback legend in display_comparison() to
include the MISSED_MARKER. Added double quotes in the output
around the legend.
2007-04-29 23:09 Thomas Herlea <maxthomax>
* include/resources.hh: Expanded feedback legend in
display_comparison() to include the MISSED_MARKER. Added double
quotes in the output around the legend.
2007-04-29 13:59 Thomas Herlea <maxthomax>
* src/check.cc: Display missed symbols as missed, not as mistakes
(both when explicitly entered as missed and when a group is too
short).
2007-04-29 13:35 Thomas Herlea <maxthomax>
* src/check.cc: Replaced hardcoded markers '.' and '@' by macros
and renamed the macro for '!'.
2007-04-28 12:19 Thomas Herlea <maxthomax>
* src/check.cc: Replaced inflexible macro COUNTER_WIDTH with
function width_base_10(max_counter_value).
2007-04-25 21:15 denever
* include/menu.hh: Comitted a patch from Martin Michlmayr FTBFS
with GCC 4.3: error: extra ';'
2007-04-25 00:28 Thomas Herlea <maxthomax>
* src/check.cc: (bug #19692) When truncating a symbol group, the
number of correctly copied occurrences of the symbols omitted
from the group is not reset to zero any more.
2007-04-25 00:21 Thomas Herlea <maxthomax>
* src/check.cc: Ensure that the symbol group counter has the right
values in the last cell row, regardless whether it is the only
row or not.
2007-04-24 01:25 Thomas Herlea <maxthomax>
* src/check.cc: (bug #19674) In the loop for the incomplete row of
cells, increment cell counter before creating cell because the
previous loop left it at a value corresponding to the last cell
of the previous row.
2007-04-24 01:22 Thomas Herlea <maxthomax>
* src/check.cc: Removed loop counter incrementation which
duplicated the incrementation from the for statement. Now the
rows of cells are tracked properly.
2007-04-24 01:20 Thomas Herlea <maxthomax>
* src/check.cc: (bug #19674) list iterators advance every time a
cell is built, otherwise every row but the last one will just
repeat its first cell.
2007-04-24 01:15 Thomas Herlea <maxthomax>
* src/check.cc: Replaced ostringstream::clear() by
ostringstream::str(string). The old one just clears error flags,
the new one "empties" the string. This way a new rows of cells
replaces the old one instead of being appended to it.
2007-04-23 10:54 Thomas Herlea <maxthomax>
* src/check.cc: Moved function padding() to the top of the file
because it will be used in future functions, too, and because it
was separating the function display_comparison() from its
comments.
2007-04-23 00:10 Giuseppe Martino <denever@users.sourceforge.net>
* include/koch.hh, src/koch.cc, src/koch_exc.cc: Committed Thomas
Herlea's Shuffle Koch Patch
2006-11-01 09:35 Giuseppe Martino <denever@users.sourceforge.net>
* src/: koch_exc.cc, main.cc: Added support for automated writing
of ~/.aldorc
2006-09-27 19:53 Giuseppe Martino <denever@users.sourceforge.net>
* THANKS: Updated THANKS for Ferdinando Maresca
2006-09-27 19:48 Giuseppe Martino <denever@users.sourceforge.net>
* src/check.cc: Added ++n at check.cc:264
2006-09-25 13:01 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, VERSION, configure.ac: Released 0.7.3
* configure.ac: Added error message to AC_CHECK_LIB
2006-09-24 19:22 Giuseppe Martino <denever@users.sourceforge.net>
* src/check.cc:
Defined typedefs
s/std:://g
Rewrited display_symbol_rate using list and map iterators
Rewrited mark_mistakes using string iterators
Rewrited get_maked_strings using list iterators
Used padding function in display_comparison
Rewrited count_wrong_letters using string iterators
2006-09-24 12:13 Giuseppe Martino <denever@users.sourceforge.net>
* src/check.cc:
Rewrited display_simbol_rate in check.cc using
map<char, unsigned int>
Fixed a bug in mark_mistakes in check.cc
2006-09-24 09:06 Giuseppe Martino <denever@users.sourceforge.net>
* src/check.cc: Replaced padding function with string(int,'@')
2006-09-23 21:24 Giuseppe Martino <denever@users.sourceforge.net>
* include/blocks.hh, include/koch.hh, src/blocks.cc, src/check.cc,
src/koch.cc:
Removed get_string, get_string_len, len, verify methods from
interface of Blocks
Added tokenize method to interface of Blocks
Removed get_string, get_string_len, len, verify methods from
interface of Koch
Added tokenize method to interface of Koch
Used tokenize in check.cc
2006-06-12 22:54 Giuseppe Martino <denever@users.sourceforge.net>
* VERSION, configure.ac: Released 0.7.2
2006-06-12 22:35 Giuseppe Martino <denever@users.sourceforge.net>
* src/textfile.cc:
Fixed a typo at line 77 s/exc_string()/exc_string/
2006-06-12 22:25 Giuseppe Martino <denever@users.sourceforge.net>
* src/textfile.cc: Fixed temporary variable bug thanks to Jim Van Donsel
2006-06-12 22:08 Giuseppe Martino <denever@users.sourceforge.net>
* src/: astream.cc, blocks.cc, blocks_exc.cc, check.cc,
datafile.cc, keyer.cc, koch.cc, koch_exc.cc, main.cc, menu.cc,
option.cc, qrz.cc, qrz_exc.cc, random.cc, section.cc, setup.cc,
textfile.cc, textfile_exc.cc, wave.cc: Fixed Copyright notice
2006-04-12 20:40 Giuseppe Martino <denever@users.sourceforge.net>
* include/: astream.hh, audioexcep.hh, audioworkspace.hh,
blocks.hh, datafile.hh, dialog.hh, exception.hh, keyer.hh,
koch.hh, menu.hh, option.hh, qrz.hh, resources.hh, section.hh,
skill.hh, textfile.hh, wave.hh: Fixed a typo
Released 0.7.1
2006-04-12 17:46 Giuseppe Martino <denever@users.sourceforge.net>
* include/blocks.hh, include/keyer.hh, include/koch.hh,
include/qrz.hh, include/textfile.hh, src/blocks.cc,
src/menu.cc: Fixed to be gcc-4.2 compliant
2006-03-06 21:56 Giuseppe Martino <denever@users.sourceforge.net>
* src/blocks.cc: Aggiunta la funzione membro:
unsigned int Blocks::execute()
2005-10-28 13:34 Giuseppe Martino <denever@users.sourceforge.net>
* include/Makefile.am, include/resources.hh, src/Makefile.am,
src/resources.hh: Moved src/resource.hh in include/
2005-10-27 23:31 Giuseppe Martino <denever@users.sourceforge.net>
* THANKS, bootstrap, configure.ac: Fixed bootstrap.sh adding mkdir config
Removed blank rows in THANKS
2005-10-27 10:25 Giuseppe Martino <denever@users.sourceforge.net>
* include/random.hh, src/koch.cc: In koch method increase also
blocks size and blocks number
2005-10-25 18:01 Giuseppe Martino <denever@users.sourceforge.net>
* src/setup.cc: Fixed a bug in configfile in setup.cc with
s/classic/blocks/g
2005-10-25 17:51 Giuseppe Martino <denever@users.sourceforge.net>
* src/resources.hh: Fixed resources.hh with s/block/blocks/g
2005-10-25 17:45 Giuseppe Martino <denever@users.sourceforge.net>
* src/: blocks.cc, blocks_exc.cc: Added missed files
2005-10-25 17:17 Giuseppe Martino <denever@users.sourceforge.net>
* README: Updated README with s/Classic/Blocks method/g
2005-10-25 17:15 Giuseppe Martino <denever@users.sourceforge.net>
* aldo.1: Updated aldo.1
2005-10-25 17:14 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, debian/control, include/Makefile.am,
include/blocks.hh, include/classic.hh, src/Makefile.am,
src/check.cc, src/classic.cc, src/classic_exc.cc, src/main.cc,
src/resources.hh: Renamed Classic method in Blocks method in
resource.hh Renamed classic.hh in blocks.hh Renamed classic.cc in
blocks.cc Renamed classic_exc in blocks_exc.cc Updated
include/Makefile.am src/Makefile.am
Renamed ::OnClassic() in ::OnBlocks() Renamed class Classic in
class Blocks Updated debian/control
2005-10-23 21:41 Giuseppe Martino <denever@users.sourceforge.net>
* src/: classic_exc.cc, qrz_exc.cc, textfile_exc.cc: Renamed each
current_exercise in [classic|koch|textfile|qrz]_exc form
2005-10-23 21:37 Giuseppe Martino <denever@users.sourceforge.net>
* include/astream.hh, include/audioexcep.hh,
include/audioworkspace.hh, include/classic.hh,
include/datafile.hh, include/dialog.hh, include/exception.hh,
include/keyer.hh, include/koch.hh, include/menu.hh,
include/option.hh, include/qrz.hh, include/random.hh,
include/section.hh, include/skill.hh, include/textfile.hh,
include/wave.hh, src/astream.cc, src/check.cc, src/classic.cc,
src/classic_exc.cc, src/datafile.cc, src/keyer.cc, src/koch.cc,
src/koch_exc.cc, src/main.cc, src/menu.cc, src/option.cc,
src/qrz.cc, src/qrz_exc.cc, src/random.cc, src/resources.hh,
src/section.cc, src/setup.cc, src/textfile.cc,
src/textfile_exc.cc, src/wave.cc: Fixed copyleft/copyright typo
2005-10-23 21:36 Giuseppe Martino <denever@users.sourceforge.net>
* README, src/resources.hh, src/setup.cc: Updated README for new
setup menu Updated Koch setup menu for new Koch exercise options
2005-10-22 22:50 Giuseppe Martino <denever@users.sourceforge.net>
* include/dialog.hh, src/koch_exc.cc: Fixed bug in dialog default
management
2005-10-17 22:48 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control: Removed unused autotools-dev build dependency
2005-10-17 22:03 Giuseppe Martino <denever@users.sourceforge.net>
* src/: resources.hh, setup.cc: Added koch skill setup
2005-10-17 21:51 Giuseppe Martino <denever@users.sourceforge.net>
* src/: resources.hh, setup.cc: Added configuration of training set
if characters
2005-10-17 21:17 Giuseppe Martino <denever@users.sourceforge.net>
* include/dialog.hh, include/koch.hh, src/check.cc, src/koch.cc,
src/koch_exc.cc: Added cin.ignore() in Dialog::show() Removed
inline next() Added Koch::next() Fixed a typo in Koch constructor
2005-10-17 19:46 Giuseppe Martino <denever@users.sourceforge.net>
* include/koch.hh, src/check.cc, src/koch_exc.cc: Added
Koch::skill() Added Koch::get_chars() Added Koch::next() Added
check(Koch) Added display_feedback(Koch)
2005-10-17 19:13 Giuseppe Martino <denever@users.sourceforge.net>
* src/: classic_exc.cc, koch_exc.cc, qrz_exc.cc, textfile_exc.cc,
resources.hh: Fixed a silly typo
2005-10-17 19:03 Giuseppe Martino <denever@users.sourceforge.net>
* include/koch.hh, src/koch.cc, src/setup.cc: Fixed a silly typo in
setup.cc Added Chars option for koch config Included koch.hh in
koch.cc Fixed Koch constructor declaration
2005-10-17 17:58 Giuseppe Martino <denever@users.sourceforge.net>
* VERSION: Changed to 0.7.1 version
2005-10-17 17:57 Giuseppe Martino <denever@users.sourceforge.net>
* configure.ac: Changed to 0.7.1
2005-10-17 17:54 Giuseppe Martino <denever@users.sourceforge.net>
* src/Makefile.am: Fixed src/Makefile.am adding resource.hh to
aldo_SOURCES
2005-10-17 17:51 Giuseppe Martino <denever@users.sourceforge.net>
* include/Makefile.am, src/Makefile.am: Updated include/Makefile.am
src/Makefile.am for compiling new koch method
2005-10-17 17:49 Giuseppe Martino <denever@users.sourceforge.net>
* include/classic.hh, include/dialog.hh, include/koch.hh,
include/menu.hh, src/koch.cc: Added macro *_H checking in
classic.hh dialog.h menu.hh Added new koch method
2005-10-17 15:39 Giuseppe Martino <denever@users.sourceforge.net>
* aldo.1: Rewrited aldo man page
2005-10-16 19:40 Giuseppe Martino <denever@users.sourceforge.net>
* debian/: control: Changed read from file description
2005-10-16 18:54 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control: Fixed long description
2005-10-16 18:20 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control: Long description rewrited one more time
2005-10-16 17:46 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control: Writed new long description
2005-10-16 17:23 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control: Remove two build dependencies marked as
build-essential
2005-10-11 21:23 Giuseppe Martino <denever@users.sourceforge.net>
* src/resources.hh: Changed to .hh headers
2005-10-11 21:18 Giuseppe Martino <denever@users.sourceforge.net>
* include/Makefile.am, include/astream.h, include/audioexcep.h,
include/audioworkspace.h, include/classic.h, include/datafile.h,
include/dialog.h, include/exception.h, include/keyer.h,
include/menu.h, include/option.h, include/qrz.h,
include/random.h, include/section.h, include/skill.h,
include/textfile.h, include/wave.h, src/astream.cc,
src/audioworkspace.cc, src/check.cc, src/classic.cc,
src/classic_exc.cc, src/datafile.cc, src/keyer.cc,
src/koch_exc.cc, src/main.cc, src/menu.cc, src/option.cc,
src/qrz.cc, src/qrz_exc.cc, src/random.cc, src/resources.h,
src/section.cc, src/setup.cc, src/textfile.cc,
src/textfile_exc.cc, src/wave.cc, include/astream.hh,
include/audioexcep.hh, include/audioworkspace.hh,
include/classic.hh, include/datafile.hh, include/dialog.hh,
include/exception.hh, include/keyer.hh, include/menu.hh,
include/option.hh, include/qrz.hh, include/random.hh,
include/section.hh, include/skill.hh, include/textfile.hh,
include/wave.hh: Changed to .hh headers
2005-10-11 08:27 Giuseppe Martino <denever@users.sourceforge.net>
* src/: astream.cc, audioworkspace.cc, check.cc, classic.cc,
classic_exc.cc, datafile.cc, keyer.cc, koch_exc.cc, main.cc,
menu.cc, option.cc, qrz.cc, qrz_exc.cc, random.cc, section.cc,
setup.cc, textfile.cc, textfile_exc.cc, wave.cc: Changed from
*.cpp to *.cc
2005-10-11 08:22 Giuseppe Martino <denever@users.sourceforge.net>
* debian/copyright, src/Makefile.am, src/astream.cpp,
src/audioworkspace.cpp, src/check.cpp, src/classic.cpp,
src/classic_exc.cpp, src/datafile.cpp, src/keyer.cpp,
src/koch_exc.cpp, src/main.cpp, src/menu.cpp, src/option.cpp,
src/qrz.cpp, src/qrz_exc.cpp, src/random.cpp, src/section.cpp,
src/setup.cpp, src/textfile.cpp, src/textfile_exc.cpp,
src/wave.cpp: Change from *.cpp to *.cc
2005-10-07 23:19 Giuseppe Martino <denever@users.sourceforge.net>
* TODO, debian/copyright: The TODO doesn't seem to have much of
value for the end-user.
2005-10-07 16:47 Giuseppe Martino <denever@users.sourceforge.net>
* debian/aldo.substvars: Removed unuseful file
2005-10-07 15:40 Giuseppe Martino <denever@users.sourceforge.net>
* src/Makefile.am: Removed README.sources from extradist
* aldo-0.7.0 released
2005-10-07 12:05 Giuseppe Martino <denever@users.sourceforge.net>
* NEWS: Updated News file
2005-10-07 11:06 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, README: Updated ChangeLog
Removed from README instructions to configure soundcard
2005-10-06 11:41 Giuseppe Martino <denever@users.sourceforge.net>
* src/README.sources: Removed empty unused file
2005-10-04 20:11 Giuseppe Martino <denever@users.sourceforge.net>
* include/dialog.h: Fixed a bug of default support in dialog
2005-10-03 22:17 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, NEWS: ChangeLog Updated NEWS
2005-10-03 21:11 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, include/astream.h, include/audioexcep.h,
src/astream.cpp:
Updated ChangeLog
Used AudioException in astream.*
Rewrited AudioException
2005-10-03 18:23 Giuseppe Martino <denever@users.sourceforge.net>
* config/readline.m4: Removed unused file readline.m4
2005-10-03 17:35 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, THANKS, include/dialog.h, src/koch_exc.cpp,
src/menu.cpp, src/resources.h, src/setup.cpp:
ChangeLog THANKS Updated
Added default choice support
Changed prompt string
Used dialog with default choice
2005-10-01 15:58 Giuseppe Martino <denever@users.sourceforge.net>
* src/setup.cpp: Fixed \0 getline bug
2005-09-29 14:41 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control, src/setup.cpp:
Removed build-depend on libreadline5-dev
Changed description
Rewrited update_option function
2005-09-25 15:53 Giuseppe Martino <denever@users.sourceforge.net>
* configure.ac, include/dialog.h, src/menu.cpp:
Removed libreadline use
2005-09-25 13:43 Giuseppe Martino <denever@users.sourceforge.net>
* include/keyer.h, src/astream.cpp, src/keyer.cpp:
Added new set_* methods
Removed wrong used of delete
2005-09-25 11:52 Giuseppe Martino <denever@users.sourceforge.net>
* include/astream.h, include/audioexcep.h, include/classic.h,
include/datafile.h, include/exception.h, include/keyer.h,
include/menu.h, include/option.h, include/qrz.h,
include/section.h, include/skill.h, include/textfile.h,
src/check.cpp, src/classic.cpp, src/classic_exc.cpp,
src/datafile.cpp, src/keyer.cpp, src/koch_exc.cpp, src/menu.cpp,
src/option.cpp, src/qrz.cpp, src/qrz_exc.cpp, src/resources.h,
src/section.cpp, src/textfile.cpp:
Fixed typo in GPL disclaimer
2005-09-25 11:44 Giuseppe Martino <denever@users.sourceforge.net>
* include/keyer.h:
Fixed a typo in keyer constructor declaration
2005-09-25 11:32 Giuseppe Martino <denever@users.sourceforge.net>
* include/: dialog.h, keyer.h:
Used standard template declaration
Rewrited interface in a more readable way
2005-09-20 21:31 Giuseppe Martino <denever@users.sourceforge.net>
* include/astream.h:
Added HAVE_AO_H checking befor include ao/ao.h
2005-09-20 21:26 Giuseppe Martino <denever@users.sourceforge.net>
* VERSION, configure.ac, debian/control:
Updated to 0.7.0
Added build-depend item on libao-dev
2005-09-20 20:31 Giuseppe Martino <denever@users.sourceforge.net>
* Makefile.am, include/Makefile.am, src/Makefile.am:
Removed note "based on Bob Harrington Makefile.am"
because rewrited from scratch
2005-09-20 20:29 Giuseppe Martino <denever@users.sourceforge.net>
* src/random.cpp: Fixed an unused variable warning
about rightRangeRand with s/rightScaleRand/rightRangeRand at line
76
2005-09-20 20:23 Giuseppe Martino <denever@users.sourceforge.net>
* include/keyer.h: Fixed position of m_audio e
m_aws private variable
2005-09-20 20:21 Giuseppe Martino <denever@users.sourceforge.net>
* THANKS: Updated about libao
2005-09-20 20:20 Giuseppe Martino <denever@users.sourceforge.net>
* TODO, src/classic_exc.cpp, src/koch_exc.cpp, src/qrz_exc.cpp,
src/resources.h, src/setup.cpp, src/textfile_exc.cpp:
Removed any refernce to SoundCard configuration
Removed last TODO item about alsa support
2005-09-20 20:06 Giuseppe Martino <denever@users.sourceforge.net>
* include/Makefile.am, src/Makefile.am:
Added audioworkspace.h to noinst_HEADERS
Added audioworkspace.cpp to aldo_SOURCES
2005-09-20 20:02 Giuseppe Martino <denever@users.sourceforge.net>
* include/audioworkspace.h, src/audioworkspace.cpp:
Added from new libaudiosteam libao based
2005-09-20 19:53 Giuseppe Martino <denever@users.sourceforge.net>
* configure.ac, include/astream.h, include/keyer.h, include/wave.h,
src/astream.cpp, src/classic.cpp, src/classic_exc.cpp,
src/keyer.cpp, src/koch_exc.cpp, src/qrz_exc.cpp,
src/textfile_exc.cpp, src/wave.cpp:
Added checks for libao
Removed checks for OSS headers
Installed new libaudiostream using libao
Changed Keyer constructor arguments removed oastream arg\
with audioworkspace arg
Removed Keyer::sample_rate()
Removed Keyer::sample_size()
Changed sample_type from double to char
Removed Wave::Wave()
Added Wave::Wave(size_type, sample_buffer_pointer)
Removed SineWave and Pause
Fixed indentation
Used new Keyer constructor
2005-09-19 22:15 Giuseppe Martino <denever@users.sourceforge.net>
* src/Makefile.am: Added ansi pedantic Wall flags
2005-09-17 01:34 Giuseppe Martino <denever@users.sourceforge.net>
* src/: astream.cpp, menu.cpp, resources.h:
Checking HAVE_CONFIG_H before including config.h
2005-09-15 10:10 Giuseppe Martino <denever@users.sourceforge.net>
* debian/dirs: Removed /usr/sbin unused dir
2005-09-15 09:44 Giuseppe Martino <denever@users.sourceforge.net>
* include/Makefile.am, src/astream.cpp:
Fixed noinst_include_HEADERS to noinst_HEADERS
Added missed include config.h
2005-09-15 09:36 Giuseppe Martino <denever@users.sourceforge.net>
* include/Makefile.am:
Changed include_HEADERS in noinst_include_HEADERS
to avoid installation of include/*.h
2005-09-14 21:03 Giuseppe Martino <denever@users.sourceforge.net>
* configure.ac, debian/copyright, src/astream.cpp, src/resources.h:
Update autoconf support checking for more headers
Using config.h in astream.cpp e resources.h
2005-09-13 11:05 Giuseppe Martino <denever@users.sourceforge.net>
* debian/control: Removed a libc6-dev that was listed twice in
build-depends Changed long description
2005-09-13 10:37 Giuseppe Martino <denever@users.sourceforge.net>
* ChangeLog, NEWS, VERSION: Switched to 0.6.11 version
Updated ChangeLog NEWS VERSION
2005-09-13 00:45 Giuseppe Martino <denever@users.sourceforge.net>
* src/Makefile.am: Fixed wrong name s/README.Sources/README.sources
in src/Makefile.am
2005-09-13 00:34 Giuseppe Martino <denever@users.sourceforge.net>
* configure.ac, debian/control, src/Makefile.am:
Removed unuseful build-depend on automake1.9
Changed to version 0.6.11
Added to distro README.Sources
0.6.11 Mon 12 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Added man page file in top source dir aldo.1
Added readline.m4 in config/
Moved librandom/*.h in include/
Moved libdatafile/src/*.h in include/
Moved libkeyer/*.h in include/
Moved libmenus/*.h in include/
Moved libaudiostream/*.h in include/
Moved librandom/*.cpp in src/
Moved libdatafile/src/*.cpp in src/
Moved libkeyer/*.cpp in src/
Moved libmenus/*.cpp in src/
Moved libaudiostream/*.cpp in src/
Removed librandom/
Removed libdatafile/
Removed libkeyer/
Removed libmenus/
Removed libaudiostream/
Added include/Makefile.am
Added *.cpp in src/Makefile.am
In configure.ac removed AC_CHECK_HEADERS([readline/readline.h readline/history.h])
In configure.ac added VL_LIB_READLINE defined in readline.m4
In configure.ac removed lib*/Makefile from AC_CONFIG_FILES
In configure.ac added include/Makefile in AC_CONFIG_FILES
Fixed dialog.h and menu.cpp removing bogus use of cin and char*
0.6.10 Mon 12 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Version burned
0.6.9 Mon 12 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Version burned
0.6.8
Sat 3 Sep 2005 Bob Harrington <rharring@iee.org>
Added Makefile.am
Added Makefile.in
Added configure.ac
Added bootstrap
Added librandom/Makefile.am
Added libdatafile/src/Makefile
Added libdatafile/src/Makefile.am
Added libdatafile/Makefile.am
Added libkeyer/Makefile.am
Added libmenus/Makefile.am
In librandom/random.h removed from Random class:
void randomize();
Random(unsigned long seed);
int ToC();
double real();
In librandom/random.cpp removed:
void randomize();
Random(unsigned long seed);
int ToC();
double real();
In librandom/random.cpp changed:
Random::integer(int min, int max) to use rand() from stdlib
In libexercise/classic.cpp Classic::randstring removed weights
Wed 7 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Writed ChangeLog file
Fixed THANKS file
Fixed GPL disclaimers
In libmenu/dialog.h added prepocessor directive handling config macros
In libmenu/menu.cpp added prepocessor directive handling config macros
In libmenu/dialog.h added Choice::Choice(const Choice<T> & cpy)
In libmenu/dialog.h added Choice::operator=(const Choice<T> & cpy)
In libmenu/dialog.h added Choice::~Choice()
07070100000003000081A400000000000000000000000151E5218700000220000000000000000000000000000000000000001700000000aldo-0.7.8/Makefile.am# Copyright (C) 2005 Giuseppe Martino <denever@users.sf.net>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SUBDIRS = src include
man_MANS = aldo.1
EXTRA_DIST = $(man_MANS)
07070100000004000081A400000000000000000000000151E5218700000E1C000000000000000000000000000000000000001000000000aldo-0.7.8/NEWS0.7.0 Thu 04 2005 Giuseppe Martino <denever@users.sourceforge.net>
Aldo uses libao.
Removed readline use.
Removed soundcard configuration.
Many bugs and memory leaks fixed.
0.6.11 Mon 12 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Fixed autoconf and automake support
0.6.10 Mon 12 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Version burned
0.6.9 Mon 12 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Version burned
0.6.8
Sat 3 Sep 2005 Bob Harrington <rharring@iee.org>
Added autoconf and automake support
Improved random number generator
Wed 7 Sep 2005 Giuseppe Martino <denever@users.sourceforge.net>
Fixed some bugs in libmenu
Improved libmenu to use config.h
0.6.7 Wed 23 Feb 2005 Thomas Herlea <thomas.herlea@gmail.com>
Added exercise feedback about copying success per symbol.
Added exercise feedback about positions of copy mistakes.
In Setup, added hint about current parameter value to the input
prompt for all, except the skill parameters.
In Setup prompts, pressing Enter keeps the current parameter value.
Made Koch method parameters controllable through Setup.
Made difficulty parameters of Koch method persistent.
0.6.6 Sun 8 Aug 2004 Giuseppe Martino <denever@users.sourceforge.net>
Readline support
0.6.5 Wed 20 Apr 2004 Giuseppe Martino <denever@users.sourceforge.net>
Fixed a bug in Koch Method Setup
Fixed for runnig with gcc 3.4.0
0.6.4 Wed 17 Mar 2004 Scott Lambert KC5MLE
Makefile with PREFIX
FreeBSD port
0.6.3 Sun 30 Gen 2004 Tom Mortell
fixed the '9' bug
0.6.2 Tue 25 Nov 2003 Arlo Gittings KC0MNN
Rewriting of README
Restringing of resources.h
0.6.2 Tue 21 Nov 2003 Giuseppe Martino <denever@users.sourceforge.net>
Code clean-up
0.6.1 Thu 20 Nov 2003 Giuseppe Martino <denever@users.sourceforge.net>
Code Clean-up 21K to 18K
Leaved i8n
0.6.0 Tue 28 Oct 2003 Giuseppe Martino <denever@users.sourceforge.net>
New random string generator
New keyer
Exercises rewrited to support new keyer
Added Callsign exercise aka QRZ exercise
Added keyer setup
Added soundcard setup
New format for configuration file
Improvements in libaudiostream
Improvements in libmorse
Improvements in libdatafile
Fixed speed bug
Removed speed in cpm
Leave localization support
0.5.5 Sun 5 Oct 2003 Giuseppe Martino <denever@users.sourceforge.net>
Fixed some bugs in Classic exercise generator THANKS TO Sandro Serafini
Fixed bugs random number generator THANKS TO Sandro Serafini
0.5.4 Fri 3 Oct 2003 Giuseppe Martino <denever@users.sourceforge.net>
Fixed grammar issues --> THANKS TO Tony <falcon611@users.sf.net>
Fixed a big bug in exercise generator --> THANKS TO Sandro Serafini
Fixed a bug in 16bit sound routine --> THANKS TO Marco Bisioli
New italian traslation
Fixed a big bug in sound routines
0.5.3 Wed 1 Oct 2003 Giuseppe Martino <denever@users.sourceforge.net>
Code cleanup from 24K to 19K
0.5.2 Tue 30 Set 2003 Giuseppe Martino <denever@users.sourceforge.net>
Fixed a big bug:
Aldo didn't play chars "r,p,l,f" --> THANKS TO Sandro Serafini
0.5.1 Sat 27 Set 2003 Giuseppe Martino <denever@users.sourceforge.net>
Small fixes in libkeyer
Small fixes in resources.h
0.5.0 Sun 6 Jul 2003 Giuseppe Martino <denever@users.sourceforge.net>
Added verify exercise routine
Removed check exercise routine
Brandnew exercise generator
Many improvements in libmorse
Many improvements in libmenus
Fixed a bug in libmenus --> THANKS TO Arlo Gittings KC0MNN
Added koch method
Added skill customizer
Added exercise from text file
New format for configuration file07070100000005000081A400000000000000000000000151E5218700000DB6000000000000000000000000000000000000001200000000aldo-0.7.8/READMEWhen you start Aldo you will see the Main Menu:
*************************************
* Aldo Main Menu *
* 1: Blocks method *
* 2: Koch method *
* 3: Read from file *
* 4: Callsigns *
* 5: Setup *
* 6: Exit *
* *
* Your choice: *
*************************************
First of all you must set up Aldo for your PC,
so select 5.
Now you will see the Setup Menu:
*********************************
* Setup Menu *
* 1: Keyer Setup *
* 2: Blocks method Setup *
* 3: Koch method Setup *
* 4: Qrz exercise Setup *
* 5: Default Settings *
* 6: Return to Main Menu *
*********************************
Now you have to create the configuration file ~/.aldorc
So select 5.
Other choices in the Setup Menu:
*********************************
* Setup Menu *
* 1: Keyer Setup *
* 2: Blocks method Setup *
* 3: Koch method Setup *
* 4: Qrz exercise Setup *
* 5: Default Settings *
* 6: Return to Main Menu *
*********************************
By selecting 1 you can set up:
1) Pause before the start of keying, in seconds (default: 2)
2) Pause between two letters in a word (default: 3)
3) Pause between two words (default: 7)
4) Keying speed in wpm
5) Length of dot (default: 1)
6) Length of dash (default: 3)
7) Frequency of buzzer in Hz (default: 900)
By selecting 2 you can set up training with the Blocks method exercise:
1) Length of words, in characters (default: 5)
2) Number of words (default: 3)
3) Character set (default: 1 - i.e. "e,i,s,h,t,m,o")
By selecting 3 you can set up the keying speed for the Koch method.
By selecting 4 you can set up the Callsign exercise.
Specify your preferred callsign format, using "wildcards":.
@ = random letter
# = random number
? = optional letter
$ = optional number
A fixed letter or a fixed number, (such as "i" or "8" in the examples
below), is used literally.
For example:
iz8@@@ is a format for callsigns like iz8bqi iz8eqd iz8tpz etc..
iz#m@@ gives iz0muv iz9mer iz8mrd etc..
iz#@@@ gives iz2qwe iz1ert etc..
i?8@@@ gives i8mro iz8eqd it8aa ih8epz etc..
i?#@@@ gives imro izqvo iz8mrt etc..
kc#@@@ gives kc0mnn kc1hjy kc9yup
NOTE: Callsign formats must be lower case: e.g. iz#m@@, not IZ#M@@
Coming back to the Main Menu:
*************************************
* Aldo Main Menu *
* 1: Blocks method *
* 2: Koch method *
* 3: Read from file *
* 4: Callsigns *
* 5: Setup *
* 6: Exit *
* *
* Your choice: *
*************************************
Select 1 to train by the Blocks Method
Select 2 to train by the Koch Method
Select 3 for Aldo to read a text file from disk
Select 4 to train by using random callsigns
Now listen to your speakers.
Identify the morse characters and write them on a sheet of paper.
If you are unsure, use an underscore ( _ ) to hold the place of missed letters.
When the exercise has finished you should enter the characters at the keyboard.
Entering the characters at the keyboard, please replace underscore ( _ ) with @.
ALDO will then compare your results with the correct version.
If you have suggestions for additional features, please send me an email
to denever@users.sf.net or subscribe
aldo mailinglist at http://lists.sourceforge.net/lists/listinfo/aldo-main.
Ciao ciao,
Giuseppe Martino IZ8EQD.
Thanks to:
Arlo Gitting KC0MNN
David Sumbler
They revised this file (except this row :) )07070100000006000081A400000000000000000000000151E52187000003B6000000000000000000000000000000000000001200000000aldo-0.7.8/THANKSThanks to Arlo Gittings KC0MNN for a lot of corrections about grammar issues and for README and README.sources.
Thanks to Leonard Penzer DH7LP for a lot of feedbacks, for German language support, for correction in speed selection.
Thanks to David Sumbler for a lot of corrections about grammar issues and for README and README.sources.
Thanks to Thomas Herlea for :
1. more detailed exercise evaluation
2. displaying of the current option value in setup and the possibility to keep a value unchanged by pressing Enter
3. more configurable start for the Koch training method
4. saving the difficulty level achieved in the Koch training method
Thanks to Bob Harrington for autoconf and automake support and for improved random number generator
Thanks to Bob Harrington for suggestion about libao (www.xiph.org/ao)
Thanks to Ferdinando Maresca for a lot of bug reports
Thanks to Jan-Simon Möller DL9PF for a patch smothening of audio output in aldo07070100000007000081A400000000000000000000000151E5218700000007000000000000000000000000000000000000001300000000aldo-0.7.8/VERSION0.7.7
07070100000008000081A400000000000000000000000151E5218700000895000000000000000000000000000000000000001200000000aldo-0.7.8/aldo.1.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH ALDO 1 "Nov 20, 2004"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
aldo \- A fully console morse code trainer written in ISO C++.
.SH SYNOPSIS
.B aldo
.br
.SH DESCRIPTION
.ad b
\fBAldo\fP is developed from scratch in ISO C++ using GNU C++ Standard Library and libao (www.xiph.org/ao).
.br
It is a morse code learning tool which provides four type of training methods:
.br
.PP
.TP
.B Blocks
Identify blocks of random characters played in morse code.
.TP
.B Koch
Two morse characters will be played at full speed (20wpm)
until you'll be able to identify at least 90 percent of them.
After that, one more character will be added, and so on.
.TP
.B File
Identify played characters generated from a file.
.TP
.B Callsign
Identify random callsigns played in morse code.
.br
.SH NOTES
The "Device" option under the keyer depends on the particular driver.
The "default" setting picks the default sound device. This option may
be used to pick a different soundcard than the default one.
For alsa, it is "hw:<card>,<device>", where the card and device number
are the particular hardware devices. The default is generally
"hw:0.0". Generally 0 is the first card, 1 is the second, etc. Some
sound cards may have multiple output devices, the device picks the
particular one.
For oss, sun, and aixs, it is the device name, like /dev/dsp.
For esd, it is the host name, like "whizbang.com:555".
It is not used on any other drivers.
.SH AUTHOR
This manual page was written by Giuseppe Martino <denever@users.sf.net>,
for the Debian project (but may be used by others).
07070100000009000081A400000000000000000000000151E521870000035E000000000000000000000000000000000000001500000000aldo-0.7.8/bootstrap#! /bin/sh
# Copyright (C) 2005 Giuseppe Martino <denever@users.sf.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
mkdir config
aclocal -I config
autoheader
automake --gnu --add-missing
autoconf
0707010000000A000081A400000000000000000000000151E521870000037D000000000000000000000000000000000000001800000000aldo-0.7.8/configure.ac# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT([aldo], [0.7.7], [Giuseppe Martino denever@users.sf.net])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([dist-bzip2])
CPPFLAGS="-I${includedir}"
LDFLAGS="-L${libdir}"
LIBS="-L${libdir} ${LIBS}"
# Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL
#AC_PROG_RANLIB
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_LIB(ao, main)
AC_CHECK_HEADERS(ao/ao.h, [], [echo "Error! You need to have libao (www.xiph.org/ao) around.";exit -1])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS([floor])
AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile])
AC_OUTPUT
0707010000000B000041ED00000000000000000000000251E5218700000000000000000000000000000000000000000000001300000000aldo-0.7.8/include0707010000000C000081A400000000000000000000000151E52187000002B7000000000000000000000000000000000000001F00000000aldo-0.7.8/include/Makefile.am# Copyright (C) 2005 Giuseppe Martino <denever@users.sf.net>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
noinst_HEADERS = astream.hh datafile.hh exception.hh menu.hh qrz.hh section.hh\
textfile.hh blocks.hh dialog.hh keyer.hh option.hh random.hh skill.hh\
wave.hh audioexcep.hh audioworkspace.hh koch.hh resources.hh
0707010000000D000081A400000000000000000000000151E521870000099C000000000000000000000000000000000000001E00000000aldo-0.7.8/include/astream.hh// -*- C++ -*-
/***************************************************************************
libaudiostream
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 9 Mar 2002
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef AUDIOSTREAM_H
#define AUDIOSTREAM_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#ifdef HAVE_AO_AO_H
#include <ao/ao.h>
#endif
#include "wave.hh"
#include "audioworkspace.hh"
#include "audioexcep.hh"
namespace libaudiostream
{
class oastream
{
public:
oastream(ao_sample_format, std::string device) throw(AudioException);
oastream(const oastream&);
~oastream();
oastream& operator<<(const Wave&) throw(AudioException);
oastream& operator=(const oastream&);
private:
ao_device* m_audio;
ao_sample_format m_format;
int m_default_driver;
};
}
#endif //AUDIOSTREAM_H
0707010000000E000081A400000000000000000000000151E521870000090B000000000000000000000000000000000000002100000000aldo-0.7.8/include/audioexcep.hh// -*- C++ -*-
/***************************************************************************
libaudiostream
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 9 Mar 2002
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef AUDIOEXCEPTION_H
#define AUDIOEXCEPTION_H
#include <string>
#include <exception>
namespace libaudiostream
{
class AudioException : public std::exception
{
private:
std::string m_message;
public:
AudioException(const std::string &message) throw() : std::exception()
{
m_message = message;
}
virtual ~AudioException() throw()
{
}
virtual const char* message() const throw()
{
return m_message.c_str();
}
};
}
#endif // AUDIOEXCEPTION_H
0707010000000F000081A400000000000000000000000151E5218700000994000000000000000000000000000000000000002500000000aldo-0.7.8/include/audioworkspace.hh// -*- C++ -*-
/***************************************************************************
libaudiostream
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 9 Mar 2002
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef AUDIOWORKSPACE_H
#define AUDIOWORKSPACE_H
#include "wave.hh"
#include <string>
namespace libaudiostream
{
class oastream;
class AudioWorkSpace
{
public:
AudioWorkSpace(std::string);
AudioWorkSpace(size_type, size_type, size_type, size_type, std::string);
AudioWorkSpace(const Wave&);
virtual ~AudioWorkSpace();
oastream create_output_stream();
Wave gen_pause(size_type);
Wave gen_sine_wave(size_type, double, double);
private:
size_type m_bits;
size_type m_sample_rate;
size_type m_channels;
size_type m_byte_format;
std::string m_device;
};
}
#endif //AUDIOWORKSPACE_H
07070100000010000081A400000000000000000000000151E5218700000AD8000000000000000000000000000000000000001D00000000aldo-0.7.8/include/blocks.hh// -*- C++ -*-
/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef BLOCKS_H
#define BLOCKS_H
#include "keyer.hh"
#include "skill.hh"
#include <string>
#include <list>
namespace libexercises
{
class Blocks
{
friend libkeyer::Keyer& operator<<(libkeyer::Keyer&, const Blocks&);
private:
std::string m_strings;
unsigned int m_num_chars;
unsigned int m_num_strings;
unsigned int m_skill;
void m_prepare_mixed();
void m_prepare_submixed();
void m_prepare_ordered();
unsigned int share();
std::string randstring(std::string, unsigned int);
std::string gen(std::string, unsigned int);
public:
Blocks(unsigned int, unsigned int, unsigned int);
Blocks(const Blocks&);
~Blocks();
std::list<std::string> tokenize() const;
/* inline unsigned int string_len() const
{
return m_num_chars;
}
inline unsigned int len() const
{
return m_num_strings;
}
*/ };
libkeyer::Keyer& operator<<(libkeyer::Keyer&, const Blocks&);
}
#endif //BLOCKS_H
07070100000011000081A400000000000000000000000151E5218700000A1F000000000000000000000000000000000000001F00000000aldo-0.7.8/include/datafile.hh// -*- C++ -*-
/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef DATAFILE_H
#define DATAFILE_H
#include "section.hh"
namespace libdatafile
{
typedef std::list <Section>::iterator sec_it;
enum access {Read = 2, Write = 4, Create = 8, Update = 16};
class Datafile
{
private:
bool m_opened;
std::list <Section> m_sections;
std::string m_filename;
access m_access;
std::string read_value_in(const std::string&);
std::string read_option_name_in(const std::string&);
sec_it begin();
sec_it end();
public:
Datafile(const std::string&, const access&);
Datafile(const Datafile&);
~Datafile();
void open();
void save();
sec_it section(const std::string&);
void add_section(const std::string&);
void remove_section(const std::string&);
};
}
#endif //Datafile_H
07070100000012000081A400000000000000000000000151E52187000012EE000000000000000000000000000000000000001D00000000aldo-0.7.8/include/dialog.hh// -*- C++ -*-
/***************************************************************************
libmenu
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef DIALOG_H
#define DIALOG_H
#include <iostream>
#include <string>
#include <vector>
template <typename T>
class Choice
{
private:
std::string m_caption;
T m_return_value;
public:
Choice();
Choice(std::string, T);
Choice(const Choice<T> & cpy)
{
m_caption = cpy.m_caption;
m_return_value = cpy.m_return_value;
}
Choice<T>& operator=(const Choice<T>& cpy)
{
m_caption = cpy.m_caption;
m_return_value = cpy.m_return_value;
return *this;
}
~Choice()
{}
std::string caption() const;
T selected() const;
};
template <typename T>
class Dialog
{
private:
std::string m_title;
std::string m_prompt;
std::vector <Choice <T> > m_choices;
unsigned int m_default;
unsigned int m_size;
public:
Dialog();
Dialog(std::string, std::string);
Dialog(const Dialog&);
void add_choice(std::string, T);
void add_default_choice(std::string, T);
T show();
};
template <typename T>
Choice<T>::Choice(): m_caption("Empty"), m_return_value(0)
{}
template <typename T>
Choice<T>::Choice(std::string c, T v): m_caption(c), m_return_value(v)
{}
template <typename T>
std::string Choice<T>::caption() const
{
return m_caption;
}
template <typename T>
T Choice<T>::selected() const
{
return m_return_value;
}
template <typename T>
Dialog<T>::Dialog(): m_title("Dialog"), m_prompt("Prompt:"), m_default(0)
{}
template <typename T>
Dialog<T>::Dialog(std::string t, std::string p):m_title(t), m_prompt(p), m_default(0), m_size(0)
{}
template <typename T>
Dialog<T>::Dialog(const Dialog& copy)
{
m_title = copy.m_title;
m_prompt = copy.m_prompt;
m_choices = copy.m_choices;
m_default = copy.m_default;
}
template <typename T>
void Dialog<T>::add_choice(std::string c, T r)
{
m_choices.push_back(Choice<T>(c,r));
m_size++;
}
template <typename T>
void Dialog<T>::add_default_choice(std::string c, T r)
{
m_size++;
m_choices.push_back(Choice<T>(c,r));
m_default = m_size;
}
template <typename T>
T Dialog<T>::show()
{
std::cin.ignore();
std::cout<<m_title<<std::endl;
unsigned char i = 49;
for(unsigned int it = 0; it < m_choices.size(); it++, i++)
{
std::cout<<"\t"<<i<<": "<<m_choices.at(it).caption()<< std::endl;
if(i == 57)
i = 96;
}
unsigned choice = m_choices.size();
do
{
std::string trash;
if(m_default)
std::cout << m_prompt << " [" << m_default << "]: ";
else
std::cout << m_prompt << ": ";
if ( ! std::getline(std::cin, trash) ) // If there is an input error
{
std::cout << std::endl;
std::cin.clear();
continue;
}
if(!trash.empty())
{
if (int(trash[0]) > 47)
{
if(int(trash[0]) < 58)
choice = int(trash[0]) - 49;
if( (int(trash[0]) > 96) && (int(trash[0]) < 123) )
choice = int(trash[0]) - 88;
}
}
else
choice = m_default - 1;
}
while( choice > m_choices.size()-1 );
return m_choices.at(choice).selected();
}
#endif //DIALOG_H
07070100000013000081A400000000000000000000000151E5218700000ABE000000000000000000000000000000000000002000000000aldo-0.7.8/include/exception.hh// -*- C++ -*-
/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef EXCEPTION_H
#define EXCEPTION_H
namespace libdatafile
{
struct Not_datafile_format
{
const char* m_file_name;
public:
Not_datafile_format(const char* f): m_file_name(f)
{}
};
struct Over_write_file
{
const char* m_file_name;
public:
Over_write_file(const char* f): m_file_name(f)
{}
};
struct Option_not_found
{
const char* m_option_name;
public:
Option_not_found(const char* o): m_option_name(o)
{}
};
struct Section_not_found
{
const char* m_section_name;
public:
Section_not_found(const char* s): m_section_name(s)
{}
};
struct File_not_opened
{
const char* m_file_name;
public:
File_not_opened(const char* f): m_file_name(f)
{}
};
struct File_not_exist
{
const char* m_file_name;
public:
File_not_exist(const char* f): m_file_name(f)
{}
};
} // Namespace Datafile_exception
#endif // EXCEPTION_H
07070100000014000081A400000000000000000000000151E5218700000C9B000000000000000000000000000000000000001C00000000aldo-0.7.8/include/keyer.hh// -*- C++ -*-
/***************************************************************************
libkeyer part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef KEYER_H
#define KEYER_H
#include "astream.hh"
#include <string>
namespace libkeyer
{
class Keyer
{
public:
explicit Keyer(libaudiostream::AudioWorkSpace&, unsigned int, unsigned int =3,
unsigned int=2, unsigned int=1, unsigned int=3);
Keyer(const Keyer&);
Keyer& operator<<(const unsigned int&);
Keyer& operator<<(unsigned char);
Keyer& operator<<(const std::string&);
void set_speed(unsigned int);
void set_charpause_len(unsigned int);
void set_stringpause_len(unsigned int);
void set_dot_len(unsigned int);
void set_line_len(unsigned int);
inline unsigned int keying_speed()
{
return m_speed;
}
inline unsigned int charpause_len()
{
return m_interch;
}
inline unsigned int stringpause_len()
{
return m_interword;
}
inline unsigned int dot_len() const
{
return m_dot;
}
inline unsigned int line_len() const
{
return m_line;
}
inline unsigned int tone() const
{
return int(m_tone);
}
inline void set_tone(unsigned int t)
{
m_tone = t;
}
private:
libaudiostream::AudioWorkSpace m_aws;
libaudiostream::oastream m_audio;
unsigned int m_speed;
unsigned int m_count;
unsigned int m_interch;
unsigned int m_interword;
double m_tone;
unsigned int m_dot;
unsigned int m_line;
void play(unsigned int);
void char_pause();
void string_pause();
};
}
#endif // KEYER_H
07070100000015000081A400000000000000000000000151E5218700000C24000000000000000000000000000000000000001B00000000aldo-0.7.8/include/koch.hh// -*- C++ -*-
/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef KOCH_H
#define KOCH_H
#include "keyer.hh"
#include "skill.hh"
#include <string>
#include <list>
namespace libexercises
{
const unsigned int addgroup = 0;
const unsigned int addchar = 1;
const unsigned int addsymbol = 2;
class Koch
{
friend libkeyer::Keyer& operator<<(libkeyer::Keyer&, const Koch&);
private:
std::string m_strings;
std::string m_chars;
unsigned int m_num_chars;
unsigned int m_num_strings;
unsigned int m_skill;
unsigned int m_next_difficulty;
std::string randstring(std::string, unsigned int);
public:
// Koch(unsigned int, unsigned int, unsigned int, unsigned int);
Koch(std::string, unsigned int, unsigned int, unsigned int, unsigned int);
Koch(const Koch&);
~Koch();
void shuffle();
void next();
std::list<std::string> tokenize() const;
inline unsigned int skill() const
{
return m_skill;
}
inline std::string get_chars() const
{
return m_chars;
}
inline unsigned int strlen() const
{
return m_num_chars;
}
inline unsigned int strnum() const
{
return m_num_strings;
}
inline unsigned int difficulty() const
{
return m_next_difficulty;
}
};
libkeyer::Keyer& operator<<(libkeyer::Keyer&, const Koch&);
}
#endif //KOCH_H
07070100000016000081A400000000000000000000000151E5218700000E79000000000000000000000000000000000000001B00000000aldo-0.7.8/include/menu.hh// -*- C++ -*-
/***************************************************************************
libmenu
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef MENU_H
#define MENU_H
#include <string>
#include <vector>
namespace libmenu
{
class Menu;
enum item_type { none = 0, type1 = 1, type2 = 2};
typedef unsigned int id_type;
typedef void (*Function1)();
typedef void (*Function2)(Menu&);
class Item
{
private:
unsigned int m_id;
std::string m_caption;
item_type m_type;
Function1 m_cmd1;
Function2 m_cmd2;
public:
Item()
:m_id(0), m_type(none), m_cmd1(0), m_cmd2(0)
{}
Item(id_type id, std::string c, Function1 f1)
: m_id(id), m_caption(c), m_type(type1), m_cmd1(f1), m_cmd2(0)
{}
Item(id_type id, std::string c, Function2 f2)
: m_id(id), m_caption(c), m_type(type2), m_cmd1(0), m_cmd2(f2)
{}
Item(const Item& cpy);
std::string caption() const;
void exe(Menu&) const;
item_type get_type()
{
return m_type;
}
Item& operator=(const Item&);
inline id_type id() const
{
return m_id;
}
};
class Menu
{
private:
std::string m_title;
std::string m_prompt;
std::vector<Item> m_its;
bool m_running;
unsigned int m_last;
public:
Menu();
Menu(const std::string&, const std::string&);
Menu(const Menu& cpy);
void show();
void add_item(id_type, std::string, Function1);
void add_item(id_type, std::string, Function2);
void operator--();
void add_item_at(unsigned int, id_type, std::string, Function1);
void add_item_at(unsigned int, id_type, std::string, Function2);
void delete_item_at(unsigned int);
void delete_item(id_type);
bool find(id_type);
inline void set_title(std::string title)
{
m_title = title;
}
inline void set_prompt(std::string prompt)
{
m_prompt = prompt;
}
inline bool running() const
{
return m_running;
}
inline void close()
{
m_running = false;
}
inline unsigned last_selected()
{
return m_last;
}
};
}
#endif // MENU_H
07070100000017000081A400000000000000000000000151E52187000008DD000000000000000000000000000000000000001D00000000aldo-0.7.8/include/option.hh// -*- C++ -*-
/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef OPTION_H
#define OPTION_H
#include "exception.hh"
#include <string>
namespace libdatafile
{
class Option
{
private:
std::string m_name;
std::string m_valuestr;
unsigned int m_value;
public:
Option(const std::string&);
Option(const Option&);
void set(unsigned int);
void set(const std::string&);
unsigned int get() const;
std::string getstr() const;
std::string name() const;
};
}
#endif // OPTION_H
07070100000018000081A400000000000000000000000151E5218700000A32000000000000000000000000000000000000001A00000000aldo-0.7.8/include/qrz.hh// -*- C++ -*-
/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef QRZ_H
#define QRZ_H
#include "keyer.hh"
#include <string>
namespace libexercises
{
class Qrz
{
friend libkeyer::Keyer& operator<<(libkeyer::Keyer&, const Qrz&);
private:
std::string m_strings;
unsigned int m_num_chars;
unsigned int m_num_strings;
public:
Qrz(): m_num_chars(0), m_num_strings(0)
{
m_strings.clear();
}
Qrz(const std::string &, unsigned int);
Qrz(const Qrz&);
unsigned int verify(const std::string&) const;
inline unsigned int string_len() const
{
return m_num_chars;
}
inline unsigned int len() const
{
return m_num_strings;
}
inline std::string get_string() const
{
return m_strings;
}
};
libkeyer::Keyer& operator<<(libkeyer::Keyer&, const Qrz&);
}
#endif //QRZ_H
07070100000019000081A400000000000000000000000151E5218700000807000000000000000000000000000000000000001D00000000aldo-0.7.8/include/random.hh// -*- C++ -*-
/***************************************************************************
librandom part of Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
improved : Bob Harrington
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
***************************************************************************/
#ifndef RANDOM_H
#define RANDOM_H
namespace librandom
{
class Random
{
private:
unsigned long m_seed;
unsigned long m_count;
public:
Random();
int integer(int max);
int integer(int min, int max);
};
}
#endif // RANDOM_H
0707010000001A000081A400000000000000000000000151E52187000018E5000000000000000000000000000000000000002000000000aldo-0.7.8/include/resources.hh// -*- C++ -*-
/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define chkmsg_1 "Please input the signs you copied."
#define chkmsg_2 "If you didn't copy a sign, put '@'."
#define fbkmsg_title "EVALUATION"
#define ovrmsg_title "Overall success rate"
#define smbmsg_title "Success rate per symbol"
#define smbmsg_symbol "symbol"
#define smbmsg_copied "copied"
#define smbmsg_keyed "keyed"
#define smbmsg_correct "correct"
#define smbmsg_incorrect "incorrect"
#define smbmsg_missed "missed"
#define smbmsg_percent "percentages"
#define cmpmsg_title "Comparison between keyed and copied sign groups"
#define cmpmsg_group "Group index"
#define cmpmsg_correct "correct"
#define cmpmsg_incorrect "incorrect"
#define cmpmsg_missed "missed"
#define cmpmsg_keyed "Keyed signs = what was transmitted"
#define cmpmsg_copied "Copied signs = what you have input"
#define errmsg_noformat "Configuration file is incorrectly formatted"
#define errmsg_overwrite "You have tried to overwrite the configuration file"
#define errmsg_nooption "Can't find an option in the configuration file"
#define errmsg_nosection "Can't find section in the configuration file"
#define errmsg_noopenfile "Can't open the configuration file"
#define errmsg_nofile "The configuration file doesn't exist"
#define errmsg_conf "Select Default Settings in the Setup Menu"
#define errmsg_devicefile "Can't write on device file "
#define errmsg_rate "Wrong rate"
#define errmsg_format "Format error"
#define errmsg_fragment "Fragment error"
#define errmsg_stereo "Stereo error"
#define main_menu_title "Aldo " VERSION " Main Menu"
#define main_menu_prompt "Your choice"
#define main_menu_item1 "Blocks method"
#define main_menu_item2 "Koch method"
#define main_menu_item3 "Read from file"
#define main_menu_item4 "Callsigns"
#define main_menu_item5 "Setup"
#define main_menu_item6 "Exit"
#define msg_start "About to start keying. Get ready..."
#define msg_changes "Change these settings from the Setup Menu."
#define msg_speed "Keying speed: "
#define msg_strlen "String length: "
#define msg_skill "Training character set: "
#define msg_strnum "Number of strings: "
#define msg_callformat "Template callsign: "
#define dlg_skill_title "Select training character set"
#define dlg_skill_choice1 "e,i,s,h,t,m,o"
#define dlg_skill_choice2 "e,i,s,h,t,m,o,a,j,w,v,u"
#define dlg_skill_choice3 "e,i,s,h,t,m,o,a,w,j,u,v,n,d,b,g"
#define dlg_skill_choice4 "e,i,s,h,t,m,o,a,w,j,u,v,n,d,b,g,r,p,l,f"
#define dlg_skill_choice5 "e,i,s,h,t,m,o,a,w,j,u,v,n,d,b,g,r,p,l,f,k,c,y,q,z,x"
#define dlg_skill_choice6 "All chars and numbers"
#define dlg_skill_choice7 "Custom character set"
#define dlg_skill2_title "Add a group or option to your exercise:"
#define dlg_skill2_choice1 "e,i,s,h,t,m,o"
#define dlg_skill2_choice2 "a,w,j,v,u"
#define dlg_skill2_choice3 "n,d,b,g"
#define dlg_skill2_choice4 "r,p,l,f"
#define dlg_skill2_choice5 "k,c,y,q,z,x"
#define dlg_skill2_choice6 "0123456789"
#define dlg_skill2_choice7 "Chars ordered "
#define dlg_skill2_choice8 "Chars submixed with group order "
#define dlg_skill2_choice9 "Chars mixed without group order "
#define dlg_skill2_choice10 "End"
#define dlg_koch_title "Do you want to continue with the Koch method?"
#define dlg_koch_continue "Yes"
#define dlg_koch_exit "No"
#define insert_device "Soundcard device name/file"
#define insert_samplerate "Sample rate"
#define insert_samplesize "Sample size"
#define insert_beginpause "Pause before keying (seconds)"
#define insert_charpause "Length of space between two characters in a word (number of dots)"
#define insert_strpause "Length of space between two words (number of dots)"
#define insert_dotlen "Dit length"
#define insert_linelen "Dah length"
#define insert_tone "Frequency of buzzer (Hz)"
#define insert_chars "Training character set"
#define insert_pos "Starting position"
#define insert_wpm "Keying speed (words per minute)"
#define insert_strlen "Length of strings"
#define insert_filename "Name of file to read"
#define insert_strnum "Number of strings to send"
#define insert_callformat "Enter callsign template"
#define conf_menu_title "Setup Menu"
#define conf_menu_item1 "Keyer Setup"
#define conf_menu_item2 "Blocks method Setup"
#define conf_menu_item3 "Koch method Setup"
#define conf_menu_item4 "Qrz exercise Setup"
#define conf_menu_item5 "Default Settings"
#define conf_menu_item6 "Return to Main Menu"
0707010000001B000081A400000000000000000000000151E5218700000942000000000000000000000000000000000000001E00000000aldo-0.7.8/include/section.hh// -*- C++ -*-
/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef SECTION_H
#define SECTION_H
#include "option.hh"
#include <list>
namespace libdatafile
{
typedef std::list <Option>::iterator opt_it;
class Section
{
private:
std::string m_name;
std::list <Option> m_options;
public:
std::string name() const;
Section(const std::string& title);
Section(const Section&);
void add_option(const std::string& name);
void remove(const std::string& name);
opt_it option(const std::string& name);
opt_it begin();
opt_it end();
};
}
#endif //SECTION_H
0707010000001C000081A400000000000000000000000151E5218700000AB0000000000000000000000000000000000000001C00000000aldo-0.7.8/include/skill.hh// -*- C++ -*-
/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef SKILL_H
#define SKILL_H
namespace libexercises
{
const unsigned int chars1 = 0x01; // e,i,s,h,t,m,o
const unsigned int chars2 = 0x02; // a,w,j,v,u
const unsigned int chars3 = 0x04; // n,d,b,g
const unsigned int chars4 = 0x08; // r,p,l,f
const unsigned int chars5 = 0x10; // k,c,y,q,z,x
const unsigned int numbrs = 0x20; // 0,1,2,3,4,5,6,7,8,9
const unsigned int mixed = 0x40; // totaly mixed
const unsigned int submixed = 0x80; // group mixed
const unsigned int skill1 = chars1 | mixed;
const unsigned int skill2 = skill1 | chars2; // chars1 + chars2
const unsigned int skill3 = skill2 | chars3; // skill2 + chars2
const unsigned int skill4 = skill3 | chars4; // skill3 + chars3
const unsigned int skill5 = skill4 | chars5; // skill4 + chars5
const unsigned int skill6 = skill5 | numbrs; // skill5 + numbers
}
#endif // SKILL_H
0707010000001D000081A400000000000000000000000151E5218700000966000000000000000000000000000000000000001F00000000aldo-0.7.8/include/textfile.hh// -*- C++ -*-
/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef TEXTFILE_H
#define TEXTFILE_H
#include "keyer.hh"
#include <string>
namespace libexercises
{
class TextFile
{
friend libkeyer::Keyer& operator<<(libkeyer::Keyer&, const TextFile&);
private:
std::string m_strings;
std::string m_filename;
public:
TextFile()
{
m_strings.clear();
m_filename.clear();
}
TextFile(std::string);
TextFile(const TextFile&);
inline std::string get_string() const
{
return m_strings;
}
};
libkeyer::Keyer& operator<<(libkeyer::Keyer&, const TextFile&);
}
#endif //TEXTFILE_H
0707010000001E000081A400000000000000000000000151E52187000009DF000000000000000000000000000000000000001B00000000aldo-0.7.8/include/wave.hh// -*- C++ -*-
/***************************************************************************
libaudiostream
--------------------
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 9 Mar 2002
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef WAVE_H
#define WAVE_H
namespace libaudiostream
{
typedef char* samples_buffer_pointer;
typedef char sample_type;
typedef unsigned int size_type;
class Wave
{
public:
explicit Wave(size_type);
explicit Wave(size_type, samples_buffer_pointer);
Wave(const Wave&);
~Wave();
inline samples_buffer_pointer get_buffer() const
{
return m_data;
}
inline size_type size() const
{
return m_size;
}
void set(size_type, int);
void reverse();
void bias(sample_type);
void amplify(sample_type);
Wave& operator+(const Wave&);
Wave& operator=(const Wave&);
protected:
size_type m_size;
samples_buffer_pointer m_data;
};
}
#endif //WAVE_H
0707010000001F000041ED00000000000000000000000251E5218700000000000000000000000000000000000000000000000F00000000aldo-0.7.8/src07070100000020000081A400000000000000000000000151E521870000032A000000000000000000000000000000000000001B00000000aldo-0.7.8/src/Makefile.am# Copyright (C) 2005 Giuseppe Martino <denever@users.sf.net>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bin_PROGRAMS = aldo
aldo_SOURCES = astream.cc blocks.cc datafile.cc koch_exc.cc menu.cc qrz.cc random.cc setup.cc textfile_exc.cc\
check.cc blocks_exc.cc keyer.cc main.cc option.cc qrz_exc.cc section.cc textfile.cc wave.cc\
audioworkspace.cc koch.cc
aldo_CXXFLAGS = -ansi -Wall -pedantic
AM_CPPFLAGS = -I$(top_srcdir)/include
07070100000021000081A400000000000000000000000151E5218700000DD7000000000000000000000000000000000000001A00000000aldo-0.7.8/src/astream.cc/***************************************************************************
libaudiostream
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 9 Mar 2002
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "wave.hh"
#include "astream.hh"
#include <limits>
using namespace std;
using namespace libaudiostream;
oastream::oastream(ao_sample_format format, string device = "default")
throw(AudioException):
m_format(format)
{
ao_option *options = NULL;
const char *devstr = NULL;
ao_initialize();
if( (m_default_driver = ao_default_driver_id()) < 0)
throw AudioException("There is no default driver.");
if (device == "default")
devstr = NULL;
else if ((m_default_driver == ao_driver_id("alsa"))
|| m_default_driver == ao_driver_id("sun")
|| m_default_driver == ao_driver_id("aixs"))
devstr = "dev";
else if (m_default_driver == ao_driver_id("esd"))
devstr = "host";
else if (m_default_driver == ao_driver_id("oss"))
devstr = "dsp";
if (devstr) {
if (ao_append_option(&options, "dev", device.c_str()) != 1)
throw AudioException("Error appending 'device' option");
}
m_audio = ao_open_live(m_default_driver, &m_format, options);
ao_free_options(options);
if(!m_audio)
throw AudioException("Error opening device");
}
oastream::oastream(const oastream& cpy)
{
m_audio = cpy.m_audio;
m_format = cpy.m_format;
m_default_driver = cpy.m_default_driver;
}
oastream& oastream::operator=(const oastream& cpy)
{
m_audio = cpy.m_audio;
m_format = cpy.m_format;
m_default_driver = cpy.m_default_driver;
return *this;
}
oastream& oastream::operator<<(const Wave& wave) throw(AudioException)
{
if(m_audio)
ao_play(m_audio, wave.get_buffer(), wave.size() );
else
throw AudioException("Error opening device");
return *this;
}
oastream::~oastream()
{
ao_close(m_audio);
ao_shutdown();
}
07070100000022000081A400000000000000000000000151E52187000010ED000000000000000000000000000000000000002100000000aldo-0.7.8/src/audioworkspace.cc/***************************************************************************
This is part of libaudiostream
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 6 Aug 2005
email : denever [at] users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "audioworkspace.hh"
#include "astream.hh"
#include <ao/ao.h>
#include <cmath>
#include <iostream>
#include <limits>
#include <string.h>
using namespace std;
using namespace libaudiostream;
int offset = numeric_limits<short>::max()/2 - 1;
AudioWorkSpace::AudioWorkSpace(std::string device):
m_bits(16), m_sample_rate(44100), m_channels(2), m_byte_format(AO_FMT_LITTLE), m_device(device)
{
}
AudioWorkSpace::AudioWorkSpace(size_type b, size_type sr, size_type ch, size_type bf, string device):
m_bits(b), m_sample_rate(sr), m_channels(ch), m_byte_format(bf), m_device(device)
{
}
AudioWorkSpace::AudioWorkSpace(const Wave&)
{}
AudioWorkSpace::~AudioWorkSpace()
{}
Wave AudioWorkSpace::gen_pause(size_type millisecond)
{
size_type sample_number = millisecond * m_sample_rate/1000;
size_type len = m_bits/8 * m_channels * sample_number;
char* buffer = new char[len];
for(unsigned int i = 0; i<sample_number; i++)
{
buffer[4*i] = buffer[4*i+2] = 0;
buffer[4*i+1] = buffer[4*i+3] = 0;
}
Wave w(len, buffer);
return w;
}
Wave AudioWorkSpace::gen_sine_wave(size_type millisecond, double frequency, double phase)
{
size_type sample_number = millisecond * m_sample_rate/1000;
size_type len = m_bits/8 * m_channels * sample_number;
char* buffer = new char[len];
for(unsigned int i = 0; i < sample_number; i++)
{
int sample = (int)(0.75 * 32768.0 * sin(2 * M_PI * frequency * ((float) i/m_sample_rate)));
unsigned int rt = 30; //rise-time (inspired by qrq)
unsigned int ft = 30; //fall-time (inspired by qrq)
if ( i < rt ) { sample *= sin(M_PI*i/(2.0*rt)); }
if ( i > (sample_number - ft) ) { sample *= sin(2*M_PI*(i- (sample_number - ft) +ft)/(4.0*ft)) ; }
buffer[4*i] = buffer[4*i+2] = sample & 0xff;
buffer[4*i+1] = buffer[4*i+3] = (sample >> 8) & 0xff;
}
Wave w(len, buffer);
return w;
}
oastream AudioWorkSpace::create_output_stream()
{
ao_sample_format format;
memset(&format, 0, sizeof(format));
format.bits = m_bits;
format.channels = m_channels;
format.rate = m_sample_rate;
format.byte_format = AO_FMT_LITTLE;
format.matrix = NULL;
return oastream(format, m_device);
}
/*
double SineWave::get_phase()
{
return m_duration*m_frequency*2*M_PI/m_samplerate;
}
{
phase += frequency * 2 * M_PI/m_sample_rate;
int sample = int(32768 + 0.75 * 32768.0 * std::sin(phase));
w.set(i, sample);
}
*/
07070100000023000081A400000000000000000000000151E521870000187E000000000000000000000000000000000000001900000000aldo-0.7.8/src/blocks.cc/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
improved : Bob Harrington
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "blocks.hh"
#include "random.hh"
using namespace std;
using namespace libexercises;
// These are group of chars and numbers ordered by skill
#define group_chars1 string("eishtmo")
#define group_chars2 string("awjuv")
#define group_chars3 string("ndbg")
#define group_chars4 string("rplf")
#define group_chars5 string("kcyqzx")
#define group_numbrs string("0123456789")
// give a random string from input
string Blocks::randstring(string input, unsigned int num)
{
unsigned int size = input.size();
librandom::Random RND;
string output;
output.clear();
while(num!=0)
{
unsigned int pos = RND.integer(0, size-1);
output +=input[pos];
num--;
}
return output;
}
string Blocks::gen(string input, unsigned int num) // output a string (of size num) chars taken from input
{
string output;
output.clear();
unsigned int i = 0;
while(num)
{
output += input[i];
num--;
i++;
if(i==input.size()) i=0;
}
return output;
}
unsigned int Blocks::share()
{
// Count number of group_chars used in this skill
unsigned int val = m_skill & 0x3F;
unsigned int counter = 0;
do
{
if(val & 0x01)
counter++;
val = val >> 1;
}
while(val);
unsigned int total = m_num_strings * m_num_chars;
unsigned int bound = total/counter;
if(total % counter)
bound++;
return bound; // bound is number of chars on total that will belong to a group_chars
}
Blocks::Blocks(unsigned int num, unsigned int s, unsigned int numch):
m_num_chars(numch), m_num_strings(num), m_skill(s)
{
if(m_skill & mixed)
m_prepare_mixed();
if(m_skill & submixed)
m_prepare_submixed();
if((m_skill & 0xC0) == 0)
m_prepare_ordered();
}
Blocks::Blocks(const Blocks& cpy)
{
m_strings = cpy.m_strings;
}
void Blocks::m_prepare_mixed()
{
if(m_skill & chars1) // if is used in skill group_chars1
m_strings += group_chars1;
if(m_skill & chars2) // So on..
m_strings += group_chars2;
if(m_skill & chars3)
m_strings += group_chars3;
if(m_skill & chars4)
m_strings += group_chars4;
if(m_skill & chars5)
m_strings += group_chars5;
if(m_skill & numbrs)
m_strings += group_numbrs;
m_strings = randstring(m_strings, m_num_chars * m_num_strings);
}
void Blocks::m_prepare_submixed()
{
unsigned int bound = share();
if(m_skill & chars1) // if is used in skill group_chars1
m_strings += randstring(group_chars1, bound);
if(m_skill & chars2) // So on..
m_strings += randstring(group_chars2, bound);
if(m_skill & chars3)
m_strings += randstring(group_chars3, bound);
if(m_skill & chars4)
m_strings += randstring(group_chars4, bound);
if(m_skill & chars5)
m_strings += randstring(group_chars5, bound);
if(m_skill & numbrs)
m_strings += randstring(group_numbrs, bound);
m_strings = m_strings.substr(0, m_num_chars * m_num_strings);
}
void Blocks::m_prepare_ordered()
{
unsigned int bound = share();
if(m_skill & chars1)
m_strings += gen(group_chars1, bound);
if(m_skill & chars2)
m_strings += gen(group_chars2, bound);
if(m_skill & chars3)
m_strings += gen(group_chars3, bound);
if(m_skill & chars4)
m_strings += gen(group_chars4, bound);
if(m_skill & chars5)
m_strings += gen(group_chars5, bound);
if(m_skill & numbrs)
m_strings += gen(group_numbrs, bound);
m_strings = m_strings.substr(0, m_num_chars * m_num_strings);
}
Blocks::~Blocks()
{
m_strings.clear();
}
libkeyer::Keyer& libexercises::operator<<(libkeyer::Keyer& out, const Blocks& exc)
{
std::list<std::string> lks = exc.tokenize();
typedef std::list< std::string >::const_iterator c_str;
for(c_str lks_it = lks.begin(); lks_it != lks.end(); lks_it++)
out << *lks_it;
return out;
}
std::list<std::string> Blocks::tokenize() const
{
std::list<std::string> tmp_list;
string tmp_str;
unsigned int count = 0;
for(unsigned i=0; i < m_strings.size(); ++i)
{
if(count == m_num_chars)
{
tmp_list.push_back(tmp_str);
tmp_str.clear();
count = 0;
}
tmp_str += m_strings[i];
count++;
}
tmp_list.push_back(tmp_str);
return tmp_list;
}
/*
unsigned int Blocks::execute()
{
current_keyer << blocks_exc;
sleep(beginpause);
check(blocks_exc);
}
*/
07070100000024000081A400000000000000000000000151E52187000012E6000000000000000000000000000000000000001D00000000aldo-0.7.8/src/blocks_exc.cc/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "resources.hh"
#include "dialog.hh"
#include "blocks.hh"
#include "keyer.hh"
#include "datafile.hh"
#include <iostream>
#include <string>
#include <unistd.h>
#include <cstdlib>
using namespace std;
unsigned int check(const libexercises::Blocks&);
std::string skillname(unsigned int);
void OnBlocks()
{
string fileconf_name(getenv("HOME"));
fileconf_name += "/.aldorc";
libdatafile::Datafile fileconf(fileconf_name, libdatafile::Read); // read config from ~/.aldorc
libdatafile::sec_it keyer_sec = fileconf.section("Keyer");
unsigned int beginpause = keyer_sec->option("BeginPause")->get();
unsigned int speed = keyer_sec->option("Speed")->get();
unsigned int charpause = keyer_sec->option("CharPause")->get();
unsigned int strpause = keyer_sec->option("StringPause")->get();
unsigned int dotlen = keyer_sec->option("DotLength")->get();
unsigned int linelen = keyer_sec->option("LineLength")->get();
unsigned int tone = keyer_sec->option("Tone")->get();
string device = keyer_sec->option("Device")->getstr();
libdatafile::sec_it quick_sec = fileconf.section("Blocks");
unsigned int strlen = quick_sec->option("StringLength")->get();
unsigned int strnum = quick_sec->option("StringsNumber")->get();
unsigned int skill = quick_sec->option("Skill")->get();
libaudiostream::AudioWorkSpace aws(device);
libkeyer::Keyer current_keyer(aws, speed, charpause, strpause, dotlen, linelen);
current_keyer.set_tone(tone);
cout<<msg_speed<<speed<<" wpm"<<endl;
cout<<msg_strlen<<strlen<<endl;
cout<<msg_strnum<<strnum<<endl;
cout<<msg_skill<<skillname(skill)<<endl;
cout<<msg_start<<endl;
libexercises::Blocks blocks_exc(strnum, skill, strlen);
sleep(beginpause);
current_keyer<<blocks_exc;
sleep(beginpause);
check(blocks_exc);
}
std::string skillname(unsigned int v)
{
bool comma = false;
string output;
output.clear();
if(v & libexercises::chars1)
{
output += std::string(dlg_skill_choice1);
comma = true;
}
if(v & libexercises::chars2)
{
if(comma)
output += ",";
output += std::string(dlg_skill2_choice2);
}
if(v & libexercises::chars3)
{
if(comma)
output += ",";
output += std::string(dlg_skill2_choice3);
}
if(v & libexercises::chars4)
{
if(comma)
output += ",";
output += std::string(dlg_skill2_choice4);
}
if(v & libexercises::chars5)
{
if(comma)
output += ",";
output += std::string(dlg_skill2_choice5);
}
if(v & libexercises::numbrs)
{
if(comma)
output += ",";
output += std::string(dlg_skill2_choice6);
}
output += "\n";
if(v & libexercises::submixed)
{
output += std::string(dlg_skill2_choice8);
}
if(v & libexercises::mixed)
{
output += std::string(dlg_skill2_choice9);
}
if((v & 0xC0) == 0)
{
output += std::string(dlg_skill2_choice7);
}
return output;
}
07070100000025000081A400000000000000000000000151E5218700003827000000000000000000000000000000000000001800000000aldo-0.7.8/src/check.cc/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "resources.hh"
#include "blocks.hh"
#include "koch.hh"
#include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <map>
// width of screen in characters
#define TERMINAL_WIDTH 80
// markers for the correspondence between keyed symbol and copied symbol
#define CORRECT_MARKER '.'
#define INCORRECT_MARKER '!'
#define MISSED_MARKER '@'
using namespace std;
typedef map<char, unsigned int>::const_iterator c_map;
typedef list< string >::const_iterator c_lststr;
typedef string::const_iterator c_str;
/*
* Returns a string truncated or padded to a given length. The padding is to
* the right and the padding character is 'MISSED_MARKER'.
*/
string padding(unsigned int len, const string& b)
{
int s = len - b.size();
if(s > 0)
return b + string(s,MISSED_MARKER);
if(s < 0)
return string(b, 0, len);
return b;
}
/*
* This function computes the width in characters for representing an integer
* in base 10. It is useful in determining the maximum with needed for
* displaying a loop counter, such that vertical alignment can be achieved.
*/
size_t width_base_10(const size_t n)
{
size_t n_width = 0;
for (size_t n_max = n; n_max > 0; n_max /= 10) {
++n_width;
}
return n_width;
}
/*
* This function displays the copy success rate.
*/
void display_overall_rate(const unsigned int percentage)
{
cout<<endl<<ovrmsg_title<<": ";
cout.width(3);
cout<<percentage<<'%'<<endl;
}
/*
* This function displays the copy success rate per keyed symbol.
*/
void display_symbol_rate(const list<string>& lks, const list<string>& lcs)
{
map<char, unsigned int> keyed_all;
map<char, unsigned int> keyed_bad;
map<char, unsigned int> keyed_missed;
map<char, unsigned int> copied_all;
map<char, unsigned int> copied_good;
map<char, unsigned int> copied_bad;
// compute results
// iterate over the lists of strings
c_lststr lks_it;
c_lststr lcs_it;
for(lks_it = lks.begin(), lcs_it = lcs.begin();
lks_it != lks.end() && lcs_it != lcs.end();
++lks_it, ++lcs_it
)
{
// ensure that the copied string is as long as the keyed string,
// padding it with 'MISSED_MARKER' if necessary
string copied = padding((*lks_it).size(), *lcs_it);
// iterate over the characters in each group
c_str kit;
c_str cit;
for(kit = (*lks_it).begin(), cit = copied.begin();
kit != (*lks_it).end();
++kit, ++cit
)
{
char kc = *kit; // keyed symbol
char cc = *cit; // copied sybmol
keyed_all[kc]++; // mark keyed symbol
copied_all[cc]++; // mark copied symbol
if(kc == cc)
{
// keyed symbol was copied correctly
copied_good[cc]++;
}
else if(cc != MISSED_MARKER)
{
// keyed symbol was copied incorrectly
keyed_bad[kc]++;
copied_bad[cc]++;
}
else
{
// keyed symbol was missed
keyed_missed[kc]++;
}
}
}
// display results
cout<<endl<<smbmsg_title<<':'<<endl; // display feedback category "title"
cout << '"' << smbmsg_symbol << ':'
<< smbmsg_keyed << " = " << smbmsg_correct << " + " << smbmsg_incorrect << " + " << smbmsg_missed
<< " (" << smbmsg_percent << "); "
<< smbmsg_copied << " = " << smbmsg_correct << " + " << smbmsg_incorrect
<< " (" << smbmsg_percent << ")\"" << endl
<< endl;
// loop over maps
char c;
size_t count_width = width_base_10(lks.size() * lks.front().size());
for(c_map mtc = keyed_all.begin(); mtc != keyed_all.end(); ++mtc)
{
c = (*mtc).first;
// symbol
cout << c << ":";
// sum of counts for keyed symbols
cout.width(count_width);
cout << keyed_all[c] << " = ";
cout.width(count_width);
cout << copied_good[c] << " + ";
cout.width(count_width);
cout << keyed_bad[c] << " + ";
cout.width(count_width);
cout << keyed_missed[c];
// sum of percentages for keyed symbols
cout << " (";
if (keyed_all[c] != 0)
{
cout.width(3);
cout << 100*copied_good[c]/keyed_all[c] << "% + ";
cout.width(3);
cout << 100*keyed_bad[c]/keyed_all[c] << "% + ";
cout.width(3);
cout << 100*keyed_missed[c]/keyed_all[c] << '%';
}
else
{
cout << "?% + ?% + ?%";
}
cout << "); ";
// sum of counts for copied symbols
cout.width(count_width);
cout << copied_all[c] << " = ";
cout.width(count_width);
cout << copied_good[c] << " + ";
cout.width(count_width);
cout << copied_bad[c];
// sum of percentages for copied symbols
cout << " (";
if (copied_all[c] != 0)
{
cout.width(3);
cout << 100*copied_good[c]/copied_all[c] << "% + ";
cout.width(3);
cout << 100*copied_bad[c]/copied_all[c] << '%';
}
else
{
cout << "?% + ?%";
}
cout << ')' << endl;
}
}
/*
* This function takes a keyed sign group and a copied sign group and
* generates a mistakes string of the same length. The mistakes string
* contains mistake marker characters at the positions where the keyed
* and the copied strings differ and unobtrusive spacer characters at
* the other positions.
*/
string mark_mistakes(const string keyed, const string copied)
{
string mistakes; // start with empty string
c_str kit = keyed.begin();
c_str cit = copied.begin();
while(kit != keyed.end())
if(cit != copied.end())
{
if(*kit == *cit)
mistakes += CORRECT_MARKER; // unobtrusive spacer
else if(*cit == MISSED_MARKER)
mistakes += MISSED_MARKER; // missed symbol
else
mistakes += INCORRECT_MARKER; // incorrect copy
++kit;
++cit;
}
else
{
mistakes += MISSED_MARKER;
++kit;
}
return mistakes;
}
list<string> get_marked_strings(const list<string>& lks, const list<string>& lcs)
{
list< string > lms; //list of marked strings
c_lststr lks_it = lks.begin();
c_lststr lcs_it = lcs.begin();
while(lks_it != lks.end())
if(lcs_it != lcs.end())
{
lms.push_back(mark_mistakes(*lks_it, *lcs_it));
++lks_it;
++lcs_it;
}
else
{
lms.push_back( string((*lks_it).size(), INCORRECT_MARKER) );
++lks_it;
}
return lms;
}
/*
* This function displays the keyed sign groups and the copied sign groups
* alongside each other, accompanied by markers which indicate the positions
* of the copying mistakes.
*/
void display_comparison(const list<string>& lks, const list<string>& lcs)
{
// display evaluation header
cout<<endl<<cmpmsg_title<<':'<<endl; // display feedback category "title"
string legend_indent = string( string(cmpmsg_group).length(), ' '); // indentation string
cout << '"' << cmpmsg_group << ':'
<< '\'' << CORRECT_MARKER << "'=" << cmpmsg_correct << ", "
<< '\'' << MISSED_MARKER << "'=" << cmpmsg_missed << ", "
<< '\'' << INCORRECT_MARKER << "'=" << cmpmsg_incorrect << endl
<< legend_indent << "k:" << cmpmsg_keyed << endl
<< legend_indent << "c:" << cmpmsg_copied << '"' << endl
<< endl;
// build evaluation cells (on three rows)
// combine parameter lists into a list of mistake strings
list<string> lms = get_marked_strings(lks, lcs);
// temporary variables for preparing output lines
ostringstream mistaken_row_formatter;
string mistaken_row;
string keyed_row;
string copied_row;
// how many characters are needed for representing the highest index
size_t n_width = width_base_10(lks.size());
// indentation string for keyed and copied strings
string indent = string(n_width, ' ');
// format the evaluation strings
// (loop with iterators over the lists of strings)
unsigned int n;
c_lststr lms_it = lms.begin();
c_lststr lks_it = lks.begin();
c_lststr lcs_it = lcs.begin();
for(
n = 1
;
lms_it != lms.end() &&
lks_it != lks.end() &&
lcs_it != lcs.end()
;
++n,
++lms_it,
++lks_it,
++lcs_it
)
{
mistaken_row_formatter << " ";
mistaken_row_formatter.width(n_width);
mistaken_row_formatter << n << ":" << *lms_it;
keyed_row += indent + "k:" + *lks_it;
copied_row += indent + "c:" + padding((*lks_it).size(), *lcs_it);
}
mistaken_row = mistaken_row_formatter.str();
// display evaluation cells, breaking the lines at or before TERMINAL_WIDTH
// (TERMINAL_WIDTH / cell_width) feedback cells fit on a row
// cell_width is the sum of:
// 1 character blank to separate the cells
// n_width characters for the counter
// 1 character blank between the counter and the sign group
// size() characters for the sign group
unsigned int cell_width = 2 + n_width + lks.front().size();
// how many characters to use in a screen row,
// such that lines break at cell border
unsigned int used_width = (TERMINAL_WIDTH / cell_width) * cell_width;
// loop over the screen rows
for(size_t pos = 0; pos < mistaken_row.size(); pos += used_width)
{
// display output lines
cout << mistaken_row.substr(pos, used_width) << endl; // e.g. 12:!.!.@@!
cout << keyed_row.substr(pos, used_width) << endl; // eishtmo
cout << copied_row.substr(pos, used_width) << endl; // aibh@@d
cout << endl;
}
}
/*
* This function lets the user input the copied sign groups
*/
list<string> get_copied_strings(unsigned int num_groups)
{
list<string> lcs;
cout << endl << chkmsg_1 << endl;
cout << chkmsg_2 << endl;
// how many characters are needed for representing the highest index
int i_width = width_base_10(num_groups);
for(unsigned int i=0; i<num_groups; i++)
{
string tmp;
do
{
cout.width(i_width);
cout << (i+1) << ": ";
cin.clear();
}
while(! getline(cin, tmp));
lcs.push_back(tmp);
}
return lcs;
}
/*
* This function compares two strings and returns lets the user input the copied sign groups
*/
unsigned int count_wrong_letters(string keyed, string copied)
{
unsigned int wrong_letters = 0;
c_str kit = keyed.begin();
c_str cit = copied.begin();
while(kit != keyed.end())
if(cit != copied.end())
{
if(*kit != *cit)
wrong_letters++;
++kit;
++cit;
}
else
{
wrong_letters++;
++kit;
}
//wrong_letters = keyed.size(); // if copied key has a different lenght of keyed all letters are wrong
return wrong_letters;
}
unsigned int get_overall_rate(const list<string>& lks, const list<string>& lcs)
{
double wrong_letters = 0.0;
double total = 0.0;
c_lststr lks_it = lks.begin();
c_lststr lcs_it = lcs.begin();
while(lks_it != lks.end())
{
total += (*lks_it).size();
if(lcs_it != lcs.end())
{
wrong_letters += count_wrong_letters(*lks_it, *lcs_it);
++lks_it;
++lcs_it;
}
else
{
wrong_letters += (*lks_it).size();
++lks_it;
}
}
double wrong_tax = wrong_letters/total;
return int(100 - 100 * wrong_tax);
}
/*
* This function lets the user input the copied sign groups and displays
* information about how well an exercise was completed.
* Its goal is to help the user discover the areas where improvement is possible.
*/
unsigned int check(const libexercises::Blocks& current_exercise)
{
list<string> lks = current_exercise.tokenize(); // list of keyed strings
list<string> lcs = get_copied_strings(lks.size()); // list of copied strings
cout << endl << fbkmsg_title << endl; // introduce the feedback information
unsigned int overall_rate = get_overall_rate(lks, lcs); // overall success rate
display_overall_rate(overall_rate); // display overall success rate
display_symbol_rate(lks, lcs); // display success rate per keyed symbol
display_comparison(lks, lcs); // display comparison between keyed and copied sign groups
cout<<endl;
return overall_rate;
}
/*
* This function lets the user input the copied sign groups and displays
* feedback about how it went.
*/
unsigned int check(const libexercises::Koch& current_exercise)
{
list<string> lks = current_exercise.tokenize(); // list of keyed strings
list<string> lcs = get_copied_strings(lks.size()); // list of copied strings
cout << endl << fbkmsg_title << endl; // introduce the feedback information
unsigned int overall_rate = get_overall_rate(lks, lcs); // overall success rate
display_overall_rate(overall_rate); // display overall success rate
display_symbol_rate(lks, lcs); // display success rate per keyed symbol
display_comparison(lks, lcs); // display comparison between keyed and copied sign groups
cout<<endl;
return overall_rate;
}
07070100000026000081A400000000000000000000000151E5218700001241000000000000000000000000000000000000001B00000000aldo-0.7.8/src/datafile.cc/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "datafile.hh"
#include <fstream>
#include <sstream>
#include <cctype>
using namespace std;
using namespace libdatafile;
Datafile::Datafile(const string& name, const access& a = Read): m_opened(false), m_filename(name), m_access(a)
{
m_sections.clear();
if( (m_access == Read) || (m_access == Update) )
open();
}
Datafile::Datafile(const Datafile& cpy): m_opened(cpy.m_opened), m_filename(cpy.m_filename), m_access(cpy.m_access)
{
m_sections = cpy.m_sections;
}
Datafile::~Datafile()
{
if((m_access == Write) || (m_access == Update) || (m_access == Create))
save();
}
void Datafile::open()
{
ifstream stream(m_filename.c_str());
string alfa;
string section_name;
char ch;
alfa.clear();
section_name.clear();
bool comment = false;
if(stream.fail())
throw libdatafile::File_not_exist(m_filename.c_str());
while(stream.get(ch))
switch(ch)
{
case '[': // New Section
if(!comment)
{
section_name.clear();
break;
}
case ']': // Create Section
if(!comment)
{
section_name = alfa;
alfa.clear();
add_section(section_name);
break;
}
case '#':
comment = true;
break;
case '=':
if(!comment) // Create an option
{
section(section_name)->add_option(alfa);
string tmpstr;
stream >> tmpstr;
if(isdigit(tmpstr[0]))
{
istringstream tmps (tmpstr);
int tmp;
tmps>>tmp;
section(section_name)->option(alfa)->set(tmp);
}
else
section(section_name)->option(alfa)->set(tmpstr);
alfa.clear();
}
case '\n':
comment = false;
alfa.clear();
break;
default:
if(!comment)
if(!isspace(ch))
alfa += ch;
}
}
void Datafile::save()
{
ofstream out(m_filename.c_str());
out.clear();
for(sec_it i=begin(); i!=end(); i++)
{
out<<endl<<"["<<i->name()<<"]"<<endl;
for(opt_it j=i->begin(); j!=i->end(); j++)
{
out<<j->name()<<" = ";
if(j->get() != 9999)
out<<j->get()<<endl;
else
out<<j->getstr()<<endl;
}
}
out.close();
}
sec_it Datafile::section(const string& name)
{
if(m_sections.empty())
throw libdatafile::File_not_opened(m_filename.c_str());
for(sec_it i=m_sections.begin(); i!=m_sections.end(); i++)
if(i->name() == name)
return i;
throw libdatafile::Section_not_found(name.c_str());
}
void Datafile::add_section(const string& name)
{
Section tmp(name);
m_sections.push_back(tmp);
}
void Datafile::remove_section(const string& name)
{
if(m_sections.empty())
throw libdatafile::File_not_opened(m_filename.c_str());
for(sec_it i=begin(); i!=end(); i++)
if(i->name() == name)
m_sections.erase(i);
throw libdatafile::Section_not_found(name.c_str());
}
sec_it Datafile::begin()
{
return m_sections.begin();
}
sec_it Datafile::end()
{
return m_sections.end();
}
07070100000027000081A400000000000000000000000151E52187000019FA000000000000000000000000000000000000001800000000aldo-0.7.8/src/keyer.cc/***************************************************************************
libkeyer part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "keyer.hh"
using namespace libkeyer;
using namespace libaudiostream;
using namespace std;
typedef unsigned int morse_symbol;
// the first two nybles are the dits/dahs 1 for a dit, 0 for a dah, the last nyble is the number of dits & dahs
static const morse_symbol map[] =
{
// Letters from map[0] to map[25]
0x8002, 0x7004, 0x5004, 0x6003, 0x8001, 0xD004, 0x2003,
0xF004, 0xC002, 0x8004, 0x4003, 0xB004, 0x0002, 0x4002,
0x0003, 0x9004, 0x2004, 0xA003, 0xE003, 0x0001, 0xC003,
0xE004, 0x8003, 0x6004, 0x4004, 0x3004,
// Numbers from map[26] to map[35]
0x0005, 0x8005, 0xC005, 0xE005, 0xF005, 0xF805, 0x7805,
0x3805, 0x1805, 0x0805,
// punctuation from map[36] to map[52]
0x5006, // ! -.-.--
0xB406, // " .-..-.
0xA805, // & .-...
0x8406, // ' .----.
0x4805, // ( -.--.
0x4806, // ) -.--.-
0xA805, // + .-.-.
0x3006, // , --..--
0x7806, // - -....-
0xA806, // . .-.-.-
0x6805, // / -..-.
0x1C06, // : ---...
0x5406, // ; -.-.-.
0x7005, // = -...-
0xCF06, // ? ..--.. (seems to be playing as ..--.-, which is wrong!)
0x9406, // @ .--.-.
0xC806, // _ ..--.-
0,0,0,0,
0xFF08
};
Keyer::Keyer(AudioWorkSpace& aws, unsigned int speed, unsigned int ch, unsigned int wd, unsigned int d, unsigned int l)
: m_aws(aws), m_audio(aws.create_output_stream()), m_speed(speed), m_interch(ch), m_interword(wd), m_tone(900.0), m_dot(d), m_line(l)
{
unsigned int dpm = m_speed*((36 + 4 * m_interch + m_interword)*m_dot);
m_count = int(60000/dpm);
}
void Keyer::set_speed(unsigned int speed)
{
m_speed = speed;
unsigned int dpm = m_speed*((36 + 4 * m_interch + m_interword)*m_dot);
m_count = int(60000/dpm);
}
void Keyer::set_charpause_len(unsigned int len)
{
m_interch = len;
unsigned int dpm = m_speed*((36 + 4 * m_interch + m_interword)*m_dot);
m_count = int( 60000/dpm );
}
void Keyer::set_stringpause_len(unsigned int len)
{
m_interword = len;
unsigned int dpm = m_speed*((36 + 4 * m_interch + m_interword)*m_dot);
m_count = int( 60000/dpm );
}
void Keyer::set_dot_len(unsigned int len)
{
m_dot = len;
unsigned int dpm = m_speed*((36 + 4 * m_interch + m_interword)*m_dot);
m_count = int( 60000/dpm );
}
void Keyer::set_line_len(unsigned int len)
{
m_line = len;
unsigned int dpm = m_speed*((36 + 4 * m_interch + m_interword)*m_dot);
m_count = int( 60000/dpm );
}
void Keyer::play(unsigned int n)
{
libaudiostream::Wave tone = m_aws.gen_sine_wave(m_count * n, m_tone, 0.0);
libaudiostream::Wave pause = m_aws.gen_pause(m_count);
m_audio << tone << pause;
}
Keyer& Keyer::operator<<(const morse_symbol& input)
{
unsigned int data = input & 0xFF00;
unsigned int size = input & 0x000F;
while(size != 0)
{
if( (data & 0x8000) == 0)
play(m_line);
if( (data & 0x8000) == 0x8000)
play(m_dot);
data = data << 1;
size--;
}
return *this;
}
Keyer& Keyer::operator<<(unsigned char ch)
{
if( (ch > 96) && (ch < 123))
{
// lower case characters
ch -= 97;
}
else if( (ch > 64) && (ch < 91))
{
// upper case characters
ch -= 65;
}
else if( (ch >47) && (ch < 58))
{
// digits
ch -= 22; // -48 + 26 = -22
}
else
{
// punctuation
switch( ch ) {
case 33: ch = 36; break; // !
case 34: ch = 37; break; // "
case 38: ch = 38; break; // &
case 39: ch = 39; break; // '
case 40: ch = 40; break; // (
case 41: ch = 41; break; // )
case 43: ch = 42; break; // +
case 44: ch = 43; break; // ,
case 45: ch = 44; break; // -
case 46: ch = 45; break; // .
case 47: ch = 46; break; // /
case 58: ch = 47; break; // :
case 59: ch = 48; break; // ;
case 61: ch = 49; break; // =
case 63: ch = 50; break; // ?
case 64: ch = 51; break; // @
case 95: ch = 52; break; // _
default: ch = 255; break; // no morse for this character
}
}
if(ch != 255)
*this<<morse_symbol(map[ch]);
return *this;
}
Keyer& Keyer::operator<<(const std::string& input)
{
typedef std::string::const_iterator cit;
for(cit it = input.begin(); it!=input.end(); it++)
{
unsigned char ch = *it;
*this<<ch;
char_pause();
}
string_pause();
return *this;
}
void Keyer::char_pause()
{
libaudiostream::Wave pause = m_aws.gen_pause(m_count*m_interch);
m_audio<<pause; // ugly kludge
}
void Keyer::string_pause()
{
libaudiostream::Wave pause = m_aws.gen_pause(m_count*m_interword);
m_audio<<pause; // ugly kludge
}
07070100000028000081A400000000000000000000000151E5218700000F3E000000000000000000000000000000000000001700000000aldo-0.7.8/src/koch.cc/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
improved : Bob Harrington
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "koch.hh"
#include "random.hh"
using namespace std;
using namespace libexercises;
// give a random string from input
string Koch::randstring(string input, unsigned int num)
{
unsigned int size = input.size();
librandom::Random RND;
string output;
output.clear();
while(num!=0)
{
unsigned int pos = RND.integer(0, size-1);
output += input[pos];
num--;
}
return output;
}
Koch::Koch(string str, unsigned int num, unsigned int numch, unsigned int s, unsigned int d):
m_chars(str), m_num_chars(numch), m_num_strings(num), m_skill(s), m_next_difficulty(d)
{
m_strings = randstring(m_chars.substr(0, m_skill), m_num_chars * m_num_strings);
}
Koch::Koch(const Koch& cpy)
{
m_strings = cpy.m_strings;
}
Koch::~Koch()
{
m_strings.clear();
}
void Koch::shuffle()
{
m_strings = randstring(m_chars.substr(0, m_skill), m_num_chars * m_num_strings);
}
void Koch::next()
{
switch(m_next_difficulty)
{
case addgroup:
{
m_num_strings++;
m_next_difficulty = addchar;
break;
}
case addchar:
{
m_num_chars++;
m_next_difficulty = addsymbol;
break;
}
case addsymbol:
{
m_skill++;
m_next_difficulty = addgroup;
break;
}
}
m_strings = randstring(m_chars.substr(0, m_skill), m_num_chars * m_num_strings);
}
libkeyer::Keyer& libexercises::operator<<(libkeyer::Keyer& out, const Koch& exc)
{
std::list<std::string> lks = exc.tokenize();
typedef std::list< std::string >::const_iterator c_str;
for(c_str lks_it = lks.begin(); lks_it != lks.end(); lks_it++)
out << *lks_it;
return out;
}
std::list<std::string> Koch::tokenize() const
{
std::list<std::string> tmp_list;
string tmp_str;
unsigned int count = 0;
for(unsigned i=0; i < m_strings.size(); ++i)
{
if(count == m_num_chars)
{
tmp_list.push_back(tmp_str);
tmp_str.clear();
count = 0;
}
tmp_str += m_strings[i];
count++;
}
tmp_list.push_back(tmp_str);
return tmp_list;
}
07070100000029000081A400000000000000000000000151E5218700001184000000000000000000000000000000000000001B00000000aldo-0.7.8/src/koch_exc.cc/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "resources.hh"
#include "koch.hh"
#include "keyer.hh"
#include "datafile.hh"
#include "dialog.hh"
#include <iostream>
#include <string>
#include <unistd.h>
using namespace std;
unsigned int check(const libexercises::Koch &);
string skillname(unsigned int);
void OnKoch()
{
string fileconf_name(getenv("HOME"));
fileconf_name += "/.aldorc";
//read config from datafile ~/.aldorc
libdatafile::Datafile fileconf(fileconf_name, libdatafile::Update);
libdatafile::sec_it keyer_sec = fileconf.section("Keyer");
unsigned int beginpause = keyer_sec->option("BeginPause")->get();
unsigned int charpause = keyer_sec->option("CharPause")->get();
unsigned int strpause = keyer_sec->option("StringPause")->get();
unsigned int dotlen = keyer_sec->option("DotLength")->get();
unsigned int linelen = keyer_sec->option("LineLength")->get();
unsigned int tone = keyer_sec->option("Tone")->get();
string device = keyer_sec->option("Device")->getstr();
libdatafile::sec_it koch_sec = fileconf.section("Koch");
std::string chars = koch_sec->option("Chars")->getstr();
unsigned int strnum = koch_sec->option("StringsNumber")->get();
unsigned int strlen = koch_sec->option("StringLength")->get();
unsigned int startspeed = koch_sec->option("StartSpeed")->get();
unsigned int skill = koch_sec->option("Skill")->get();
unsigned int next_difficulty = koch_sec->option("Difficulty")->get();
Dialog<bool> ask_exit_koch(dlg_koch_title, main_menu_prompt);
ask_exit_koch.add_choice(dlg_koch_exit, false);
ask_exit_koch.add_default_choice(dlg_koch_continue, true);
libexercises::Koch koch_exc(chars, strnum, strlen, skill, next_difficulty);
do
{
cout<<msg_speed<<startspeed<<" wpm"<<endl;
cout<<msg_start<<endl;
cout<<"Letters in lesson: ";
typedef std::string::const_iterator c_str;
for(c_str cit = chars.begin(); cit != chars.end(); cit++)
cout<<*cit<<" ";
cout<<endl;
libaudiostream::AudioWorkSpace aws(device);
libkeyer::Keyer current_keyer(aws, startspeed, charpause, strpause, dotlen, linelen);
current_keyer.set_tone(tone);
sleep(beginpause);
current_keyer << koch_exc;
sleep(beginpause);
if( check(koch_exc) >= 90)
koch_exc.next();
else
koch_exc.shuffle();
}
while(ask_exit_koch.show());
//save exercise status
koch_sec->option("Chars")->set(koch_exc.get_chars());
koch_sec->option("StringsNumber")->set(koch_exc.strnum());
koch_sec->option("StringLength")->set(koch_exc.strlen());
koch_sec->option("Skill")->set(koch_exc.skill());
koch_sec->option("Difficulty")->set(koch_exc.difficulty());
}
0707010000002A000081A400000000000000000000000151E521870000102C000000000000000000000000000000000000001700000000aldo-0.7.8/src/main.cc// -*- C++ -*-
/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "menu.hh"
#include "datafile.hh"
#include "resources.hh"
#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace libmenu;
void OnBlocks(); // defined in blocks_exc.cpp
void OnKoch(); // defined in koch_exc.cpp
void OnTextFile(); // defined in textfile_exc.cpp
void OnQrz(); // defined in qrz_exc.cpp
void OnSetup(); // defined in setup.cpp
void OnExit(Menu&); // defined in this file
void OnResetDefault();
void CheckConfigFile();
int main()
{
const id_type quickstart_id = 1;
const id_type koch_id = 2;
const id_type textfile_id = 3;
const id_type qrz_id = 4;
const id_type setup_id = 5;
const id_type exit_id = 6;
CheckConfigFile();
Menu aldo_menu;
aldo_menu.set_title(main_menu_title);
aldo_menu.set_prompt(main_menu_prompt);
aldo_menu.add_item(quickstart_id, main_menu_item1, OnBlocks);
aldo_menu.add_item(koch_id, main_menu_item2, OnKoch);
aldo_menu.add_item(textfile_id, main_menu_item3, OnTextFile);
aldo_menu.add_item(qrz_id, main_menu_item4, OnQrz);
aldo_menu.add_item(setup_id, main_menu_item5, OnSetup);
aldo_menu.add_item(exit_id, main_menu_item6, OnExit);
while( aldo_menu.running() )
try
{
aldo_menu.show();
}
catch(libdatafile::Not_datafile_format e)
{
std::cerr<<errmsg_noformat<<std::endl;
std::cerr<<errmsg_conf<<std::endl;
}
catch(libdatafile::Over_write_file e)
{
std::cerr<<errmsg_overwrite<<std::endl;
std::cerr<<errmsg_conf<<std::endl;
}
catch(libdatafile::Option_not_found e)
{
std::cerr<<errmsg_nooption<<std::endl;
std::cerr<<errmsg_conf<<std::endl;
}
catch(libdatafile::Section_not_found e)
{
std::cerr<<errmsg_nosection<<std::endl;
std::cerr<<errmsg_conf<<std::endl;
}
catch(libdatafile::File_not_opened e)
{
std::cerr<<errmsg_noopenfile<<std::endl;
std::cerr<<errmsg_conf<<std::endl;
}
catch(libdatafile::File_not_exist e)
{
std::cerr<<errmsg_nofile<<std::endl;
std::cerr<<errmsg_conf<<std::endl;
}
}
void OnExit(Menu& parent_menu)
{
parent_menu.close();
}
void CheckConfigFile()
{
std::string fileconf_name(getenv("HOME"));
fileconf_name += "/.aldorc";
std::ifstream stream(fileconf_name.c_str());
if(stream.fail())
OnResetDefault();
}
0707010000002B000081A400000000000000000000000151E5218700001209000000000000000000000000000000000000001700000000aldo-0.7.8/src/menu.cc/***************************************************************************
libmenu
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "menu.hh"
#include <iostream>
#include <cctype>
using namespace std;
using namespace libmenu;
typedef std::vector<Item>::const_iterator CI;
typedef std::vector<Item>::iterator IT;
Item::Item(const Item& cpy)
{
m_id = cpy.m_id;
m_type = cpy.m_type;
m_caption = cpy.m_caption;
m_cmd1 = cpy.m_cmd1;
m_cmd2 = cpy.m_cmd2;
}
void Item::exe(Menu& menu) const
{
switch(m_type)
{
case type1:
if(m_cmd1)
(*m_cmd1)();
break;
case type2:
if(m_cmd2)
(*m_cmd2)(menu);
break;
case none:
return;
}
}
Item& Item::operator=(const Item& i)
{
m_caption = i.m_caption;
m_cmd1 = i.m_cmd1;
m_cmd2 = i.m_cmd2;
return(*this);
}
string Item::caption() const
{
return m_caption;
}
Menu::Menu(): m_title("Menu"), m_prompt("Prompt:"), m_running(true)
{
m_its.clear();
}
Menu::Menu(const string& t, const string& p):
m_title(t), m_prompt(p), m_running(true)
{
m_its.clear();
}
Menu::Menu(const Menu& cpy)
{
m_title = cpy.m_title;
m_prompt = cpy.m_prompt;
m_its = cpy.m_its;
m_running = cpy.m_running;
}
void Menu::operator--()
{
m_its.pop_back();
}
void Menu::add_item(id_type id, std::string c, Function1 f)
{
m_its.push_back( Item(id,c,f) );
}
void Menu::add_item(id_type id, std::string c, Function2 f)
{
m_its.push_back( Item(id, c, f) );
}
void Menu::add_item_at(unsigned int pos, id_type id, std::string c, Function1 f)
{
IT it(&m_its[pos]);
m_its.insert(it, Item(id,c,f) );
}
void Menu::add_item_at(unsigned int pos, id_type id, std::string c, Function2 f)
{
IT it(&m_its[pos]);
m_its.insert(it, Item(id,c,f) );
}
void Menu::delete_item_at(unsigned int pos)
{
IT it(&m_its[pos]);
m_its.erase(it);
}
void Menu::delete_item(id_type id)
{
for(IT it = m_its.begin(); it != m_its.end(); it++)
if(it->id() == id)
m_its.erase(it);
}
void Menu::show()
{
cout<<m_title<<endl;
unsigned char i = 49;
for(CI it=m_its.begin(); it!=m_its.end(); it++, i++)
{
cout<<"\t"<<i<<": "<<it->caption()<<endl;
if(i == 57)
i=96;
}
unsigned choice = m_its.size();
do
{
string trash;
cout << m_prompt << ": ";
if (! getline(cin,trash) ) // If there is an input error
{
cout << endl;
std::cin.clear();
continue;
}
if(!trash.empty())
if (int(trash[0]) > 47)
{
if(int(trash[0]) < 58)
choice = int(trash[0]) - 49;
if( (int(trash[0]) > 96) && (int(trash[0]) < 123) )
choice = int(trash[0]) - 88;
}
}
while( choice > m_its.size()-1 );
cout << endl;
m_last = m_its.at(choice).id();
m_its.at(choice).exe(*this);
}
bool Menu::find(id_type id)
{
for(CI it = m_its.begin(); it!=m_its.end(); it++)
if(it->id() == id)
return true;
return false;
}
0707010000002C000081A400000000000000000000000151E5218700000941000000000000000000000000000000000000001900000000aldo-0.7.8/src/option.cc/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "option.hh"
using namespace std;
using namespace libdatafile;
Option::Option(const string& name): m_name(name), m_value(9999)
{}
Option::Option(const Option& cpy): m_name(cpy.m_name), m_value(cpy.m_value)
{}
void Option::set(unsigned int vl)
{
if(m_valuestr.empty())
m_value = vl;
}
void Option::set(const std::string& vl)
{
m_value = 9999;
m_valuestr = vl;
}
unsigned int Option::get() const
{
return m_value;
}
string Option::getstr() const
{
return m_valuestr;
}
string Option::name() const
{
return m_name;
}
0707010000002D000081A400000000000000000000000151E5218700000E57000000000000000000000000000000000000001600000000aldo-0.7.8/src/qrz.cc/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "qrz.hh"
#include "random.hh"
using namespace std;
using namespace libexercises;
Qrz::Qrz(const Qrz& cpy)
{
m_strings = cpy.m_strings;
}
Qrz::Qrz(const string& qrz_format, unsigned int qrz_num): m_num_strings(qrz_num)
{
m_num_chars = qrz_format.size();
string group_chars("eishtmoawjuvrlpfndbgkcyqzx");
string group_numbrs("0123456789");
librandom::Random RND;
string buffer;
buffer.clear();
typedef std::string::const_iterator cit;
for(unsigned int i=0; i<m_num_strings; i++)
for(cit it = qrz_format.begin(); it!= qrz_format.end(); it++)
switch(*it)
{
case '@':
m_strings += group_chars[ RND.integer(0, group_chars.size()-1)];
break;
case '#':
m_strings += group_numbrs[ RND.integer(0, group_numbrs.size()-1)];
break;
case '?':
if(RND.integer(0,1))
m_strings += group_chars[RND.integer(0, group_chars.size()-1)];
break;
case '$':
if(RND.integer(0,1))
m_strings += group_numbrs[RND.integer(0, group_numbrs.size()-1)];
break;
default:
m_strings += *it;
}
}
libkeyer::Keyer& libexercises::operator<<(libkeyer::Keyer& out, const Qrz& exc)
{
unsigned int strlen = exc.string_len();
for(unsigned int i=0; i< exc.len(); i++)
out << exc.get_string().substr(i* strlen, strlen);
return out;
}
unsigned int Qrz::verify(const std::string& catched) const
{
double wrong_letters=0.0;
if(catched.size() == m_strings.size())
{
if(catched != m_strings)
for(unsigned int i=0; i<m_num_chars*m_num_strings; i++)
{
if(catched[i] != m_strings[i])
wrong_letters++;
}
}
else
return 0;
double total = m_num_chars * m_num_strings;
double catched_tax = wrong_letters/total;
return int(100 - 100 * catched_tax); // return percentual of cathed letters
}
0707010000002E000081A400000000000000000000000151E5218700000DBE000000000000000000000000000000000000001A00000000aldo-0.7.8/src/qrz_exc.cc/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "resources.hh"
#include "qrz.hh"
#include "keyer.hh"
#include "datafile.hh"
#include <cstdlib>
#include <iostream>
#include <string>
#include <unistd.h>
using namespace std;
// unsigned int check(const libexercises::Classic&);
std::string skillname(unsigned int);
void OnQrz()
{
string fileconf_name(getenv("HOME"));
fileconf_name += "/.aldorc";
libdatafile::Datafile fileconf(fileconf_name, libdatafile::Read); // read config from ~/.aldorc
libdatafile::sec_it keyer_sec = fileconf.section("Keyer");
unsigned int beginpause = keyer_sec->option("BeginPause")->get();
unsigned int speed = keyer_sec->option("Speed")->get();
unsigned int charpause = keyer_sec->option("CharPause")->get();
unsigned int strpause = keyer_sec->option("StringPause")->get();
unsigned int dotlen = keyer_sec->option("DotLength")->get();
unsigned int linelen = keyer_sec->option("LineLength")->get();
unsigned int tone = keyer_sec->option("Tone")->get();
string device = keyer_sec->option("Device")->getstr();
libdatafile::sec_it qrz_sec = fileconf.section("Qrz");
string callformat = qrz_sec->option("CallFormat")->getstr();
unsigned int strnum = qrz_sec->option("StringsNumber")->get();
libaudiostream::AudioWorkSpace aws(device);
libkeyer::Keyer current_keyer(aws, speed, charpause, strpause, dotlen, linelen);
current_keyer.set_tone(tone);
cout<<msg_speed<<speed<<" wpm"<<endl;
cout<<msg_callformat<<callformat<<endl;
cout<<msg_start<<endl;
libexercises::Qrz qrz_exc(callformat, strnum);
sleep(beginpause);
current_keyer<<qrz_exc;
sleep(beginpause);
// check(qrz_exc);
}
0707010000002F000081A400000000000000000000000151E5218700000D77000000000000000000000000000000000000001900000000aldo-0.7.8/src/random.cc/***************************************************************************
librandom part of Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
improved : Bob Harrington
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
***************************************************************************/
#include "random.hh"
#include <ctime>
#include <cstdlib>
#include <cmath>
using namespace std;
using namespace librandom;
Random::Random()
{
m_seed = time(0);
m_count = time(0);
srand(m_seed);
}
int Random::integer(int max)
{
// Generate a random number between 0 and 1
double normRand = double ( rand() ) / double ( RAND_MAX );
// Make the possible range of numbers [0,max+1]. I'm adding one to max
// because I'm going to use "floor" to convert from a double to an
// integer.
double rightRangeRand = (max + 1) * normRand;
// Floor the double to get an integer. I'm using floor() because
// rounding would lessen the chance of getting min or max as an output. By
// adding one to max above and then flooring, each integer in the given
// range has an equal chance of being selected.
return ( int ( floor (rightRangeRand) ) );
}
int Random::integer(int min, int max)
{
// Generate a random number between 0 and 1
double normRand = double ( rand() ) / double ( RAND_MAX );
// Make the possible range of numbers [0,max+1-min]. I'm adding one to max
// because I'm going to use floor() to convert from a double to an
// integer.
double rightScaleRand = (max + 1 - min) * normRand;
// Add min so that the random double will be in the range [min,max+1]
double rightRangeRand = rightScaleRand + min;
// Floor the double to get an integer. I'm using floor() because
// rounding would lessen the chance of getting min or max as an output. By
// adding one to max above and then flooring, each integer in the given
// range has an equal chance of winning.
return ( int ( floor (rightRangeRand) ) );
}
07070100000030000081A400000000000000000000000151E5218700000A8B000000000000000000000000000000000000001A00000000aldo-0.7.8/src/section.cc/***************************************************************************
libdatafile
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "section.hh"
using namespace std;
using namespace libdatafile;
Section::Section(const string& title): m_name(title)
{
m_options.clear();
}
Section::Section (const Section& cpy): m_name(cpy.m_name), m_options(cpy.m_options)
{}
void Section::add_option(const string& name)
{
Option tmp(name);
m_options.push_back(tmp);
}
void Section::remove(const string& name)
{
for(opt_it i=begin(); i!=end(); i++)
if(i->name() == name)
m_options.erase(i);
throw libdatafile::Option_not_found(name.c_str());
}
opt_it Section::option(const string& name)
{
for(opt_it i=begin(); i!=end(); i++)
if(i->name() == name)
return i;
throw libdatafile::Option_not_found(name.c_str());
}
string Section::name() const
{
return m_name;
}
opt_it Section::begin()
{
return m_options.begin();
}
opt_it Section::end()
{
return m_options.end();
}
07070100000031000081A400000000000000000000000151E52187000028D5000000000000000000000000000000000000001800000000aldo-0.7.8/src/setup.cc/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "resources.hh"
#include "menu.hh"
#include "dialog.hh"
#include "datafile.hh"
#include "skill.hh"
#include <string>
#include <cstdlib>
#define CONFIG_FILE ".aldorc"
using namespace std;
using namespace libmenu;
using namespace libdatafile;
/*
* This function returns the data structure containing
* the current configuration.
*/
Datafile get_configuration()
{
string fileconf_name(getenv("HOME"));
fileconf_name += "/";
fileconf_name += CONFIG_FILE;
Datafile fileconf(fileconf_name, Update);
return fileconf;
}
/*
* This function offers the user te possibility to change a
* configuration option interactively.
* The option's old value is displayed in the prompt.
* Pressing Enter keeps the option's old value.
* This function automatically distinguishes between integer and string
* input values and sets the proper one.
*/
void update_option(opt_it option, const string& label)
{
string tmpstr;
unsigned int tmpint = option->get();
if(tmpint == 9999)
{
tmpstr = option->getstr();
do
{
cout << endl;
cout << label << " [";
cout << tmpstr;
cout << "]: ";
cin.clear();
}
while( ! getline(cin, tmpstr) );
// if input is empty, keep current value unchanged
if(tmpstr[0] == '\0')
return;
option->set(tmpstr);
}
else
{
do
{
cout << endl;
cout << label << " [";
cout << tmpint;
cout << "]: ";
cin.clear();
}
while( ! getline(cin, tmpstr) );
// if input is empty, keep current value unchanged
if(tmpstr[0] == '\0')
return;
tmpint = (unsigned int)atoi(tmpstr.c_str());
option->set(tmpint);
}
}
void OnKeyerConf()
{
Datafile cfg = get_configuration();
sec_it this_sec = cfg.section("Keyer");
cin.ignore();
update_option(this_sec->option("BeginPause"), insert_beginpause);
update_option(this_sec->option("CharPause"), insert_charpause);
update_option(this_sec->option("StringPause"), insert_strpause);
update_option(this_sec->option("Speed"), insert_wpm);
update_option(this_sec->option("DotLength"), insert_dotlen);
update_option(this_sec->option("LineLength"), insert_linelen);
update_option(this_sec->option("Tone"), insert_tone);
update_option(this_sec->option("Device"), insert_device);
}
void OnBlocksConf()
{
Datafile cfg = get_configuration();
sec_it this_sec = cfg.section("Blocks");
cin.ignore();
update_option(this_sec->option("StringsNumber"), insert_strnum);
update_option(this_sec->option("StringLength"), insert_strlen);
Dialog<unsigned int> ask_skill(dlg_skill_title, main_menu_prompt);
ask_skill.add_default_choice(dlg_skill_choice1,libexercises::skill1);
ask_skill.add_choice(dlg_skill_choice2,libexercises::skill2);
ask_skill.add_choice(dlg_skill_choice3,libexercises::skill3);
ask_skill.add_choice(dlg_skill_choice4,libexercises::skill4);
ask_skill.add_choice(dlg_skill_choice5,libexercises::skill5);
ask_skill.add_choice(dlg_skill_choice6,libexercises::skill6);
ask_skill.add_choice(dlg_skill_choice7,0);
unsigned int skill = ask_skill.show();
if(skill == 0)
while(true)
{
Dialog<unsigned int> ask_skill2(dlg_skill2_title, main_menu_prompt);
ask_skill2.add_default_choice(dlg_skill2_choice1,libexercises::chars1);
ask_skill2.add_choice(dlg_skill2_choice2,libexercises::chars2);
ask_skill2.add_choice(dlg_skill2_choice3,libexercises::chars3);
ask_skill2.add_choice(dlg_skill2_choice4,libexercises::chars4);
ask_skill2.add_choice(dlg_skill2_choice5,libexercises::chars5);
ask_skill2.add_choice(dlg_skill2_choice6,libexercises::numbrs);
ask_skill2.add_choice(dlg_skill2_choice7,0x1000);
ask_skill2.add_choice(dlg_skill2_choice8,libexercises::submixed);
ask_skill2.add_choice(dlg_skill2_choice9,libexercises::mixed);
ask_skill2.add_choice(dlg_skill2_choice10,0);
unsigned int skill2 = ask_skill2.show();
if(skill2 != 0 && skill2 != 0x1000)
skill |= skill2;
if(skill2 == 0)
break;
}
this_sec->option("Skill")->set(skill);
}
void OnKochConf()
{
Datafile cfg = get_configuration();
sec_it this_sec = cfg.section("Koch");
cin.ignore();
update_option(this_sec->option("Chars"), insert_chars);
update_option(this_sec->option("StringsNumber"), insert_strnum);
update_option(this_sec->option("StringLength"), insert_strlen);
update_option(this_sec->option("StartSpeed"), insert_wpm);
update_option(this_sec->option("Skill"), insert_pos);
update_option(this_sec->option("Difficulty"), insert_pos);
}
void OnQrzConf()
{
Datafile cfg = get_configuration();
sec_it this_sec = cfg.section("Qrz");
cin.ignore();
update_option(this_sec->option("CallFormat"), insert_callformat);
update_option(this_sec->option("StringsNumber"), insert_strnum);
}
void OnResetDefault()
{
string fileconf_name(getenv("HOME"));
fileconf_name += "/";
fileconf_name += CONFIG_FILE;
Datafile fileconf(fileconf_name, Create);
fileconf.add_section("Keyer");
sec_it keyer_sec = fileconf.section("Keyer");
keyer_sec->add_option("BeginPause");
keyer_sec->option("BeginPause")->set(2);
keyer_sec->add_option("Speed");
keyer_sec->option("Speed")->set(10);
keyer_sec->add_option("CharPause");
keyer_sec->option("CharPause") ->set(3);
keyer_sec->add_option("StringPause");
keyer_sec->option("StringPause")->set(7);
keyer_sec->add_option("DotLength");
keyer_sec->option("DotLength")->set(1);
keyer_sec->add_option("LineLength");
keyer_sec->option("LineLength")->set(3);
keyer_sec->add_option("Tone");
keyer_sec->option("Tone")->set(900);
keyer_sec->add_option("Device");
keyer_sec->option("Device")->set("default");
fileconf.add_section("Blocks");
sec_it blocks_sec = fileconf.section("Blocks");
blocks_sec->add_option("StringsNumber");
blocks_sec->option("StringsNumber")->set(3);
blocks_sec->add_option("StringLength");
blocks_sec->option("StringLength")->set(5);
blocks_sec->add_option("Skill");
blocks_sec->option("Skill")->set(libexercises::skill1);
fileconf.add_section("Koch");
sec_it koch_sec = fileconf.section("Koch");
koch_sec->add_option("Chars");
// Suggested sequence from http://www.qsl.net/kb5wck/super.html
koch_sec->option("Chars")->set("kmrsuaptlowi.njef0y,vg5/q9zh38b?427c1d6x");
koch_sec->add_option("StringsNumber");
koch_sec->option("StringsNumber")->set(15);
koch_sec->add_option("StringLength");
koch_sec->option("StringLength")->set(2);
koch_sec->add_option("StartSpeed");
koch_sec->option("StartSpeed")->set(20);
koch_sec->add_option("Skill");
koch_sec->option("Skill")->set(2);
koch_sec->add_option("Difficulty");
koch_sec->option("Difficulty")->set(0);
fileconf.add_section("Qrz");
sec_it qrz_sec = fileconf.section("Qrz");
qrz_sec->add_option("CallFormat");
qrz_sec->option("CallFormat")->set("@@@@@");
qrz_sec->add_option("StringsNumber");
qrz_sec->option("StringsNumber")->set(3);
}
void OnExitSetup(Menu& main)
{
main.close();
}
void OnSetup()
{
Menu setup_menu(conf_menu_title, main_menu_prompt);
const id_type keyconf_id = 1;
const id_type clasconf_id = 2;
const id_type kochconf_id = 3;
const id_type qrzconf_id = 4;
const id_type rstdfl_id = 5;
const id_type exit_id = 6;
setup_menu.add_item(keyconf_id, conf_menu_item1, OnKeyerConf);
setup_menu.add_item(clasconf_id, conf_menu_item2, OnBlocksConf);
setup_menu.add_item(kochconf_id, conf_menu_item3, OnKochConf);
setup_menu.add_item(qrzconf_id, conf_menu_item4, OnQrzConf);
setup_menu.add_item(rstdfl_id, conf_menu_item5, OnResetDefault);
setup_menu.add_item(exit_id, conf_menu_item6, OnExitSetup);
while( setup_menu.running() )
{
try
{
setup_menu.show();
}
catch(Not_datafile_format e)
{
cerr<<errmsg_noformat<<endl;
cerr<<errmsg_conf<<endl;
return;
}
catch(Over_write_file e)
{
cerr<<errmsg_overwrite<<endl;
cerr<<errmsg_conf<<endl;
return;
}
catch(Option_not_found e)
{
cerr<<errmsg_nooption<<endl;
cerr<<errmsg_conf<<endl;
return;
}
catch(Section_not_found e)
{
cerr<<errmsg_nosection<<endl;
cerr<<errmsg_conf<<endl;
return;
}
catch(File_not_opened e)
{
cerr<<errmsg_noopenfile<<endl;
cerr<<errmsg_conf<<endl;
return;
}
catch(File_not_exist e)
{
cerr<<errmsg_nofile<<endl;
cerr<<errmsg_conf<<endl;
return;
}
}
}
07070100000032000081A400000000000000000000000151E5218700000B3C000000000000000000000000000000000000001B00000000aldo-0.7.8/src/textfile.cc/***************************************************************************
libexercises part of Aldo
---------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "textfile.hh"
#include <cctype>
#include <fstream>
using namespace std;
using namespace libexercises;
TextFile::TextFile(const TextFile& cpy)
{
m_strings = cpy.m_strings;
}
TextFile::TextFile(std::string filename):
m_filename(filename)
{
m_strings.clear();
ifstream file(m_filename.c_str());
char ch;
string tmp_string;
while(file.get(ch))
{
if(isspace(ch))
{
m_strings += tmp_string;
m_strings += "|";
tmp_string.clear();
} else {
if(isalnum(ch) || ispunct(ch))
tmp_string += ch;
}
}
if(!tmp_string.empty())
{
m_strings += tmp_string;
m_strings += "|";
}
}
libkeyer::Keyer& libexercises::operator<<(libkeyer::Keyer& out, const TextFile& exc)
{
string tmp;
tmp.clear();
string exc_string = exc.get_string();
typedef string::const_iterator sit;
for(sit it = exc_string.begin(); it!=exc_string.end(); it++)
{
if(*it == '|')
{
out << tmp;
tmp.clear();
}
else
tmp += *it;
}
return out;
}
07070100000033000081A400000000000000000000000151E5218700000CEB000000000000000000000000000000000000001F00000000aldo-0.7.8/src/textfile_exc.cc/***************************************************************************
Aldo
--------------------
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sun May 6 2001
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "resources.hh"
#include "textfile.hh"
#include "keyer.hh"
#include "datafile.hh"
#include <iostream>
#include <cstdlib>
#include <string>
#include <unistd.h>
using namespace std;
void OnTextFile()
{
string fileconf_name(getenv("HOME"));
fileconf_name += "/.aldorc";
libdatafile::Datafile fileconf(fileconf_name, libdatafile::Read); //read config from datafile ~/.aldorc
libdatafile::sec_it keyer_sec = fileconf.section("Keyer");
unsigned int beginpause = keyer_sec->option("BeginPause")->get();
unsigned int speed = keyer_sec->option("Speed")->get();
unsigned int charpause = keyer_sec->option("CharPause")->get();
unsigned int strpause = keyer_sec->option("StringPause")->get();
unsigned int dotlen = keyer_sec->option("DotLength")->get();
unsigned int linelen = keyer_sec->option("LineLength")->get();
unsigned int tone = keyer_sec->option("Tone")->get();
string device = keyer_sec->option("Device")->getstr();
string filename;
do
{
cout << endl;
cout<<insert_filename<<": ";
cin.clear();
}
while(! getline(cin, filename) );
libaudiostream::AudioWorkSpace aws(device);
libkeyer::Keyer current_keyer(aws, speed, charpause, strpause, dotlen, linelen);
current_keyer.set_tone(tone);
libexercises::TextFile textfile_exc(filename);
cout<<msg_speed<<speed<<" wpm"<<endl;
cout<<msg_start<<endl;
sleep(beginpause);
current_keyer<<textfile_exc;
}
07070100000034000081A400000000000000000000000151E5218700000B53000000000000000000000000000000000000001700000000aldo-0.7.8/src/wave.cc/***************************************************************************
libaudiostream
--------------------
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Giuseppe "denever" Martino
begin : Sat 9 Mar 2002
email : denever@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
* *
***************************************************************************/
#include "wave.hh"
using namespace std;
using namespace libaudiostream;
Wave::Wave(size_type d): m_size(d)
{
}
Wave::Wave(size_type d, samples_buffer_pointer p):
m_size(d), m_data(p)
{
}
Wave::Wave(const Wave& cpy)
{
if(m_data != 0)
delete [] m_data;
m_size = cpy.m_size;
m_data = new sample_type[m_size];
for(size_type i = 0; i < m_size; i++)
m_data[i] = cpy.m_data[i];
}
Wave::~Wave()
{
if(m_data != 0)
delete [] m_data;
}
void Wave::reverse()
{}
void Wave::bias(sample_type val)
{}
void Wave::amplify(sample_type val)
{}
Wave& Wave::operator+(const Wave& cpy)
{
Wave temp(m_size + cpy.m_size);
for(size_type i = 0; i < m_size; i++)
temp.set(i, m_data[i]);
for(size_type i = m_size; i < cpy.m_size; i++)
temp.set(i, m_data[i]);
return *this;
}
Wave& Wave::operator=(const Wave& cpy)
{
if(m_data != 0)
delete [] m_data;
m_size = cpy.m_size;
m_data = new sample_type[m_size];
for(size_type i=0; i < m_size; i++)
m_data[i] = cpy.m_data[i];
return *this;
}
void Wave::set(size_type pos, int s)
{}
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!390 blocks