mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Merge pull request #153 from TomHarte/StricterWarnings
Enabled stricter compiler warnings
This commit is contained in:
commit
a6b239698c
@ -403,7 +403,7 @@ void WD1770::posit_event(Event new_event_type) {
|
||||
goto verify;
|
||||
}
|
||||
step(step_direction_ ? 1 : -1);
|
||||
int time_to_wait;
|
||||
unsigned int time_to_wait;
|
||||
switch(command_ & 3) {
|
||||
default:
|
||||
case 0: time_to_wait = 6; break;
|
||||
|
@ -123,7 +123,7 @@ class WD1770: public Storage::Disk::Controller {
|
||||
void posit_event(Event type);
|
||||
int interesting_event_mask_;
|
||||
int resume_point_;
|
||||
int delay_time_;
|
||||
unsigned int delay_time_;
|
||||
|
||||
// Output
|
||||
int last_bit_;
|
||||
|
@ -76,7 +76,7 @@ void AY38910::set_clock_rate(double clock_rate) {
|
||||
}
|
||||
|
||||
void AY38910::get_samples(unsigned int number_of_samples, int16_t *target) {
|
||||
int c = 0;
|
||||
unsigned int c = 0;
|
||||
while((master_divider_&7) && c < number_of_samples) {
|
||||
target[c] = output_volume_;
|
||||
master_divider_++;
|
||||
|
@ -229,14 +229,14 @@ class TIA {
|
||||
} queue_[4];
|
||||
int queue_read_pointer_, queue_write_pointer_;
|
||||
|
||||
inline void output_pixels(uint8_t *const target, const int count, const uint8_t collision_identity, int pixel_position, int adder, int reverse_mask) {
|
||||
if(pixel_position == 32 || !graphic[graphic_index]) return;
|
||||
inline void output_pixels(uint8_t *const target, const int count, const uint8_t collision_identity, int output_pixel_position, int output_adder, int output_reverse_mask) {
|
||||
if(output_pixel_position == 32 || !graphic[graphic_index]) return;
|
||||
int output_cursor = 0;
|
||||
while(pixel_position < 32 && output_cursor < count) {
|
||||
int shift = (pixel_position >> 2) ^ reverse_mask;
|
||||
while(output_pixel_position < 32 && output_cursor < count) {
|
||||
int shift = (output_pixel_position >> 2) ^ output_reverse_mask;
|
||||
target[output_cursor] |= ((graphic[graphic_index] >> shift)&1) * collision_identity;
|
||||
output_cursor++;
|
||||
pixel_position += adder;
|
||||
output_pixel_position += output_adder;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
#include "Vic20.hpp"
|
||||
|
||||
uint16_t *Commodore::Vic20::Machine::sequence_for_character(Utility::Typer *typer, char character) {
|
||||
#define KEYS(...) {__VA_ARGS__, TerminateSequence}
|
||||
#define SHIFT(...) {KeyLShift, __VA_ARGS__, TerminateSequence}
|
||||
#define KEYS(...) {__VA_ARGS__, EndSequence}
|
||||
#define SHIFT(...) {KeyLShift, __VA_ARGS__, EndSequence}
|
||||
#define X {NotMapped}
|
||||
static Key key_sequences[][3] = {
|
||||
static KeySequence key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
@ -80,7 +80,5 @@ uint16_t *Commodore::Vic20::Machine::sequence_for_character(Utility::Typer *type
|
||||
#undef SHIFT
|
||||
#undef X
|
||||
|
||||
if(character > sizeof(key_sequences) / sizeof(*key_sequences)) return nullptr;
|
||||
if(key_sequences[character][0] == NotMapped) return nullptr;
|
||||
return (uint16_t *)key_sequences[character];
|
||||
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
||||
}
|
||||
|
@ -63,8 +63,6 @@ enum Key: uint16_t {
|
||||
KeyI = key(1, 0x10), KeyP = key(1, 0x20), KeyAsterisk = key(1, 0x40), KeyReturn = key(1, 0x80),
|
||||
Key1 = key(0, 0x01), Key3 = key(0, 0x02), Key5 = key(0, 0x04), Key7 = key(0, 0x08),
|
||||
Key9 = key(0, 0x10), KeyPlus = key(0, 0x20), KeyGBP = key(0, 0x40), KeyDelete = key(0, 0x80),
|
||||
|
||||
TerminateSequence = 0xffff, NotMapped = 0xfffe
|
||||
};
|
||||
|
||||
enum JoystickInput {
|
||||
|
@ -57,8 +57,6 @@ enum Key: uint16_t {
|
||||
KeyShift = 0x00d0 | 0x08, KeyControl = 0x00d0 | 0x04, KeyFunc = 0x00d0 | 0x02, KeyEscape = 0x00d0 | 0x01,
|
||||
|
||||
KeyBreak = 0xfffd,
|
||||
|
||||
TerminateSequence = 0xffff, NotMapped = 0xfffe,
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -17,11 +17,11 @@ int Electron::Machine::get_typer_frequency() {
|
||||
}
|
||||
|
||||
uint16_t *Electron::Machine::sequence_for_character(Utility::Typer *typer, char character) {
|
||||
#define KEYS(...) {__VA_ARGS__, TerminateSequence}
|
||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, TerminateSequence}
|
||||
#define CTRL(...) {KeyControl, __VA_ARGS__, TerminateSequence}
|
||||
#define KEYS(...) {__VA_ARGS__, EndSequence}
|
||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, EndSequence}
|
||||
#define CTRL(...) {KeyControl, __VA_ARGS__, EndSequence}
|
||||
#define X {NotMapped}
|
||||
static Key key_sequences[][3] = {
|
||||
static KeySequence key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
@ -91,7 +91,5 @@ uint16_t *Electron::Machine::sequence_for_character(Utility::Typer *typer, char
|
||||
#undef SHIFT
|
||||
#undef X
|
||||
|
||||
if(character > sizeof(key_sequences) / sizeof(*key_sequences)) return nullptr;
|
||||
if(key_sequences[character][0] == NotMapped) return nullptr;
|
||||
return (uint16_t *)key_sequences[character];
|
||||
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
||||
}
|
||||
|
@ -425,9 +425,9 @@ void VideoOutput::setup_screen_map() {
|
||||
screen_map_.emplace_back(DrawAction::Blank, cycles_per_line >> 1);
|
||||
screen_map_.emplace_back(DrawAction::Sync, (cycles_per_line * 5) >> 1);
|
||||
}
|
||||
for(int c = 0; c < first_graphics_line - 3; c++) emplace_blank_line();
|
||||
for(int c = 0; c < 256; c++) emplace_pixel_line();
|
||||
for(int c = 256 + first_graphics_line; c < 312; c++) emplace_blank_line();
|
||||
for(int l = 0; l < first_graphics_line - 3; l++) emplace_blank_line();
|
||||
for(int l = 0; l < 256; l++) emplace_pixel_line();
|
||||
for(int l = 256 + first_graphics_line; l < 312; l++) emplace_blank_line();
|
||||
if(c&1) emplace_blank_line();
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,6 @@ enum Key: uint16_t {
|
||||
KeyForwardSlash = 0x0700 | 0x08, Key0 = 0x0700 | 0x04, KeyL = 0x0700 | 0x02, Key8 = 0x0700 | 0x01,
|
||||
|
||||
KeyNMI = 0xfffd,
|
||||
|
||||
TerminateSequence = 0xffff, NotMapped = 0xfffe
|
||||
};
|
||||
|
||||
enum ROM {
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "Oric.hpp"
|
||||
|
||||
uint16_t *Oric::Machine::sequence_for_character(Utility::Typer *typer, char character) {
|
||||
#define KEYS(...) {__VA_ARGS__, TerminateSequence}
|
||||
#define SHIFT(...) {KeyLeftShift, __VA_ARGS__, TerminateSequence}
|
||||
#define KEYS(...) {__VA_ARGS__, EndSequence}
|
||||
#define SHIFT(...) {KeyLeftShift, __VA_ARGS__, EndSequence}
|
||||
#define X {NotMapped}
|
||||
static Key key_sequences[][3] = {
|
||||
static KeySequence key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
@ -73,7 +73,5 @@ uint16_t *Oric::Machine::sequence_for_character(Utility::Typer *typer, char char
|
||||
#undef SHIFT
|
||||
#undef X
|
||||
|
||||
if(character > sizeof(key_sequences) / sizeof(*key_sequences)) return nullptr;
|
||||
if(key_sequences[character][0] == NotMapped) return nullptr;
|
||||
return (uint16_t *)key_sequences[character];
|
||||
return table_lookup_sequence_for_character(key_sequences, sizeof(key_sequences), character);
|
||||
}
|
||||
|
@ -77,3 +77,10 @@ bool Typer::Delegate::typer_set_next_character(Utility::Typer *typer, char chara
|
||||
uint16_t *Typer::Delegate::sequence_for_character(Typer *typer, char character) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint16_t *Typer::Delegate::table_lookup_sequence_for_character(KeySequence *sequences, size_t length, char character) {
|
||||
size_t ucharacter = (size_t)((unsigned char)character);
|
||||
if(ucharacter > (length / sizeof(KeySequence))) return nullptr;
|
||||
if(sequences[ucharacter][0] == NotMapped) return nullptr;
|
||||
return sequences[ucharacter];
|
||||
}
|
||||
|
@ -23,7 +23,11 @@ class Typer {
|
||||
|
||||
virtual uint16_t *sequence_for_character(Typer *typer, char character);
|
||||
|
||||
typedef uint16_t KeySequence[16];
|
||||
uint16_t *table_lookup_sequence_for_character(KeySequence *sequences, size_t length, char character);
|
||||
|
||||
const uint16_t EndSequence = 0xffff;
|
||||
const uint16_t NotMapped = 0xfffe;
|
||||
};
|
||||
|
||||
Typer(const char *string, int delay, int frequency, Delegate *delegate);
|
||||
|
@ -9,11 +9,10 @@
|
||||
#include "ZX8081.hpp"
|
||||
|
||||
uint16_t *ZX8081::Machine::sequence_for_character(Utility::Typer *typer, char character) {
|
||||
#define KEYS(...) {__VA_ARGS__, TerminateSequence}
|
||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, TerminateSequence}
|
||||
#define KEYS(...) {__VA_ARGS__, EndSequence}
|
||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, EndSequence}
|
||||
#define X {NotMapped}
|
||||
typedef Key KeyTable[126][3];
|
||||
KeyTable zx81_key_sequences = {
|
||||
static KeySequence zx81_key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
@ -79,7 +78,7 @@ uint16_t *ZX8081::Machine::sequence_for_character(Utility::Typer *typer, char ch
|
||||
/* | */ X, /* } */ X,
|
||||
};
|
||||
|
||||
KeyTable zx80_key_sequences = {
|
||||
static KeySequence zx80_key_sequences[] = {
|
||||
/* NUL */ X, /* SOH */ X,
|
||||
/* STX */ X, /* ETX */ X,
|
||||
/* EOT */ X, /* ENQ */ X,
|
||||
@ -148,9 +147,8 @@ uint16_t *ZX8081::Machine::sequence_for_character(Utility::Typer *typer, char ch
|
||||
#undef SHIFT
|
||||
#undef X
|
||||
|
||||
if(character > sizeof(zx81_key_sequences) / sizeof(*zx81_key_sequences)) return nullptr;
|
||||
|
||||
KeyTable *table = is_zx81_ ? &zx81_key_sequences : &zx80_key_sequences;
|
||||
if((*table)[character][0] == NotMapped) return nullptr;
|
||||
return (uint16_t *)(*table)[character];
|
||||
if(is_zx81_)
|
||||
return table_lookup_sequence_for_character(zx81_key_sequences, sizeof(zx81_key_sequences), character);
|
||||
else
|
||||
return table_lookup_sequence_for_character(zx80_key_sequences, sizeof(zx80_key_sequences), character);
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ enum Key: uint16_t {
|
||||
KeyP = 0x0500 | 0x01, KeyO = 0x0500 | 0x02, KeyI = 0x0500 | 0x04, KeyU = 0x0500 | 0x08, KeyY = 0x0500 | 0x10,
|
||||
KeyEnter = 0x0600 | 0x01, KeyL = 0x0600 | 0x02, KeyK = 0x0600 | 0x04, KeyJ = 0x0600 | 0x08, KeyH = 0x0600 | 0x10,
|
||||
KeySpace = 0x0700 | 0x01, KeyDot = 0x0700 | 0x02, KeyM = 0x0700 | 0x04, KeyN = 0x0700 | 0x08, KeyB = 0x0700 | 0x10,
|
||||
|
||||
TerminateSequence = 0xffff, NotMapped = 0xfffe
|
||||
};
|
||||
|
||||
class Machine:
|
||||
|
@ -2901,10 +2901,19 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Clock Signal/Clock Signal.entitlements";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
|
||||
GCC_WARN_SHADOW = YES;
|
||||
GCC_WARN_SIGN_COMPARE = YES;
|
||||
INFOPLIST_FILE = "Clock Signal/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "TH.Clock-Signal";
|
||||
@ -2920,10 +2929,19 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_ASSIGN_ENUM = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Clock Signal/Clock Signal.entitlements";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
|
||||
GCC_WARN_SHADOW = YES;
|
||||
GCC_WARN_SIGN_COMPARE = YES;
|
||||
INFOPLIST_FILE = "Clock Signal/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "TH.Clock-Signal";
|
||||
|
@ -43,7 +43,7 @@
|
||||
@c CSOpenGLViewResponderDelegate methods and as -[CSOpenGLViewDelegate openGLView:didUpdateToTime:].
|
||||
@param event The @c NSEvent describing the flagsChanged.
|
||||
*/
|
||||
- (void)flagsChanged:(nonnull NSEvent *)newModifiers;
|
||||
- (void)flagsChanged:(nonnull NSEvent *)event;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -38,7 +38,7 @@ void CRT::set_new_timing(unsigned int cycles_per_line, unsigned int height_of_di
|
||||
unsigned int multiplied_cycles_per_line = cycles_per_line * time_multiplier_;
|
||||
|
||||
// generate timing values implied by the given arguments
|
||||
sync_capacitor_charge_threshold_ = ((int)(syncCapacityLineChargeThreshold * cycles_per_line) * 3) / 4;
|
||||
sync_capacitor_charge_threshold_ = ((unsigned int)(syncCapacityLineChargeThreshold * cycles_per_line) * 3) / 4;
|
||||
|
||||
// create the two flywheels
|
||||
horizontal_flywheel_.reset(new Flywheel(multiplied_cycles_per_line, (millisecondsHorizontalRetraceTime * multiplied_cycles_per_line) >> 6, multiplied_cycles_per_line >> 6));
|
||||
@ -102,10 +102,10 @@ Flywheel::SyncEvent CRT::get_next_horizontal_sync_event(bool hsync_is_requested,
|
||||
return horizontal_flywheel_->get_next_event_in_period(hsync_is_requested, cycles_to_run_for, cycles_advanced);
|
||||
}
|
||||
|
||||
#define output_x1() (*(uint16_t *)&next_run[OutputVertexOffsetOfHorizontal + 0])
|
||||
#define output_x2() (*(uint16_t *)&next_run[OutputVertexOffsetOfHorizontal + 2])
|
||||
#define output_position_y() (*(uint16_t *)&next_run[OutputVertexOffsetOfVertical + 0])
|
||||
#define output_tex_y() (*(uint16_t *)&next_run[OutputVertexOffsetOfVertical + 2])
|
||||
#define output_x1() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfHorizontal + 0])
|
||||
#define output_x2() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfHorizontal + 2])
|
||||
#define output_position_y() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfVertical + 0])
|
||||
#define output_tex_y() (*(uint16_t *)&next_output_run[OutputVertexOffsetOfVertical + 2])
|
||||
|
||||
#define source_input_position_x1() (*(uint16_t *)&next_run[SourceVertexOffsetOfInputStart + 0])
|
||||
#define source_input_position_y() (*(uint16_t *)&next_run[SourceVertexOffsetOfInputStart + 2])
|
||||
@ -192,8 +192,8 @@ void CRT::advance_cycles(unsigned int number_of_cycles, bool hsync_requested, bo
|
||||
const uint16_t output_y = openGL_output_builder_.get_composite_output_y();
|
||||
|
||||
// Construct the output run
|
||||
uint8_t *next_run = openGL_output_builder_.array_builder.get_output_storage(OutputVertexSize);
|
||||
if(next_run) {
|
||||
uint8_t *next_output_run = openGL_output_builder_.array_builder.get_output_storage(OutputVertexSize);
|
||||
if(next_output_run) {
|
||||
output_x1() = output_run_.x1;
|
||||
output_position_y() = output_run_.y;
|
||||
output_tex_y() = output_y;
|
||||
@ -364,8 +364,8 @@ Outputs::CRT::Rect CRT::get_rect_for_area(int first_line_after_sync, int number_
|
||||
unsigned int horizontal_retrace_period = horizontal_period - horizontal_scan_period;
|
||||
|
||||
// make sure that the requested range is visible
|
||||
if(first_cycle_after_sync < horizontal_retrace_period) first_cycle_after_sync = (int)horizontal_retrace_period;
|
||||
if(first_cycle_after_sync + number_of_cycles > horizontal_scan_period) number_of_cycles = (int)(horizontal_scan_period - (unsigned)first_cycle_after_sync);
|
||||
if((unsigned int)first_cycle_after_sync < horizontal_retrace_period) first_cycle_after_sync = (int)horizontal_retrace_period;
|
||||
if((unsigned int)(first_cycle_after_sync + number_of_cycles) > horizontal_scan_period) number_of_cycles = (int)(horizontal_scan_period - (unsigned)first_cycle_after_sync);
|
||||
|
||||
float start_x = (float)((unsigned)first_cycle_after_sync - horizontal_retrace_period) / (float)horizontal_scan_period;
|
||||
float width = (float)number_of_cycles / (float)horizontal_scan_period;
|
||||
|
@ -43,7 +43,7 @@ class CRT {
|
||||
// elements of sync separation
|
||||
bool is_receiving_sync_; // true if the CRT is currently receiving sync (i.e. this is for edge triggering of horizontal sync)
|
||||
int sync_capacitor_charge_level_; // this charges up during times of sync and depletes otherwise; needs to hit a required threshold to trigger a vertical sync
|
||||
int sync_capacitor_charge_threshold_; // this charges up during times of sync and depletes otherwise; needs to hit a required threshold to trigger a vertical sync
|
||||
unsigned int sync_capacitor_charge_threshold_; // this charges up during times of sync and depletes otherwise; needs to hit a required threshold to trigger a vertical sync
|
||||
unsigned int sync_period_;
|
||||
|
||||
struct Scan {
|
||||
|
@ -102,7 +102,7 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
||||
}
|
||||
|
||||
// make sure there's a target to draw to
|
||||
if(!framebuffer_ || framebuffer_->get_height() != output_height || framebuffer_->get_width() != output_width) {
|
||||
if(!framebuffer_ || (unsigned int)framebuffer_->get_height() != output_height || (unsigned int)framebuffer_->get_width() != output_width) {
|
||||
std::unique_ptr<OpenGL::TextureTarget> new_framebuffer(new OpenGL::TextureTarget((GLsizei)output_width, (GLsizei)output_height, pixel_accumulation_texture_unit, GL_LINEAR));
|
||||
if(framebuffer_) {
|
||||
new_framebuffer->bind_framebuffer();
|
||||
|
@ -331,7 +331,7 @@ void IntermediateShader::set_filter_coefficients(float sampling_rate, float cuto
|
||||
GLfloat offsets[5];
|
||||
unsigned int taps = 11;
|
||||
// unsigned int taps = 21;
|
||||
while(1) {
|
||||
// while(1) {
|
||||
float coefficients[21];
|
||||
SignalProcessing::FIRFilter luminance_filter(taps, sampling_rate, 0.0f, cutoff_frequency, SignalProcessing::FIRFilter::DefaultAttenuation);
|
||||
luminance_filter.get_coefficients(coefficients);
|
||||
@ -341,12 +341,12 @@ void IntermediateShader::set_filter_coefficients(float sampling_rate, float cuto
|
||||
memset(weights, 0, sizeof(float)*12);
|
||||
memset(offsets, 0, sizeof(float)*5);
|
||||
|
||||
int halfSize = (taps >> 1);
|
||||
for(int c = 0; c < taps; c++) {
|
||||
if(c < 5) offsets[c] = (halfSize - c);
|
||||
unsigned int half_size = (taps >> 1);
|
||||
for(unsigned int c = 0; c < taps; c++) {
|
||||
if(c < 5) offsets[c] = (half_size - c);
|
||||
weights[c] = coefficients[c];
|
||||
}
|
||||
break;
|
||||
// break;
|
||||
|
||||
// int halfSize = (taps >> 1);
|
||||
// while(c < halfSize && sample < 5) {
|
||||
@ -368,8 +368,8 @@ void IntermediateShader::set_filter_coefficients(float sampling_rate, float cuto
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
taps -= 2;
|
||||
}
|
||||
// taps -= 2;
|
||||
// }
|
||||
|
||||
set_uniform("weights", 4, 3, weights);
|
||||
set_uniform("offsets", 1, 5, offsets);
|
||||
|
@ -59,7 +59,7 @@ class Speaker {
|
||||
}
|
||||
|
||||
void set_output_quality(int number_of_taps) {
|
||||
requested_number_of_taps_ = number_of_taps;
|
||||
requested_number_of_taps_ = (size_t)number_of_taps;
|
||||
set_needs_updated_filter_coefficients();
|
||||
}
|
||||
|
||||
@ -104,8 +104,8 @@ class Speaker {
|
||||
|
||||
std::vector<int16_t> buffer_in_progress_;
|
||||
float high_frequency_cut_off_;
|
||||
int buffer_in_progress_pointer_;
|
||||
int number_of_taps_, requested_number_of_taps_;
|
||||
size_t buffer_in_progress_pointer_;
|
||||
size_t number_of_taps_, requested_number_of_taps_;
|
||||
bool coefficients_are_dirty_;
|
||||
Delegate *delegate_;
|
||||
|
||||
@ -171,7 +171,7 @@ template <class T> class Filter: public Speaker {
|
||||
// if the output rate is less than the input rate, use the filter
|
||||
if(input_cycles_per_second_ > output_cycles_per_second_ || (input_cycles_per_second_ == output_cycles_per_second_ && high_frequency_cut_off_ >= 0.0)) {
|
||||
while(cycles_remaining) {
|
||||
unsigned int cycles_to_read = (unsigned int)std::min((int)cycles_remaining, number_of_taps_ - input_buffer_depth_);
|
||||
unsigned int cycles_to_read = (unsigned int)std::min((size_t)cycles_remaining, number_of_taps_ - input_buffer_depth_);
|
||||
static_cast<T *>(this)->get_samples(cycles_to_read, &input_buffer_[(size_t)input_buffer_depth_]);
|
||||
cycles_remaining -= cycles_to_read;
|
||||
input_buffer_depth_ += cycles_to_read;
|
||||
@ -216,14 +216,14 @@ template <class T> class Filter: public Speaker {
|
||||
std::unique_ptr<SignalProcessing::FIRFilter> filter_;
|
||||
|
||||
std::vector<int16_t> input_buffer_;
|
||||
int input_buffer_depth_;
|
||||
size_t input_buffer_depth_;
|
||||
|
||||
void update_filter_coefficients() {
|
||||
// make a guess at a good number of taps if this hasn't been provided explicitly
|
||||
if(requested_number_of_taps_) {
|
||||
number_of_taps_ = requested_number_of_taps_;
|
||||
} else {
|
||||
number_of_taps_ = (int)ceilf((input_cycles_per_second_ + output_cycles_per_second_) / output_cycles_per_second_);
|
||||
number_of_taps_ = (size_t)ceilf((input_cycles_per_second_ + output_cycles_per_second_) / output_cycles_per_second_);
|
||||
number_of_taps_ *= 2;
|
||||
number_of_taps_ |= 1;
|
||||
}
|
||||
@ -235,9 +235,9 @@ template <class T> class Filter: public Speaker {
|
||||
|
||||
float high_pass_frequency;
|
||||
if(high_frequency_cut_off_ > 0.0) {
|
||||
high_pass_frequency = std::min((float)output_cycles_per_second_ / 2.0f, high_frequency_cut_off_);
|
||||
high_pass_frequency = std::min(output_cycles_per_second_ / 2.0f, high_frequency_cut_off_);
|
||||
} else {
|
||||
high_pass_frequency = (float)output_cycles_per_second_ / 2.0f;
|
||||
high_pass_frequency = output_cycles_per_second_ / 2.0f;
|
||||
}
|
||||
filter_.reset(new SignalProcessing::FIRFilter((unsigned int)number_of_taps_, (float)input_cycles_per_second_, 0.0, high_pass_frequency, SignalProcessing::FIRFilter::DefaultAttenuation));
|
||||
|
||||
|
@ -426,7 +426,7 @@ template <class T> class Processor {
|
||||
size_t destination = 0;
|
||||
for(size_t c = 0; c < 256; c++) {
|
||||
target.instructions[c] = &target.all_operations[destination];
|
||||
for(int t = 0; t < lengths[c];) {
|
||||
for(size_t t = 0; t < lengths[c];) {
|
||||
// Skip zero-length bus cycles.
|
||||
if(table[c][t].type == MicroOp::BusOperation && table[c][t].machine_cycle.length == 0) {
|
||||
t++;
|
||||
|
@ -38,7 +38,7 @@ static std::unique_ptr<File::Chunk> GetNextChunk(const std::shared_ptr<Storage::
|
||||
|
||||
// read out name
|
||||
char name[11];
|
||||
int name_ptr = 0;
|
||||
size_t name_ptr = 0;
|
||||
while(!tape->is_at_end() && name_ptr < sizeof(name)) {
|
||||
name[name_ptr] = (char)parser.get_next_byte(tape);
|
||||
if(!name[name_ptr]) break;
|
||||
@ -80,7 +80,7 @@ static std::unique_ptr<File::Chunk> GetNextChunk(const std::shared_ptr<Storage::
|
||||
return parser.get_error_flag() ? nullptr : std::move(new_chunk);
|
||||
}
|
||||
|
||||
std::unique_ptr<File> GetNextFile(std::deque<File::Chunk> &chunks) {
|
||||
static std::unique_ptr<File> GetNextFile(std::deque<File::Chunk> &chunks) {
|
||||
// find next chunk with a block number of 0
|
||||
while(chunks.size() && chunks.front().block_number) {
|
||||
chunks.pop_front();
|
||||
|
@ -51,7 +51,7 @@ static std::shared_ptr<File> ZX81FileFromData(const std::vector<uint8_t> &data)
|
||||
// Look for a file name.
|
||||
size_t data_pointer = 0;
|
||||
std::vector<uint8_t> name_data;
|
||||
int c = 11;
|
||||
size_t c = 11;
|
||||
while(c < data.size() && c--) {
|
||||
name_data.push_back(data[data_pointer] & 0x3f);
|
||||
if(data[data_pointer] & 0x80) break;
|
||||
@ -121,7 +121,7 @@ std::wstring Storage::Data::ZX8081::StringFromData(const std::vector<uint8_t> &d
|
||||
return string;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> DataFromString(const std::wstring &string, bool is_zx81) {
|
||||
std::vector<uint8_t> Storage::Data::ZX8081::DataFromString(const std::wstring &string, bool is_zx81) {
|
||||
std::vector<uint8_t> data;
|
||||
|
||||
// TODO
|
||||
|
@ -47,8 +47,8 @@ void DigitalPhaseLockedLoop::add_pulse() {
|
||||
}
|
||||
}
|
||||
|
||||
void DigitalPhaseLockedLoop::post_phase_offset(int phase, int offset) {
|
||||
offset_history_[offset_history_pointer_] = offset;
|
||||
void DigitalPhaseLockedLoop::post_phase_offset(int new_phase, int new_offset) {
|
||||
offset_history_[offset_history_pointer_] = new_offset;
|
||||
offset_history_pointer_ = (offset_history_pointer_ + 1) % offset_history_.size();
|
||||
|
||||
// use an unweighted average of the stored offsets to compute current window size,
|
||||
@ -65,7 +65,7 @@ void DigitalPhaseLockedLoop::post_phase_offset(int phase, int offset) {
|
||||
window_length_ = total_spacing / total_divisor;
|
||||
}
|
||||
|
||||
int error = phase - (window_length_ >> 1);
|
||||
int error = new_phase - (window_length_ >> 1);
|
||||
|
||||
// use a simple spring mechanism as a lowpass filter for phase
|
||||
phase_ -= (error + 1) >> 1;
|
||||
|
@ -141,12 +141,12 @@ template<class T> std::shared_ptr<Storage::Disk::Track>
|
||||
shifter.add_index_address_mark();
|
||||
|
||||
// add the post-index mark
|
||||
for(int c = 0; c < post_index_address_mark_bytes; c++) shifter.add_byte(post_index_address_mark_value);
|
||||
for(size_t c = 0; c < post_index_address_mark_bytes; c++) shifter.add_byte(post_index_address_mark_value);
|
||||
|
||||
// add sectors
|
||||
for(const Sector §or : sectors) {
|
||||
// gap
|
||||
for(int c = 0; c < pre_address_mark_bytes; c++) shifter.add_byte(0x00);
|
||||
for(size_t c = 0; c < pre_address_mark_bytes; c++) shifter.add_byte(0x00);
|
||||
|
||||
// sector header
|
||||
shifter.add_ID_address_mark();
|
||||
@ -158,8 +158,8 @@ template<class T> std::shared_ptr<Storage::Disk::Track>
|
||||
shifter.add_crc();
|
||||
|
||||
// gap
|
||||
for(int c = 0; c < post_address_mark_bytes; c++) shifter.add_byte(0x4e);
|
||||
for(int c = 0; c < pre_data_mark_bytes; c++) shifter.add_byte(0x00);
|
||||
for(size_t c = 0; c < post_address_mark_bytes; c++) shifter.add_byte(0x4e);
|
||||
for(size_t c = 0; c < pre_data_mark_bytes; c++) shifter.add_byte(0x00);
|
||||
|
||||
// data
|
||||
shifter.add_data_address_mark();
|
||||
@ -170,8 +170,8 @@ template<class T> std::shared_ptr<Storage::Disk::Track>
|
||||
shifter.add_crc();
|
||||
|
||||
// gap
|
||||
for(int c = 0; c < post_data_bytes; c++) shifter.add_byte(0x00);
|
||||
for(int c = 0; c < inter_sector_gap; c++) shifter.add_byte(0x4e);
|
||||
for(size_t c = 0; c < post_data_bytes; c++) shifter.add_byte(0x00);
|
||||
for(size_t c = 0; c < inter_sector_gap; c++) shifter.add_byte(0x4e);
|
||||
}
|
||||
|
||||
while(segment.data.size() < expected_track_bytes) shifter.add_byte(0x00);
|
||||
|
@ -64,7 +64,7 @@ std::shared_ptr<Track> AcornADF::get_uncached_track_at_position(unsigned int hea
|
||||
fseek(file_, file_offset, SEEK_SET);
|
||||
|
||||
std::vector<Storage::Encodings::MFM::Sector> sectors;
|
||||
for(int sector = 0; sector < sectors_per_track; sector++) {
|
||||
for(unsigned int sector = 0; sector < sectors_per_track; sector++) {
|
||||
Storage::Encodings::MFM::Sector new_sector;
|
||||
new_sector.track = (uint8_t)position;
|
||||
new_sector.side = (uint8_t)head;
|
||||
|
@ -126,7 +126,7 @@ void TZX::get_generalised_segment(uint32_t output_symbols, uint8_t max_pulses_pe
|
||||
base <<= 1;
|
||||
bits++;
|
||||
}
|
||||
for(int c = 0; c < output_symbols; c++) {
|
||||
for(size_t c = 0; c < output_symbols; c++) {
|
||||
uint8_t symbol_value;
|
||||
int count;
|
||||
if(is_data) {
|
||||
|
@ -25,7 +25,6 @@ class PRG: public Tape, public Storage::FileHolder {
|
||||
Constructs a @c T64 containing content from the file with name @c file_name, of type @c type.
|
||||
|
||||
@param file_name The name of the file to load.
|
||||
@param type The type of data the file should contain.
|
||||
@throws ErrorBadFormat if this file could not be opened and recognised as the specified type.
|
||||
*/
|
||||
PRG(const char *file_name);
|
||||
|
Loading…
Reference in New Issue
Block a user