Skip to content

Commit

Permalink
include iir1 submodule.
Browse files Browse the repository at this point in the history
More fixes.
  • Loading branch information
MaddTheSane committed Oct 14, 2023
1 parent 7d1f54c commit 200ac54
Show file tree
Hide file tree
Showing 11 changed files with 364 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "DOSBox-Staging"]
path = DOSBox-Staging
url = https://github.com/MaddTheSane/dosbox-staging.git
[submodule "Vendor/iir1"]
path = Vendor/iir1
url = https://github.com/berndporr/iir1.git
329 changes: 326 additions & 3 deletions Boxer.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions Boxer/BXEmulator+BXAudio.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import "BXDrive.h"

#import <SDL2/SDL.h>
#include "cdrom.h"
#import "mixer.h"


Expand Down Expand Up @@ -178,43 +179,44 @@ void _renderMIDIOutput(Bitu numFrames)
{
//We need to look up the corresponding channel for this because DOSBox's
//mixer doesn't pass any context with its callbacks.
MixerChannel *channel = MIXER_FindChannel(BXMIDIChannelName);
mixer_channel_t channel = MIXER_FindChannel(BXMIDIChannelName);
if (channel) [[BXEmulator currentEmulator] _renderMIDIOutputToChannel: channel frames: numFrames];
}


- (MixerChannel *) _MIDIMixerChannel
- (mixer_channel_t) _MIDIMixerChannel
{
return MIXER_FindChannel(BXMIDIChannelName);
}

- (MixerChannel *) _addMIDIMixerChannelWithSampleRate: (NSUInteger)sampleRate
- (mixer_channel_t) _addMIDIMixerChannelWithSampleRate: (NSUInteger)sampleRate
{
MixerChannel *channel = [self _MIDIMixerChannel];
auto channel = [self _MIDIMixerChannel];

if (channel)
{
channel->SetFreq(sampleRate);
channel->SetSampleRate(sampleRate);
}
else
{
channel = MIXER_AddChannel(_renderMIDIOutput, sampleRate, BXMIDIChannelName);
std::set<ChannelFeature> features;
channel = MIXER_AddChannel(_renderMIDIOutput, sampleRate, BXMIDIChannelName, features);
}
channel->Enable(true);
return channel;
}

- (void) _removeMIDIMixerChannel
{
MixerChannel *channel = [self _MIDIMixerChannel];
auto channel = [self _MIDIMixerChannel];
if (channel)
{
channel->Enable(false);
MIXER_DelChannel(channel);
channel.reset();
}
}

- (void) _renderMIDIOutputToChannel: (MixerChannel *)channel frames: (NSUInteger)numFrames
- (void) _renderMIDIOutputToChannel: (std::shared_ptr<MixerChannel>)channel frames: (NSUInteger)numFrames
{
id <BXAudioSource> source = (id <BXAudioSource>)self.activeMIDIDevice;

Expand All @@ -224,7 +226,7 @@ - (void) _renderMIDIOutputToChannel: (MixerChannel *)channel frames: (NSUInteger
}

- (void) _renderOutputFromSource: (id <BXAudioSource>)source
toChannel: (MixerChannel *)channel
toChannel: (std::shared_ptr<MixerChannel>)channel
frames: (NSUInteger)numFrames
{
NSUInteger sampleRate = 0;
Expand All @@ -250,7 +252,7 @@ - (void) _renderOutputFromSource: (id <BXAudioSource>)source
}

- (void) _renderBuffer: (void *)buffer
toChannel: (MixerChannel *)channel
toChannel: (std::shared_ptr<MixerChannel>)channel
frames: (NSUInteger)numFrames
format: (BXAudioFormat)format
{
Expand Down
3 changes: 1 addition & 2 deletions Boxer/BXEmulator+BXDOSFileSystem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

//Defined in dos_files.cpp
extern DOS_File * Files[DOS_FILES];
extern DOS_Drive * Drives[DOS_DRIVES];

//Defined in dos_mscdex.cpp
void MSCDEX_SetCDInterface(int intNr, int forceCD);
Expand Down Expand Up @@ -1107,7 +1106,7 @@ - (DOS_Drive *) _floppyDriveFromImageAtPath: (NSString *)path
//If the path couldn't be encoded, don't attempt to go further
if (!drivePath) return nil;

fatDrive *drive = new fatDrive(drivePath, 0, 0, 0, 0, 0);
fatDrive *drive = new fatDrive(drivePath, 0, 0, 0, 0, 0, false);
if (!drive || !drive->created_successfully)
{
delete drive;
Expand Down
10 changes: 5 additions & 5 deletions Boxer/BXEmulatorPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,27 +640,27 @@ typedef NS_ERROR_ENUM(BXDOSBoxMountErrorDomain, BXDOSBoxMountErrors) {
- (void) _syncVolume;

/// Returns the DOSBox channel used for MIDI mixing, or @c NULL if none is necessary.
- (MixerChannel *) _MIDIMixerChannel;
- (std::shared_ptr<MixerChannel>) _MIDIMixerChannel;

/// Creates and returns a new DOSBox mixer channel for handling MIDI.
- (MixerChannel *) _addMIDIMixerChannelWithSampleRate: (NSUInteger)sampleRate;
- (std::shared_ptr<MixerChannel>) _addMIDIMixerChannelWithSampleRate: (NSUInteger)sampleRate;

/// Disables and removes the current MIDI mixer channel, if one exists.
- (void) _removeMIDIMixerChannel;

/// Renders the active MIDI device's MIDI output to the specified channel.
/// Will raise an assertion if the current MIDI source does not support mixing.
- (void) _renderMIDIOutputToChannel: (MixerChannel *)channel
- (void) _renderMIDIOutputToChannel: (std::shared_ptr<MixerChannel>)channel
frames: (NSUInteger)numFrames;

/// Render the specified number of output frames from the specified audio source to the specified output channel.
- (void) _renderOutputFromSource: (id <BXAudioSource>)source
toChannel: (MixerChannel *)channel
toChannel: (std::shared_ptr<MixerChannel>)channel
frames: (NSUInteger)numFrames;

/// Render the specified audio data buffer to the specified channel.
- (void) _renderBuffer: (void *)buffer
toChannel: (MixerChannel *)channel
toChannel: (std::shared_ptr<MixerChannel>)channel
frames: (NSUInteger)numFrames
format: (BXAudioFormat)format;
@end
Expand Down
2 changes: 1 addition & 1 deletion Boxer/BXMIDIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void init_mt32_dosbox_settings(Section_prop &sec_prop)
Pint->Set_help("MT-32 reverb level");
}

void BXMIDIMT32_AddConfigSection(Config *conf)
void BXMIDIMT32_AddConfigSection(const std::unique_ptr<Config> &conf)
{
assert(conf);
Section_prop *sec_prop = conf->AddSection_prop("mt32", &mt32_init);
Expand Down
2 changes: 1 addition & 1 deletion Boxer/BXMIDIConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
#include "control.h"
#include "midi.h"

extern void BXMIDIMT32_AddConfigSection(Config *conf);
extern void BXMIDIMT32_AddConfigSection(const std::unique_ptr<Config> &conf);

#endif /* BXMIDIConfig_hpp */
6 changes: 6 additions & 0 deletions Boxer/Input/BXOutputBinding.mm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ - (void) applyNormalizedInputValue: (float)value
[self doesNotRecognizeSelector: _cmd];
}

// how did THIS happen!?
#ifndef MAX
#define __NSMAX_IMPL__(A,B,L) ({ __typeof__(A) __NSX_PASTE__(__a,L) = (A); __typeof__(B) __NSX_PASTE__(__b,L) = (B); (__NSX_PASTE__(__a,L) < __NSX_PASTE__(__b,L)) ? __NSX_PASTE__(__b,L) : __NSX_PASTE__(__a,L); })
#define MAX(A,B) __NSMAX_IMPL__(A,B,__COUNTER__)
#endif

- (float) normalizedValue: (float)value
{
value = MIN(value, kBXOutputBindingMax);
Expand Down
6 changes: 6 additions & 0 deletions Boxer/PrefixHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
#ifndef PrefixHeader_h
#define PrefixHeader_h

#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

#if __cplusplus
#include "dosbox.h"
//--Added 2010-05-30 by Alun Bestor to ensure sdlmain function calls are replaced throughout DOSBox
#ifndef NO_BXCOALFACE
#include "BXCoalface.h"
#endif
//--End of modifications
#endif

Expand Down
2 changes: 1 addition & 1 deletion DOSBox-Staging
1 change: 1 addition & 0 deletions Vendor/iir1
Submodule iir1 added at 379d69

0 comments on commit 200ac54

Please sign in to comment.