add experimental VGAT4 sound support

This commit is contained in:
jean-marcharvengt 2020-10-17 16:06:14 +02:00
parent 1ec8b17d0e
commit 8dee01b44f
67 changed files with 1173 additions and 752 deletions

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -91,21 +89,21 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { extern "C" {
void POKEYSND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} }
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
POKEYSND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -362,7 +362,7 @@ void POKEYSND_SetMzQuality(int quality) /* specially for win32, perhaps not need
mz_quality = quality; mz_quality = quality;
} }
void POKEYSND_Process(void *sndbuffer, int sndn) void SND_Process(void *sndbuffer, int sndn)
{ {
POKEYSND_Process_ptr(sndbuffer, sndn); POKEYSND_Process_ptr(sndbuffer, sndn);
#if defined(PBI_XLD) || defined (VOICEBOX) #if defined(PBI_XLD) || defined (VOICEBOX)

View file

@ -202,7 +202,7 @@ void * emu_LineBuffer(int line)
void setup() { void setup() {
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
tft.begin(VGA_MODE_352x240); tft.begin(VGA_MODE_320x240);
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 0); // NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
#else #else
tft.begin(); tft.begin();
@ -273,32 +273,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -95,17 +93,17 @@ void SND_Process(void *sndbuffer, int sndn);
//} //}
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -7,7 +7,7 @@
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
//#define HAS_SND 1 #define HAS_SND 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1
//#define HAS_I2CKBD 1 //#define HAS_I2CKBD 1

View file

@ -275,31 +275,33 @@ void loop(void)
} }
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
AudioMemory(16); #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -91,21 +89,21 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { extern "C" {
void POKEYSND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} }
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
POKEYSND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -4,7 +4,7 @@
//#define OLD_LAYOUT 1 //#define OLD_LAYOUT 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -362,7 +362,7 @@ void POKEYSND_SetMzQuality(int quality) /* specially for win32, perhaps not need
mz_quality = quality; mz_quality = quality;
} }
void POKEYSND_Process(void *sndbuffer, int sndn) void SND_Process(void *sndbuffer, int sndn)
{ {
POKEYSND_Process_ptr(sndbuffer, sndn); POKEYSND_Process_ptr(sndbuffer, sndn);
#if defined(PBI_XLD) || defined (VOICEBOX) #if defined(PBI_XLD) || defined (VOICEBOX)

View file

@ -202,7 +202,7 @@ void * emu_LineBuffer(int line)
void setup() { void setup() {
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
tft.begin(VGA_MODE_352x240); tft.begin(VGA_MODE_320x240);
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 255); // NVIC_SET_PRIORITY(IRQ_QTIMER3, 255);
#else #else
tft.begin(); tft.begin();
@ -269,36 +269,33 @@ void loop(void)
} }
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable(); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6); // sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -95,17 +93,17 @@ void SND_Process(void *sndbuffer, int sndn);
} }
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -4,7 +4,7 @@
//#define OLD_LAYOUT 1 //#define OLD_LAYOUT 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -203,7 +203,7 @@ void * emu_LineBuffer(int line)
void setup() { void setup() {
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
tft.begin(VGA_MODE_352x240); tft.begin(VGA_MODE_320x240);
// NVIC_SET_PRIORITY(IRQ_QTIMER3, 0); // NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
#else #else
tft.begin(); tft.begin();
@ -271,35 +271,33 @@ void loop(void)
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

BIN
MCUME_teensy/teensycolem/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -90,22 +88,22 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { //extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} //}
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -201,7 +201,7 @@ int coc_Start(char * Cartridge)
snd_Reset(); snd_Reset();
#endif #endif
#ifdef SOUND_PRESENT #ifdef SOUND_PRESENT
snd_Open(22050, 2, 4096/*16384*/,(void*)snd_Mixer); snd_Open(44100/*22050*/, 2, 4096/*16384*/,(void*)snd_Mixer);
#endif #endif
/* Initialize VDP registers */ /* Initialize VDP registers */

View file

