Skip to content

Commit 6764851

Browse files
committed
adjust speaker volume
1 parent 5f1f195 commit 6764851

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

boards/a2n20v2/hdl/top.sv

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ module top #(
481481
// audio that is added to it.
482482

483483

484-
reg [7:0] speaker_audio;
484+
reg [6:0] speaker_audio;
485485
reg [7:0] speaker_audio_counter;
486486
reg prev_speaker_bit;
487487

@@ -496,39 +496,26 @@ module top #(
496496

497497
if ((speaker_audio_counter != 0) && (APPLE_SPEAKER_ENABLE | sw_apple_speaker_w)) begin
498498
if (speaker_bit) begin
499-
speaker_audio <= speaker_audio != 8'd127 ? speaker_audio + 8'd1 : 8'd127;
499+
speaker_audio <= speaker_audio != 7'd127 ? speaker_audio + 7'd1 : 7'd127;
500500
end else begin
501-
speaker_audio <= speaker_audio != 8'd0 ? speaker_audio - 8'd1 : 8'd0;
501+
speaker_audio <= speaker_audio != 7'd0 ? speaker_audio - 7'd1 : 7'd0;
502502
end
503503
end else begin
504-
speaker_audio <= speaker_audio != 8'd0 ? speaker_audio - 8'd1 : 8'd0;
504+
speaker_audio <= speaker_audio != 7'd0 ? speaker_audio - 7'd1 : 7'd0;
505505
end
506506
end
507507
end
508508

509-
/*
510-
reg [7:0] speaker_audio;
511-
always_ff @(posedge clk_pixel_w) begin
512-
if (clk_audio_r) begin
513-
if (speaker_bit) begin
514-
speaker_audio <= speaker_audio != 8'd127 ? speaker_audio + 8'd1 : 8'd127;
515-
end else begin
516-
speaker_audio <= speaker_audio != 8'd0 ? speaker_audio - 8'd1 : 8'd0;
517-
end
518-
end
519-
end
520-
*/
521-
522509
////
523510
logic [2:0] tmds;
524511
wire tmdsClk;
525512

526513
//wire [15:0] sample = {ssp_psg_mix_audio_o, 2'b00};
527514
reg [15:0] audio_sample_word[1:0], audio_sample_word0[1:0];
528515
always @(posedge clk_pixel_w) begin // crossing clock domain
529-
audio_sample_word0[0] <= ssp_audio_w + {mb_audio_l, 4'b00} + {speaker_audio, 8'b0};
516+
audio_sample_word0[0] <= ssp_audio_w + {mb_audio_l, 4'b00} + {2'b0, speaker_audio, 7'b0};
530517
audio_sample_word[0] <= audio_sample_word0[0];
531-
audio_sample_word0[1] <= ssp_audio_w + {mb_audio_r, 4'b00} + {speaker_audio, 8'b0};
518+
audio_sample_word0[1] <= ssp_audio_w + {mb_audio_r, 4'b00} + {2'b0, speaker_audio, 7'b0};
532519
audio_sample_word[1] <= audio_sample_word0[1];
533520
end
534521

0 commit comments

Comments
 (0)