Skip to content

Commit

Permalink
Added support for Ben Daglish modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
neumatho committed Dec 26, 2024
1 parent 21b3672 commit 4465a4d
Show file tree
Hide file tree
Showing 23 changed files with 3,222 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/features.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<tr><td>
<span>
<ul>
<li>Supports 177 different types of modules (and increasing).</li>
<li>Supports 178 different types of modules (and increasing).</li>
<li>One of the most accurate players in the world: plays modules like nature intended.</li>
<li>Fast and optimized.</li>
<li>Edit and save your favorite lists of modules.</li>
Expand Down
3 changes: 3 additions & 0 deletions Documentation/images/editors/bendaglish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Documentation/images/editors/bendaglish_t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Documentation/moduletypes.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,20 @@
</span>
</td>
</tr>
<tr name="B" style="display:none;">
<td>
<a href="images/editors/bendaglish.png" data-lightbox="image-bendaglish"><img src="images/editors/bendaglish_t.png"/></a>
</td>
<td>
<span>
<p><b><i>Ben Daglish</i></b> - This format is not a standard file format like other modules. The music data are embedded into an assembler player, so the whole module file contains both the player and music. This player can recognize all the different versions of Ben Daglishs player and extract the data and play them back.</p>
<p class="first"><b>File extension</b></p>
<p>.bd</p>
<p><b>Player</b></p>
<p>Ben Daglish</p>
</span>
</td>
</tr>
<tr name="B" style="display:none;">
<td>
<a href="images/editors/benreplay.png" data-lightbox="image-benreplay"><img src="images/editors/benreplay_t.png"/></a>
Expand Down
123 changes: 123 additions & 0 deletions Format_Descriptions/Ben Daglish.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
VoicePlaybackInfo

0 2 DMA bit
2 2 Interrupt bit
4 2 Hardware register offset
6 2 Delay counter for when to set loop
8 2 Note period
A 2 Portamento add value
C 2 Final volume
E 2 Final volume slide speed
10 2 Final volume slide increment value
12 2 Final volume slide speed counter
14 2 Ticks to play sample
16 2 Instrument portamento duration
18 2 Instrument portamento increment value
1A 2 Instrument vibrato depth
1C 2 Instrument period add value
1E 2 Instrument vibrato increment value
20 4 Pointer to code to set e.g. sample loop
24 4 Pointer to instrument info


VoiceInfo

0 2 This voice index into instrument mapping table. Are initialized with these values: 0, 8, 10, 18
2 4 Pointer to next byte in position list
6 4 Pointer to start of track data
A 4 Pointer to next byte in track data
E 4 Pointer to instrument info
12 1 Track loop counter
13 1 Transpose
14 1 If true, switch to next position or repeat track
15 1 Ticks left before reading next track command
16 1 Channel is enabled
17 1 Transposed note
18 1 Use new note

1A 4 Pointer to instrument info
1E 1 Previous transposed note
1F 1 Portamento 1 enabled
20 1 Portamento start delay
21 1 Portamento duration
22 1 Portamento delta node number
23 1 Portamento control flag
24 1 Portamento start delay counter
25 1 Portamento duration counter
26 4 Portamento value to add to playing period
2A 1 Portamento 2 enabled
2B 1 Volume fade enabled
2C 1 Volume fade init speed
2D 1 Volume fade duration
2E 2 Volume fade add value
30 1 Volume fade running
31 1 Volume fade speed
32 1 Volume fade speed counter
33 1 Volume fade duration counter
34 2 Volume fade increment value
36 2 Volume fade value
38 2 Channel volume
3A 2 Channel volume slide speed
3C 2 Channel volume slide increment value
3E 1 Control flag start value
3F
46 1 Control flag


When playing a note, the player uses an instrument number set on the channel.
This number is between 0 and 7. This number is then used to lookup in a
mapping table to find the sample number to use. This mapping table is
initialized to use the first 8 samples.


Position list

V1 player:

00-7F = Track number
80-BF = Loop track by <effect> & 1F
C0-C7 xx = Update instrument mapping table at index <effect> & 7 to sample xx
FE xx = Transpose
FF = End of position list

V2 player:

00-C7 = Track number
C8-EF = Loop track by <effect> & 1F
F0-F7 xx = Update instrument mapping table at index <effect> - F0 to sample xx
FD xx = Start master volume fade. xx = fade speed
FE xx = Transpose
FF = End of position list


Track data

00-7E xx yy = Note. xx is how many ticks to wait until reading next track command. yy is only available on some players and only if xx = 0. yy is the same as xx, but the behaviour of SetupSample() changes
7F xx = Wait. xx is how many ticks to wait until reading next track command
80-88 = Use instrument by <effect> & 7
89-BF = Set flag by <effect> & F
C0 xx yy zz = Portamento 1. xx = start delay, yy = duration, zz = delta number of nodes
C1 = Stop portamento 1
C2 xx yy zz = Volume fade. xx = speed, yy = duration, zz = increment value
C3 = Stop volume fade
C4 xx = Portamento 2. xx = duration
C5 = Stop portamento 2
C6 xx yy zz = Global volume slide. xx = start value, yy = speed, zz = increment value
C7 = Stop global volume slide
FF = End of track data


Instrument info:

0 4 Offset to sample data
4 4 Offset to sample data where loop starts
8 2 Length in words (one shot)
A 2 Length of loop in words
C 2 Volume
E 2 Volume fade speed
10 2 Portamento duration
12 2 Portamento increment value
14 2 Vibrato depth
16 2 Vibrato increment value
18 2 Note transpose
1A 2 Fine tune Period
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Modules in all supported formats can be found on my homepage at https://nostalgi
| Asylum Music Format | .amf | | Xmp |
| Audio Sculpture | .adsc | | ModTracker |
| AudioIFF | .aiff / .aif | | Sample |
| Ben Daglish | .bd | | Ben Daglish |
| Ben Replay | .ben | ProWizard | ModTracker |
| Binary Packer | .bnr | ProWizard | ModTracker |
| Channel Player 1 | .ch1 / .chn / .chan | ProWizard | ModTracker |
Expand Down
66 changes: 66 additions & 0 deletions Source/Agents/Players/BenDaglish/BenDaglish.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/******************************************************************************/
/* This source, or parts thereof, may be used in any software as long the */
/* license of NostalgicPlayer is keep. See the LICENSE file for more */
/* information. */
/******************************************************************************/
using System;
using System.Runtime.InteropServices;
using Polycode.NostalgicPlayer.Kit.Bases;
using Polycode.NostalgicPlayer.Kit.Containers;
using Polycode.NostalgicPlayer.Kit.Interfaces;

// This is needed to uniquely identify this agent
[assembly: Guid("63EF8780-B326-4224-8216-F9EEE26C07A4")]

namespace Polycode.NostalgicPlayer.Agent.Player.BenDaglish
{
/// <summary>
/// NostalgicPlayer agent interface implementation
/// </summary>
public class BenDaglish : AgentBase
{
private static readonly Guid Agent1Id = Guid.Parse("CE362B0B-D910-4EAD-974E-A28D047EADDB");

#region IAgent implementation
/********************************************************************/
/// <summary>
/// Returns the name of this agent
/// </summary>
/********************************************************************/
public override string Name => Resources.IDS_BD_NAME;



/********************************************************************/
/// <summary>
/// Returns a description of this agent
/// </summary>
/********************************************************************/
public override string Description => Resources.IDS_BD_DESCRIPTION;



/********************************************************************/
/// <summary>
/// Returns all the formats/types this agent supports
/// </summary>
/********************************************************************/
public override AgentSupportInfo[] AgentInformation =>
[
new AgentSupportInfo(Resources.IDS_BD_NAME_AGENT1, Resources.IDS_BD_DESCRIPTION_AGENT1, Agent1Id)
];



/********************************************************************/
/// <summary>
/// Creates a new worker instance
/// </summary>
/********************************************************************/
public override IAgentWorker CreateInstance(Guid typeId)
{
return new BenDaglishWorker();
}
#endregion
}
}
46 changes: 46 additions & 0 deletions Source/Agents/Players/BenDaglish/BenDaglish.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Polycode.NostalgicPlayer.Agent.Player.BenDaglish</RootNamespace>
<Authors>Thomas Neumann</Authors>
<Company>Polycode</Company>
<Product>NostalgicPlayer</Product>
<Description>Plays modules created by Ben Daglish</Description>
<Version>2.1.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\BenDaglish.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\BenDaglish.xml</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<WarningsAsErrors />
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\NostalgicPlayerKit\NostalgicPlayerKit.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
Loading

0 comments on commit 4465a4d

Please sign in to comment.