/* Copyright (C) 1996 Byron Stanoszek * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * **************************************************************************/ /* sound.h */ #include #include #include #include #include #include #include #include #include #include #include #include #include "pcm.h" /* header for WAV-Files */ typedef struct { char main_chunk[4]; /* 'RIFF' */ long length; /* length of file */ char chunk_type[4]; /* 'WAVE' */ char sub_chunk[4]; /* 'fmt ' */ long length_chunk; /* length sub_chunk, always 16 bytes */ short format; /* always 1 = PCM-Code */ short modus; /* 1 = Mono, 2 = Stereo */ long sample_fq; /* Sample Freq */ long byte_p_sec; /* Data per sec */ short byte_p_spl; /* bytes per sample: 1=8 bit, 2=16 bit (mono) 2=8 bit, 4=16 bit (stereo) */ short bit_p_spl; /* bits per sample, 8, 12, 16 */ char data_chunk[4]; /* 'data' */ long data_length; /* length of data */ } wave_header; typedef struct { char main_chunk[3]; /* 'PCM' */ char version; /* 1 */ char modus; /* 1 = Mono, 2 = Stereo, 4 = Quad */ char byte_p_spl; /* bytes per sample: 1=8 bit, 2=16 bit (mono) 2=8 bit, 4=16 bit (stereo) */ long sample_fq; /* Sample Freq */ long byte_p_sec; /* Data per sec */ } pcm_header; typedef struct song_chain_struct song_chain; struct song_chain_struct { song_chain *next; int tune; /* tune number */ int c; /* play counter */ int fd; /* file descriptor */ double count; /* time counter */ char title[32]; /* title of song, 30 chars max */ int stereo; /* 0 = Mono, 1 = Stereo */ int speed; /* Data per sec */ int sample_size; /* bits per sample */ int bytesize; /* bytes per sample (1, 2, or 4) */ int headsize; /* size of header in file */ int length; /* length of file */ int repeat; /* location of file which repeats */ int bartime; /* notes per time segment */ int barlength; /* samples per note */ int default_speed; /* default speed of tune */ int repeat_mode; /* 0 = Single, 1 = Repeat, 2 = Full, 3 = Middle */ int repeat_num; /* how many times still to repeat */ int fpause; /* halt data codes until song finishes playing */ int scale; /* final scale speed */ int volume; /* current volume */ int volspeed; /* speed of volume scaling */ int volume_scale; /* final volume scale speed */ int scale_toggle; /* 0 = do not scale volume changes, 1 = scale */ }; /* global declarations */ int atoi(); int read(); int ioctl(); void *malloc(); void free(); int write(); void read_song(); void set_audio(); int unlink(); void read_input(); void send_data(); int fork(); int setpgrp(); int speed_to_scale(); void fix_tty(); char *getenv(); void input_volume(); int select(); void update_display(); void set_status(); int strncmp(); int strncpy(); unsigned int soundbar(); void process_music(); void output_sound();