@ -4,7 +4,7 @@
//#define OLD_LAYOUT 1 //#define OLD_LAYOUT 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -270,35 +270,33 @@ void loop(void)
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,9 +68,7 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void)
PROGMEM static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
chan[0].vol = 0; chan[0].vol = 0;
@ -90,20 +88,22 @@ PROGMEM static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
//extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
//}
#endif #endif
PROGMEM static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -131,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
} }
} }
PROGMEM void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
PROGMEM void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
} }
PROGMEM void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
PROGMEM void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
PROGMEM bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
{ {
return playing; return playing;
} }
PROGMEM void AudioPlaySystem::update(void) { #ifndef HAS_T4_VGA
audio_block_t *block; void AudioPlaySystem::update(void) {
audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
if (C < 6) { if (C < 6) {
chan[C].vol = V; chan[C].vol = V;
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
#endif #endif
} }
PROGMEM void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -5,7 +5,7 @@
#define HAS_T41 1 #define HAS_T41 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -210,6 +210,7 @@ void setup() {
myTimer.begin(vblCount, 20000); //to run every 20ms myTimer.begin(vblCount, 20000); //to run every 20ms
} }
// **************************************************** // ****************************************************
// the loop() method runs continuously // the loop() method runs continuously
// **************************************************** // ****************************************************
@ -262,41 +263,38 @@ void loop(void)
if ( (!virtualkeyboardIsActive()) || (vgaMode) ) { if ( (!virtualkeyboardIsActive()) || (vgaMode) ) {
emu_Step(); emu_Step();
uint16_t bClick = emu_DebounceLocalKeys(); uint16_t bClick = emu_DebounceLocalKeys();
emu_Input(bClick); emu_Input(bClick);
} }
} }
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,9 +68,7 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void)
PROGMEM static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
chan[0].vol = 0; chan[0].vol = 0;
@ -90,20 +88,22 @@ PROGMEM static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
//extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
//}
#endif #endif
PROGMEM static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -131,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
} }
} }
PROGMEM void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
PROGMEM void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
} }
PROGMEM void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
PROGMEM void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
PROGMEM bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
{ {
return playing; return playing;
} }
PROGMEM void AudioPlaySystem::update(void) { #ifndef HAS_T4_VGA
audio_block_t *block; void AudioPlaySystem::update(void) {
audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
if (C < 6) { if (C < 6) {
chan[C].vol = V; chan[C].vol = V;
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
#endif #endif
} }
PROGMEM void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -277,31 +277,33 @@ void loop(void)
} }
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
AudioMemory(16); #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif
mymixer.start(); mymixer.start();
} }

View file

@ -68,9 +68,7 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void)
PROGMEM static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
chan[0].vol = 0; chan[0].vol = 0;
@ -95,17 +93,17 @@ void SND_Process(void *sndbuffer, int sndn);
} }
#endif #endif
PROGMEM static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -133,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
} }
} }
PROGMEM void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
PROGMEM void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
} }
PROGMEM void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
PROGMEM void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
PROGMEM bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
{ {
return playing; return playing;
} }
PROGMEM void AudioPlaySystem::update(void) { #ifndef HAS_T4_VGA
audio_block_t *block; void AudioPlaySystem::update(void) {
audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
if (C < 6) { if (C < 6) {
chan[C].vol = V; chan[C].vol = V;
@ -192,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
#endif #endif
} }
PROGMEM void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -207,7 +207,7 @@ void setup() {
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
tft.begin(VGA_MODE_320x240); tft.begin(VGA_MODE_320x240);
NVIC_SET_PRIORITY(IRQ_QTIMER3, 0); //NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
#else #else
tft.begin(); tft.begin();
#endif #endif
@ -282,28 +282,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
AudioMemory(16); #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -95,17 +93,17 @@ void SND_Process(void *sndbuffer, int sndn);
} }
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -4,7 +4,7 @@
//#define OLD_LAYOUT 1 //#define OLD_LAYOUT 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -274,32 +274,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -90,22 +88,22 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { //extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} //}
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -273,32 +273,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,9 +68,7 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void)
PROGMEM static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
chan[0].vol = 0; chan[0].vol = 0;
@ -90,20 +88,22 @@ PROGMEM static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
//extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
//}
#endif #endif
PROGMEM static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -131,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
} }
} }
PROGMEM void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
PROGMEM void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
} }
PROGMEM void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
PROGMEM void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
PROGMEM bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
{ {
return playing; return playing;
} }
PROGMEM void AudioPlaySystem::update(void) { #ifndef HAS_T4_VGA
audio_block_t *block; void AudioPlaySystem::update(void) {
audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
if (C < 6) { if (C < 6) {
chan[C].vol = V; chan[C].vol = V;
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
#endif #endif
} }
PROGMEM void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -5,7 +5,7 @@
#define HAS_T41 1 #define HAS_T41 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -270,32 +270,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,9 +68,7 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void)
PROGMEM static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
chan[0].vol = 0; chan[0].vol = 0;
@ -90,20 +88,22 @@ PROGMEM static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
//extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
//}
#endif #endif
PROGMEM static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -131,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
} }
} }
PROGMEM void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
PROGMEM void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
} }
PROGMEM void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
PROGMEM void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
PROGMEM bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
{ {
return playing; return playing;
} }
PROGMEM void AudioPlaySystem::update(void) { #ifndef HAS_T4_VGA
audio_block_t *block; void AudioPlaySystem::update(void) {
audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
if (C < 6) { if (C < 6) {
chan[C].vol = V; chan[C].vol = V;
@ -190,7 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
#endif #endif
} }
PROGMEM void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -5,7 +5,7 @@
#define HAS_T41 1 #define HAS_T41 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -277,31 +277,33 @@ void loop(void)
} }
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
AudioMemory(16); #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif
mymixer.start(); mymixer.start();
} }

BIN
MCUME_teensy/teensyspeccy/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -90,22 +88,22 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { //extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} //}
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -198,4 +198,3 @@ void AudioPlaySystem::step(void) {
void AudioPlaySystem::buzz(int size, int val) { void AudioPlaySystem::buzz(int size, int val) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -4,7 +4,7 @@
//#define OLD_LAYOUT 1 //#define OLD_LAYOUT 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HAS_SND 1 #define HAS_SND 1
//#define INVX 1 //#define INVX 1
//#define INVY 1 //#define INVY 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1

View file

@ -273,32 +273,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -90,22 +88,22 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { //extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} //}
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -270,35 +270,33 @@ void loop(void)
} }
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
sgtl5000_1.enable(); tft.begin_audio(256, mymixer.snd_Mixer);
sgtl5000_1.volume(0.6); // sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif #endif
AudioMemory(16);
mymixer.start(); mymixer.start();
} }

View file

@ -68,8 +68,6 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void) static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -90,22 +88,22 @@ static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
extern "C" { //extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
} //}
#endif #endif
static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -135,14 +133,14 @@ static void snd_Mixer(short * stream, int len )
void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
//setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
@ -151,14 +149,14 @@ void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
@ -166,22 +164,24 @@ bool AudioPlaySystem::isPlaying(void)
return playing; return playing;
} }
#ifndef HAS_T4_VGA
void AudioPlaySystem::update(void) { void AudioPlaySystem::update(void) {
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
@ -195,4 +195,3 @@ void AudioPlaySystem::sound(int C, int F, int V) {
void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,26 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -280,28 +280,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
AudioMemory(16); #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif
mymixer.start(); mymixer.start();
} }

View file

@ -68,9 +68,7 @@ static Channel chan[6] = {
volatile bool playing = false; volatile bool playing = false;
static void snd_Reset(void)
PROGMEM static void snd_Reset(void)
{ {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
chan[0].vol = 0; chan[0].vol = 0;
@ -90,20 +88,22 @@ PROGMEM static void snd_Reset(void)
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
//extern "C" {
void SND_Process(void *sndbuffer, int sndn); void SND_Process(void *sndbuffer, int sndn);
//}
#endif #endif
PROGMEM static void snd_Mixer(short * stream, int len )
FASTRUN void AudioPlaySystem::snd_Mixer(short * stream, int len )
{ {
if (playing) if (playing)
{ {
#ifdef CUSTOM_SND #ifdef CUSTOM_SND
SND_Process((void*)stream, len); SND_Process((void*)stream, len);
#else #else
int i; int i;
long s; long s;
len = len >> 1; len = len >> 1;
short v0=chan[0].vol; short v0=chan[0].vol;
short v1=chan[1].vol; short v1=chan[1].vol;
short v2=chan[2].vol; short v2=chan[2].vol;
@ -131,57 +131,59 @@ PROGMEM static void snd_Mixer(short * stream, int len )
} }
} }
PROGMEM void AudioPlaySystem::begin(void) void AudioPlaySystem::begin(void)
{ {
//emu_printf("AudioPlaySystem constructor"); this->reset();
this->reset();
setSampleParameters(CLOCKFREQ, SAMPLERATE);
} }
PROGMEM void AudioPlaySystem::start(void) void AudioPlaySystem::start(void)
{ {
//emu_printf("allocating sound buf"); #ifndef HAS_T4_VGA
AudioMemory(16);
#endif
playing = true; playing = true;
} }
PROGMEM void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) { void AudioPlaySystem::setSampleParameters(float clockfreq, float samplerate) {
} }
PROGMEM void AudioPlaySystem::reset(void) void AudioPlaySystem::reset(void)
{ {
snd_Reset(); snd_Reset();
} }
PROGMEM void AudioPlaySystem::stop(void) void AudioPlaySystem::stop(void)
{ {
//__disable_irq(); //__disable_irq();
playing = false; playing = false;
//__enable_irq(); //__enable_irq();
} }
PROGMEM bool AudioPlaySystem::isPlaying(void) bool AudioPlaySystem::isPlaying(void)
{ {
return playing; return playing;
} }
PROGMEM void AudioPlaySystem::update(void) { #ifndef HAS_T4_VGA
audio_block_t *block; void AudioPlaySystem::update(void) {
audio_block_t *block;
// only update if we're playing // only update if we're playing
if (!playing) return; if (!playing) return;
// allocate the audio blocks to transmit // allocate the audio blocks to transmit
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES); snd_Mixer((short*)block->data,AUDIO_BLOCK_SAMPLES);
//memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2); //memset( (void*)block->data, 0, AUDIO_BLOCK_SAMPLES*2);
transmit(block); transmit(block);
release(block); release(block);
} }
#endif
PROGMEM void AudioPlaySystem::sound(int C, int F, int V) { void AudioPlaySystem::sound(int C, int F, int V) {
#ifndef CUSTOM_SND #ifndef CUSTOM_SND
if (C < 6) { if (C < 6) {
chan[C].vol = V; chan[C].vol = V;
@ -190,8 +192,6 @@ PROGMEM void AudioPlaySystem::sound(int C, int F, int V) {
#endif #endif
} }
PROGMEM void AudioPlaySystem::step(void) { void AudioPlaySystem::step(void) {
} }
#endif #endif

View file

@ -3,27 +3,52 @@
#ifdef HAS_SND #ifdef HAS_SND
#include "platform_config.h"
//#undef HAS_T4_VGA // To force using Audio library!!
#ifndef HAS_T4_VGA
#include <Audio.h> #include <Audio.h>
class AudioPlaySystem : public AudioStream class AudioPlaySystem : public AudioStream
{ {
public: public:
AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); } AudioPlaySystem(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
void setSampleParameters(float clockfreq, float samplerate); void setSampleParameters(float clockfreq, float samplerate);
void reset(void); void reset(void);
void start(void); void start(void);
void stop(void); void stop(void);
bool isPlaying(void); bool isPlaying(void);
void sound(int C, int F, int V); void sound(int C, int F, int V);
void buzz(int size, int val); void buzz(int size, int val);
void step(void); void step(void);
private: private:
virtual void update(void); virtual void update(void);
static void snd_Mixer(short * stream, int len );
};
#else
class AudioPlaySystem
{
public:
AudioPlaySystem(void) { };
void begin(void);
void setSampleParameters(float clockfreq, float samplerate);
void reset(void);
void start(void);
void stop(void);
bool isPlaying(void);
void sound(int C, int F, int V);
void buzz(int size, int val);
void step(void);
static void snd_Mixer(short * stream, int len );
}; };
#endif
#endif #endif
#endif
#endif

View file

@ -7,10 +7,10 @@ extern "C" {
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
#include "vga_t_dma.h" #include "vga_t_dma.h"
const vga_pixel deflogo[] = { const int16_t deflogo[] = {
0,0 0,0
}; };
static const vga_pixel * logo = deflogo; static const int16_t * logo = deflogo;
#else #else
#include "tft_t_dma.h" #include "tft_t_dma.h"
const uint16_t deflogo[] = { const uint16_t deflogo[] = {

View file

@ -3,10 +3,11 @@
//#define OLD_LAYOUT 1 //#define OLD_LAYOUT 1
#define HAS_T4_VGA 1 #define HAS_T4_VGA 1
//#define HIRES 1
//#define INVX 1 //#define INVX 1
#define INVY 1 #define INVY 1
//#define HAS_SND 1 #define HAS_SND 1
#define HAS_USBKEY 1 #define HAS_USBKEY 1
//#define HAS_I2CKBD 1 //#define HAS_I2CKBD 1

View file

@ -202,8 +202,12 @@ void * emu_LineBuffer(int line)
void setup() { void setup() {
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
#ifdef HIRES
tft.begin(VGA_MODE_640x240); tft.begin(VGA_MODE_640x240);
NVIC_SET_PRIORITY(IRQ_QTIMER3, 0); #else
tft.begin(VGA_MODE_320x240);
#endif
//NVIC_SET_PRIORITY(IRQ_QTIMER3, 0);
#else #else
tft.begin(); tft.begin();
#endif #endif
@ -274,28 +278,31 @@ void loop(void)
#ifdef HAS_SND #ifdef HAS_SND
#include <Audio.h>
#include "AudioPlaySystem.h" #include "AudioPlaySystem.h"
AudioPlaySystem mymixer; AudioPlaySystem mymixer;
#ifndef HAS_T4_VGA
#include <Audio.h>
#if defined(__IMXRT1052__) || defined(__IMXRT1062__) #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
#ifdef HAS_T4_VGA //AudioOutputMQS mqs;
//AudioConnection patchCord9(mymixer, 0, mqs, 1);
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord8(mymixer, 0, i2s1, 0); AudioConnection patchCord8(mymixer, 0, i2s1, 0);
AudioConnection patchCord9(mymixer, 0, i2s1, 1); AudioConnection patchCord9(mymixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#else #else
AudioOutputMQS mqs;
AudioConnection patchCord9(mymixer, 0, mqs, 1);
#endif
#else
AudioOutputAnalog dac1; AudioOutputAnalog dac1;
AudioConnection patchCord1(mymixer, dac1); AudioConnection patchCord1(mymixer, dac1);
#endif #endif
#endif
void emu_sndInit() { void emu_sndInit() {
Serial.println("sound init"); Serial.println("sound init");
AudioMemory(16); #ifdef HAS_T4_VGA
tft.begin_audio(256, mymixer.snd_Mixer);
// sgtl5000_1.enable();
// sgtl5000_1.volume(0.6);
#endif
mymixer.start(); mymixer.start();
} }

View file

@ -57,10 +57,14 @@ struct uae_prefs currprefs = {
/* gfx_width */ WIN_W, /* gfx_width */ WIN_W,
/* gfx_height */ WIN_H, /* gfx_height */ WIN_H,
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA
#ifdef HIRES
/* gfx_lores */ 0, /* gfx_lores */ 0,
#else #else
/* gfx_lores */ 1, /* gfx_lores */ 1,
#endif #endif
#else
/* gfx_lores */ 1,
#endif
/* gfx_linedbl */ 0, /* gfx_linedbl */ 0,
/* gfx_correct_aspect */ 0, /* gfx_correct_aspect */ 0,
#ifdef HAS_T4_VGA #ifdef HAS_T4_VGA

View file

@ -15,9 +15,13 @@
#ifdef HIRES
#define TFT_WIDTH 640 //320 #define TFT_WIDTH 640
#define TFT_REALWIDTH 640 //320 #define TFT_REALWIDTH 640
#else
#define TFT_WIDTH 320
#define TFT_REALWIDTH 320
#endif
#define TFT_HEIGHT 240 #define TFT_HEIGHT 240
#define TFT_REALHEIGHT 240 #define TFT_REALHEIGHT 240
@ -44,8 +48,8 @@ class TFT_T_DMA: public VGA_T4
void fillScreenNoDma(vga_pixel color) { clear(color); } void fillScreenNoDma(vga_pixel color) { clear(color); }
void drawTextNoDma(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize) { drawText(x,y,text,fgcolor,bgcolor,doublesize); } void drawTextNoDma(int16_t x, int16_t y, const char * text, vga_pixel fgcolor, vga_pixel bgcolor, bool doublesize) { drawText(x,y,text,fgcolor,bgcolor,doublesize); }
void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { drawRect(x, y, w, h, color); } void drawRectNoDma(int16_t x, int16_t y, int16_t w, int16_t h, vga_pixel color) { drawRect(x, y, w, h, color); }
void drawSpriteNoDma(int16_t x, int16_t y, const vga_pixel *bitmap) { drawSprite(x, y, bitmap); } void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap) { drawSprite(x, y, bitmap); }
void drawSpriteNoDma(int16_t x, int16_t y, const vga_pixel *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh) { drawSprite(x, y, bitmap, croparx, cropary, croparw, croparh); } void drawSpriteNoDma(int16_t x, int16_t y, const int16_t *bitmap, uint16_t croparx, uint16_t cropary, uint16_t croparw, uint16_t croparh) { drawSprite(x, y, bitmap, croparx, cropary, croparw, croparh); }
}; };