Skip to content

Commit

Permalink
play audio notification
Browse files Browse the repository at this point in the history
  • Loading branch information
bucanero committed Aug 9, 2024
1 parent 9f440ce commit 8a569a6
Show file tree
Hide file tree
Showing 10 changed files with 1,443 additions and 10 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 17,14 @@ All notable changes to the `pkgi-psp` project will be documented in this file. T
* Add PSP-Go storage option
- Edit `config.txt` to change storage location (add line `storage ms0`)

### Misc

* Add OFW-compatible build

### Fixed

* Fix progress bar ETA when resuming downloads

### Misc

* Add OFW-compatible build

## [v1.0.0](https://github.com/bucanero/pkgi-psp/releases/tag/v1.0.0) - 2023-10-14

### Added
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 57,7 @@ add_resources(apollo_res ${res_files})

add_executable(${PROJECT_NAME}
${apollo_res}
source/ahx.c
source/pkg2iso.c
source/depackager.c
source/loadpng.c
Expand Down
Binary file added data/sound.ahx
Binary file not shown.
131 changes: 131 additions & 0 deletions include/ahx.h
Original file line number Diff line number Diff line change
@@ -0,0 1,131 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
*/

/**
* @file
* AHX player functions
*/

#ifndef __AHX_H__
#define __AHX_H__

struct AHXPListEntry
{
int Note;
int Fixed;
int Waveform;
int FX[2], FXParam[2];
};

struct AHXPList
{
int Speed, Length;
struct AHXPListEntry *Entries;
};

struct AHXEnvelope
{
int aFrames, aVolume;
int dFrames, dVolume;
int sFrames;
int rFrames, rVolume;
};

struct AHXInstrument
{
char *Name;
int Volume; // 0..64
int WaveLength; // 0..5 (shifts)
struct AHXEnvelope Envelope;
int FilterLowerLimit, FilterUpperLimit, FilterSpeed;
int SquareLowerLimit, SquareUpperLimit, SquareSpeed;
int VibratoDelay, VibratoDepth, VibratoSpeed;
int HardCutRelease, HardCutReleaseFrames;
struct AHXPList PList;
};

struct AHXPosition
{
int Track[4], Transpose[4];
};

struct AHXStep
{
int Note, Instrument, FX, FXParam;
};

struct AHXSong
{
char *Name;
int Restart, PositionNr, TrackLength, TrackNr, InstrumentNr, SubsongNr;
int Revision, SpeedMultiplier;
int *Subsongs;
};

struct AHXVoice
{
// Read those variables for mixing!
int VoiceVolume, VoicePeriod;
char VoiceBuffer[0x281]; // for oversampling optimization!
int Track, Transpose;
int NextTrack, NextTranspose;
int ADSRVolume; // fixed point 8:8
struct AHXEnvelope ADSR; // frames/delta fixed 8:8
struct AHXInstrument *Instrument; // current instrument
int InstrPeriod, TrackPeriod, VibratoPeriod;
int NoteMaxVolume, PerfSubVolume, TrackMasterVolume;
int NewWaveform, Waveform, PlantSquare, PlantPeriod, IgnoreSquare;
int TrackOn, FixedNote;
int VolumeSlideUp, VolumeSlideDown;
int HardCut, HardCutRelease, HardCutReleaseF;
int PeriodSlideSpeed, PeriodSlidePeriod, PeriodSlideLimit, PeriodSlideOn, PeriodSlideWithLimit;
int PeriodPerfSlideSpeed, PeriodPerfSlidePeriod, PeriodPerfSlideOn;
int VibratoDelay, VibratoCurrent, VibratoDepth, VibratoSpeed;
int SquareOn, SquareInit, SquareWait, SquareLowerLimit, SquareUpperLimit, SquarePos, SquareSign, SquareSlidingIn, SquareReverse;
int FilterOn, FilterInit, FilterWait, FilterLowerLimit, FilterUpperLimit, FilterPos, FilterSign, FilterSpeed, FilterSlidingIn, IgnoreFilter;
int PerfCurrent, PerfSpeed, PerfWait;
int WaveLength;
struct AHXPList *PerfList;
int NoteDelayWait, NoteDelayOn, NoteCutWait, NoteCutOn;
char *AudioSource;
int AudioPeriod, AudioVolume;
char SquareTempBuffer[0x80];
};

struct AHXWaves
{
char LowPasses[0x31588];
char Triangle04[0x04], Triangle08[0x08], Triangle10[0x10], Triangle20[0x20], Triangle40[0x40], Triangle80[0x80];
char Sawtooth04[0x04], Sawtooth08[0x08], Sawtooth10[0x10], Sawtooth20[0x20], Sawtooth40[0x40], Sawtooth80[0x80];
char Squares[0x1000];
char WhiteNoiseBig[0x780];
char HighPasses[0x31588];
};

void AHXPlayer_Init(void);
int AHXPlayer_LoadSongBuffer(void *Buffer, int Len);
int AHXPlayer_LoadSong(const char *Filename);
int AHXPlayer_InitSubsong(int Nr);
int AHXPlayer_SongCompleted(void);
void AHXPlayer_FreeSong(void);
void AHXPlayer_NextPosition(void);
void AHXPlayer_PrevPosition(void);
void AHXPlayer_VoiceOnOff(int Voice, int OnOff);
void AHXPlayer_SetAudio(int v);
void AHXPlayer_PListCommandParse(int v, int FX, int FXParam);
void AHXPlayer_PlayIRQ(void);
void AHXPlayer_ProcessStep(int v);
void AHXPlayer_ProcessFrame(int v);
void AHXPlayer_SetBoost(int boostval);
void AHXPlayer_SetOversampling(int enable);

void AHXOutput_MixBuffer(short *target);

#endif /* __AHX_H__ */
3 changes: 2 additions & 1 deletion include/pkgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 74,7 @@ int pkgi_is_incomplete(const char* titleid);
int pkgi_is_installed(const char* titleid);
int pkgi_install(int iso_mode, int remove_pkg);

void pkgi_play_audio(void);
uint32_t pkgi_time_msec(void);

typedef void pkgi_thread_entry(void);
Expand Down Expand Up @@ -114,7 115,7 @@ void* pkgi_create(const char* path);
void* pkgi_open(const char* path);
// open file for writing, next write will append data to end of it
void* pkgi_append(const char* path);

// close file
void pkgi_close(void* f);

int pkgi_read(void* f, void* buffer, uint32_t size);
Expand Down
1 change: 1 addition & 0 deletions include/pkgi_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 92,7 @@ typedef struct Config {
uint8_t keep_pkg;
uint8_t allow_refresh;
uint8_t storage;
uint8_t audio_notification;
char language[3];
} Config;

Expand Down
Loading

0 comments on commit 8a569a6

Please sign in to comment.