Steve2/src/dev/audio/speaker.h

99 lines
2.5 KiB
C
Raw Normal View History

2020-05-10 06:40:37 +00:00
//
// speaker.h
// Steve ][
2020-05-10 06:40:37 +00:00
//
// Created by Tamas Rudnai on 5/9/20.
// Copyright © 2019, 2020 Tamas Rudnai. All rights reserved.
2020-07-13 17:10:33 +00:00
//
// This file is part of Steve ][ -- The Apple ][ Emulator.
//
// Steve ][ 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 3 of the License, or
// (at your option) any later version.
//
// Steve ][ 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 Steve ][. If not, see <https://www.gnu.org/licenses/>.
2020-05-10 06:40:37 +00:00
//
#ifndef speaker_h
#define speaker_h
#include <stdio.h>
2020-06-12 01:29:26 +00:00
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
// very loud
//#define SPKR_LEVEL_MIN (-28000)
//#define SPKR_LEVEL_MAX (+28000)
// loud
//#define SPKR_LEVEL_MIN (-5000)
//#define SPKR_LEVEL_MAX (+5000)
// medium
#define SPKR_LEVEL_MIN (-3072)
#define SPKR_LEVEL_MAX (+3072)
#define SPKR_FADE_LEADING_EDGE 0.32
#define SPKR_FADE_TRAILING_EDGE 0.16
#define SPKR_INITIAL_DUMPING 0.90
2020-06-12 01:29:26 +00:00
// quiet
//#define SPKR_LEVEL_MIN (-1000)
//#define SPKR_LEVEL_MAX (+1000)
2020-05-10 06:40:37 +00:00
#define SPKR_LEVEL_ZERO 0 // as defined in OpenAL documentation for 8bit PCM
2020-05-10 06:40:37 +00:00
enum {
SPKR_SRC_GAME_SFX = 0,
SPKR_SRC_DISK_MOTOR_SFX,
SPKR_SRC_DISK_ARM_SFX,
SPKR_SRC_DISK_IOERR_SFX,
};
2020-05-14 03:40:54 +00:00
extern const unsigned spkr_sample_rate;
2020-06-23 02:23:41 +00:00
extern const unsigned spkr_buf_alloc_size;
extern unsigned spkr_buf_size;
2020-06-24 05:59:20 +00:00
extern const unsigned spkr_fps;
extern unsigned spkr_fps_divider;
extern int16_t spkr_samples [];
extern unsigned spkr_sample_idx;
extern int spkr_level;
2020-05-17 14:49:05 +00:00
extern int freeBuffers;
2020-06-14 03:13:20 +00:00
extern int spkr_extra_buf;
2020-06-23 02:23:41 +00:00
extern unsigned spkr_play_timeout;
extern unsigned spkr_play_time;
2020-07-02 06:08:33 +00:00
extern float spkr_vol;
extern void spkr_vol_up(void);
extern void spkr_vol_dn(void);
extern void spkr_mute(void);
extern void spkr_init(void);
extern void spkr_exit(void);
extern void spkr_update(void);
extern void spkr_toggle(void);
2020-06-12 01:29:26 +00:00
extern void spkr_load_sfx( const char * bundlePath );
extern void spkr_play_disk_motor(void);
extern void spkr_stop_disk_motor( int time );
extern void spkr_update_disk_sfx(void);
extern void spkr_stop_sfx( ALuint src );
extern void spkr_stopAll(void);
2020-06-12 01:29:26 +00:00
extern void spkr_play_disk_arm(void);
extern void spkr_play_disk_ioerr(void);
2020-05-10 06:40:37 +00:00
#endif /* speaker_h */