Re-arranged files
This commit is contained in:
parent
7243b50fbc
commit
b070dc655a
|
@ -23,8 +23,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static constexpr void io_class__volatile_assign(volatile T& dst, const T& src) {
|
static constexpr __always_inline void io_class__volatile_assign(T& dst, const T& src) {
|
||||||
dst.raw_value = src.raw_value;
|
typedef decltype(dst.raw_value) DST_VALUE;
|
||||||
|
|
||||||
|
const_cast<volatile DST_VALUE&>(dst.raw_value) = src.raw_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_IO_CLASS_HELPER_HPP__
|
#endif //!__JABYENGINE_IO_CLASS_HELPER_HPP__
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __JABYENGINE_SPU_PORTS_HPP__
|
#ifndef __JABYENGINE_SPU_IO_HPP__
|
||||||
#define __JABYENGINE_SPU_PORTS_HPP__
|
#define __JABYENGINE_SPU_IO_HPP__
|
||||||
#include "../Auxiliary/io_class_helper.hpp"
|
#include "../../Auxiliary/io_class_helper.hpp"
|
||||||
#include "../../limits.h"
|
#include <limits.h>
|
||||||
|
|
||||||
namespace SPU {
|
namespace SPU {
|
||||||
enum Mode {
|
enum Mode {
|
||||||
|
@ -46,17 +46,13 @@ namespace SPU {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//A value between 0 and 1000
|
constexpr auto& set_volume(int16_t volume) {
|
||||||
constexpr auto& set_volume_step(VolumeStep volume_step) {
|
this->raw_value = bit::value::set_normalized(this->raw_value, static_cast<int16_t>((volume >> 1)), __start_end_bit2_start_length(0, 14));
|
||||||
volume_step *= SingleVolumeStep;
|
|
||||||
|
|
||||||
this->raw_value = bit::value::set_normalized(this->raw_value, volume_step, __start_end_bit2_start_length(0, 14));
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//A value between 0 and 1000
|
constexpr int16_t get_volume_step() const {
|
||||||
constexpr VolumeStep get_volume_step() const {
|
return bit::value::get_normalized(this->raw_value, __start_end_bit2_start_length(0, 14));
|
||||||
return (bit::value::get_normalized(this->raw_value, __start_end_bit2_start_length(0, 14))/SingleVolumeStep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
io_class__2option_map(volume_mode, sweep_mode, 15);
|
io_class__2option_map(volume_mode, sweep_mode, 15);
|
||||||
|
@ -109,4 +105,4 @@ namespace SPU {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //!__JABYENGINE_SPU_PORTS_HPP__
|
#endif //!__JABYENGINE_SPU_IO_HPP__
|
|
@ -68,16 +68,16 @@ SECTIONS {
|
||||||
{
|
{
|
||||||
.planschi
|
.planschi
|
||||||
{
|
{
|
||||||
*libJabyEngine.a:start.o(.text.startup._GLOBAL__*)
|
*libJabyEngine.a:boot_*.o(.text.startup._GLOBAL__*)
|
||||||
*libJabyEngine.a:start.o(.ctors)
|
*libJabyEngine.a:boot_*.o(.ctors)
|
||||||
|
|
||||||
*libJabyEngine.a:start.o(.text.*)
|
*libJabyEngine.a:boot_*.o(.text.*)
|
||||||
*libJabyEngine.a:start.o(.rodata*)
|
*libJabyEngine.a:boot_*.o(.rodata*)
|
||||||
*libJabyEngine.a:start.o(.sdata*)
|
*libJabyEngine.a:boot_*.o(.sdata*)
|
||||||
*libJabyEngine.a:start.o(.data*)
|
*libJabyEngine.a::boot_*.o(.data*)
|
||||||
*libJabyEngine.a:start.o(.sbss*)
|
*libJabyEngine.a::boot_*.o(.sbss*)
|
||||||
*libJabyEngine.a:start.o(.bss*)
|
*libJabyEngine.a::boot_*.o(.bss*)
|
||||||
*libJabyEngine.a:start.o(*)
|
*libJabyEngine.a::boot_*.o(*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__boot_loader_end = .;
|
__boot_loader_end = .;
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"C_Cpp.default.includePath": [
|
"C_Cpp.default.includePath": [
|
||||||
|
"include",
|
||||||
"../../include"
|
"../../include"
|
||||||
],
|
],
|
||||||
"C_Cpp.default.compilerPath": "",
|
"C_Cpp.default.compilerPath": "",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
ARTIFACT = libJabyEngine
|
ARTIFACT = libJabyEngine
|
||||||
BUILD_DIR = bin
|
BUILD_DIR = bin
|
||||||
|
|
||||||
CCFLAGS += -I../../include
|
CCFLAGS += -Iinclude -I../../include
|
||||||
CCFLAGS += -save-temps=obj
|
CCFLAGS += -save-temps=obj
|
||||||
|
|
||||||
include ../../lib/Wildcard.mk
|
include ../../lib/Wildcard.mk
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef BOOT_LOADER_HPP
|
||||||
|
#define BOOT_LOADER_HPP
|
||||||
|
|
||||||
|
namespace SPU {
|
||||||
|
void setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //!BOOT_LOADER_HPP
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include <PSX/System/IOPorts/SPU_IO.hpp>
|
||||||
|
|
||||||
|
namespace SPU {
|
||||||
|
static void clear_voice(Voice& voice) {
|
||||||
|
io_class__volatile_assign(voice.volumeLeft, SweepVolume());
|
||||||
|
io_class__volatile_assign(voice.volumeRight, SweepVolume());
|
||||||
|
|
||||||
|
io_class__volatile_assign(voice.sampleRate, SampleRate::from_HZ(0.0));
|
||||||
|
io_class__volatile_assign(voice.adsr, ADSR());
|
||||||
|
io_class__volatile_assign(voice.currentVolume, SweepVolume());
|
||||||
|
|
||||||
|
voice.adr = 0x200;
|
||||||
|
voice.repeatAdr = 0x200;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
static constexpr auto StartVol = SweepVolume().set_volume_mode().set_volume_percent(50.0);
|
||||||
|
|
||||||
|
io_class__volatile_assign(MainVolume::Left, StartVol);
|
||||||
|
io_class__volatile_assign(MainVolume::Right, StartVol);
|
||||||
|
|
||||||
|
for(auto& voice : Voice::Channel) {
|
||||||
|
clear_voice(voice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include "BootLoader/boot_loader.hpp"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
namespace JabyEngine {
|
||||||
|
void start() {
|
||||||
|
printf("Hello Planschbecken\n");
|
||||||
|
|
||||||
|
SPU::setup();
|
||||||
|
printf("Setup done!\n");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,36 +0,0 @@
|
||||||
#include <PSX/SPU/SPU_Ports.hpp>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
namespace JabyEngine {
|
|
||||||
namespace SPU {
|
|
||||||
static void clear_voice(::SPU::Voice& voice) {
|
|
||||||
io_class__volatile_assign(voice.volumeLeft, ::SPU::SweepVolume());
|
|
||||||
io_class__volatile_assign(voice.volumeRight, ::SPU::SweepVolume());
|
|
||||||
|
|
||||||
io_class__volatile_assign(voice.sampleRate, ::SPU::SampleRate::from_HZ(0.0));
|
|
||||||
io_class__volatile_assign(voice.adsr, ::SPU::ADSR());
|
|
||||||
io_class__volatile_assign(voice.currentVolume, ::SPU::SweepVolume());
|
|
||||||
|
|
||||||
voice.adr = 0x200;
|
|
||||||
voice.repeatAdr = 0x200;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setup() {
|
|
||||||
static constexpr auto StartVol = ::SPU::SweepVolume().set_volume_mode().set_volume_percent(50.0);
|
|
||||||
|
|
||||||
io_class__volatile_assign(::SPU::MainVolume::Left, StartVol);
|
|
||||||
io_class__volatile_assign(::SPU::MainVolume::Right, StartVol);
|
|
||||||
|
|
||||||
for(auto& voice : ::SPU::Voice::Channel) {
|
|
||||||
clear_voice(voice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void start() {
|
|
||||||
printf("Hello Planschbecken\n");
|
|
||||||
|
|
||||||
SPU::setup();
|
|
||||||
printf("Setup done!\n");
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue