Skip to content

Adding a layout for Ensoniq ESQ-1. #14049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

felipesanches
Copy link
Contributor

  • It can play notes by clicking on the keyboard.
  • Volume and Data Entry sliders are hooked up via Lua scripting.
  • Volume slider still non-functional. Data Entry slider works fine.
  • SVG snippets were kept to the absolute minimum (drawings of envelope and oscillators diagrams)
  • The full unit was drawn, but only the relevant part is visible on the default layout. We may later add other views such as "Full keyboard".

Before

Screenshot From 2025-08-12 19-01-09

After

Screenshot From 2025-08-12 18-53-10

- It can play notes by clicking on the keyboard.
- Volume and Data Entry sliders are hooked up via Lua scripting.
- Volume slider still non-functional. Data Entry slider works fine.
- SVG snippets were kept to the absolute minimum (drawings of envelope and oscillators diagrams)
- The full unit was drawn, but only the relevant part is visible on the
  default layout. We may later add other views such as "Full keyboard".
@felipesanches felipesanches force-pushed the add_ensoniq_esq1_internal_layout branch from bbc2f15 to b437c74 Compare August 13, 2025 08:15
@felipesanches
Copy link
Contributor Author

The octaves are wrong! I'll reassign the midi note values to fit the correct range.

Comment on lines +63 to +89
<element name="white_rect">
<rect><color red="0.83" green="0.86" blue="0.83" /></rect>
</element>

<element name="grey_rect">
<rect><color red="0.2" green="0.2" blue="0.2" /></rect>
</element>

<element name="dark_grey_rect">
<rect><color red="0.13" green="0.13" blue="0.15" /></rect>
</element>

<element name="panel_sheet">
<rect><color red="0.17" green="0.17" blue="0.18"/></rect>
</element>

<element name="screen_border">
<rect><color red="0.05" green="0.05" blue="0.05"/></rect>
</element>

<element name="invisible-rect">
<rect><color red="0" green="0" blue="0" alpha="0"/></rect>
</element>

<element name="black-rect">
<rect><color red="0.0" green="0.0" blue="0.0"/></rect>
</element>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should avoid making separate elements for things that are the same thing in different colours. It’s more efficient to use a single white rectangle and colour it when instantiating it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainability over efficiency here, I'd say.

<element ref="descriptive_rect"><bounds x="0" y="0" width="10" height="10" /></element>
<element ref="rect"><bounds x="0" y="0" width="10" height="10" /><color red="0" green="0" blue="0" /></element> <!-- repeated hardcoded color everywhere this color rect is used -->

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, my rationale was exactly what @happppp described here. The handling of colors in the .lay schema is quite insane. In the near future I'd like to propose improvements for a version 3 with better ways to author layouts and better color declarations are one of the things I would include.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cuavas, what do you think?

Comment on lines +117 to +131
<element ref="white_rect"><bounds x="0" y="20" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="0" y="29" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="0" y="38" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="0" y="47" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="0" y="56" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="0" y="65" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="0" y="74" width="9" height="1"/></element>

<element ref="white_rect"><bounds x="38" y="20" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="38" y="29" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="38" y="38" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="38" y="47" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="39" y="56" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="38" y="65" width="9" height="1"/></element>
<element ref="white_rect"><bounds x="38" y="74" width="9" height="1"/></element>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn’t a good idea – each of these will be composited as an additional textured quad. It’s a lot more efficient to make a single element to represent these tick marks so it’s composited as a single textured quad for all of them. In fact, you should put as much of the slider as you can in a single element to reduce the amount of geometry you’re pushing around.

Remember MAME still thinks immediate mode is cool, so this overhead adds up quickly.

Copy link
Contributor Author

@felipesanches felipesanches Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using <repeat> here help? Or would it still be the same issue?

Remember MAME still thinks immediate mode is cool, so this overhead adds up quickly.

Maybe it is clear to you because you know about some internal implementation detail, but I fail to comprehend the meaning of this sentence. What is the thing you refer to when you use this "immediate mode" expression?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me take the opportunity to mention that I think sliders should be supported natively by the layout system. The current approach of building our own slider all the time by copy-pasting the same lua script everywhere we need it is a mess. It is very error prone and it is not a joy for layout authors.

This demonstrates that there's a need for the feature. And also that it would be useful to have a way to include external scripts and then we could maintain a small library of useful reusable things (like the slider script and also external assets such as SVG files - as described by @rb6502 and others at #12735 (comment)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Believe us, we know. It is, as is often the case, more complicated that it should be to add.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some time ago, I sent a proposal for how to share slider functionality (#13414), based on @galibert 's suggestion here. At the time, it was deemed better to just copy-and-pate, since the proposal was not compatible with the future plans for layouts.

This is up to the MAME team. But if there is appetite to revisit the approach above, since the number of layouts with sliders has increased, or if there are suggestions for how to make the proposal "less incompatible" with the future, let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, "immediate mode" means you generate draw commands and send them to the GPU naively as you go. This is bad among other reasons because you're potentially incurring DMA setup and teardown time for each command instead of just having it all-at-once. The alternative is "retained mode" where the commands are put into a scene graph and the CPU does a pass to generate an optimized display list from the results.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, "immediate mode" means

Thanks for the clarification!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn’t a good idea – each of these will be composited as an additional textured quad. It’s a lot more efficient to make a single element to represent these tick marks so it’s composited as a single textured quad for all of them. In fact, you should put as much of the slider as you can in a single element to reduce the amount of geometry you’re pushing around.

Remember MAME still thinks immediate mode is cool, so this overhead adds up quickly.

@cuavas, I understand that you are worried about hypothetical performance issues, but how would you measure it? Do you have suggestions for any profiling / performance measurement tool that could give us a concrete evidence of this specific snippet in the ESQ1 layout causing performance issues?

I have run the driver with the layout as described in the PR and I do not perceive (subjectively) any performance issue.

There are roughly a bit more than 300 elements in this layout. Why would these elements from the slider be more problematic than all the other ones?

Also, the layout in this PR makes the driver extremely more useful than it is in its current state at git master. In my opinion, its usefulness outweighs any hypothetical performance concerns. Especially when such performance issue seems to not even be measurable.

Comment on lines 152 to 154
<!-- TODO: SVG images for the logos
<element name="ensoniq_logo"><text string="ensoniq"><color red="0.83" green="0.86" blue="0.83" /></text></element>
-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You aren’t going to be able to do this with reasonably human-readable SVG. It’s not going to go in an internal layout. There’s no point having a TODO for it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trademark issue anyway if MAME adds it in the source, and claims CC0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. But could we leave the comment as a tip to external layout authors?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of the Ensoniq wordmark from this era expired long ago. Creative has kept a different Ensoniq wordmark active (last renewed 2016), but it's visually different and the last Ensoniq branded anything was 2002. So I'm not worried about trademark here.

That said, the human-readable SVG thing is real, so this isn't a TODO. I don't have an issue with it being a comment, just having it marked TODO, which has a specific meaning in MAME.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. The TODO is not there anymore. It was removed on an amended commit pushed here a couple days ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of the Ensoniq wordmark from this era expired long ago. Creative has kept a different Ensoniq wordmark active (last renewed 2016), but it's visually different and the last Ensoniq branded anything was 2002. So I'm not worried about trademark here.

That said, the human-readable SVG thing is real, so this isn't a TODO. I don't have an issue with it being a comment, just having it marked TODO, which has a specific meaning in MAME.

Well... I think I can make it fairly readable:

<svg width="286" height="70">
	<g fill="#e2dbce" stroke="none">
		<!-- E -->
		<path d="
			M 0,0 v 20 h 67 v -20 Z
			m 0,25 v 20 h 67 v -20 z
			m 0,25 v 20 h 67 v -20 z"/>

		<!-- S -->
		<path d="
			M 76,0
			v  45 h  47 v  5 h -47 v  20 h 67
			v -45 h -47 v -5 h  47 v -20 Z" />

		<!-- Q -->
		<path d="
			M 152,0
			v 70 h 86 v -20 h -19 V 0 Z
			m 20,20 h 27 v 30 h -27 z" />

		<!-- 1 -->
		<path d="
			M 266,0
			l -12,20 h 12 v 50 h 20 V 0 Z" />
	</g>
	
	<!-- The triangle -->
	<path
		fill="#36dbe9" stroke="none"
		d="m 222,0 h 39 l -19.5,32.5 z"/>
</svg>
Screenshot From 2025-08-15 15-33-11

@felipesanches
Copy link
Contributor Author

There are a few questions that I left for @cuavas above and I may address them when I get an answer, but I consider that I have put my best effort here and that this PR is ready for a final review & merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants