Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e59730fbbff8
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1048640e6403
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Apr 3, 2019

  1. applet.audio.yamaha_opl: disable recording after playback is done.

    This was formerly hacked off because of the issues with pipelining
    (most likely the start command arriving at an inappropriate time,
    but possibly something else), and it is no longer necessary after
    commit e59730f.
    whitequark committed Apr 3, 2019
    Copy the full SHA
    1048640 View commit details
Showing with 6 additions and 5 deletions.
  1. +6 −5 software/glasgow/applet/audio/yamaha_opl/__init__.py
11 changes: 6 additions & 5 deletions software/glasgow/applet/audio/yamaha_opl/__init__.py
Original file line number Diff line number Diff line change
@@ -381,10 +381,12 @@ async def _reset_registers(self):
async def enable(self):
self._log("enable")
await self.lower.write([OP_ENABLE|1])
# Wait until the commands start arriving before flushing the enable command.

async def disable(self):
self._log("disable")
await self.lower.write([OP_ENABLE|0])
await self.lower.flush()

def _enable_level(self, feature_level):
if self._feature_level < feature_level:
@@ -507,13 +509,12 @@ def __init__(self, reader, opx_iface, clock_rate):
self.clock_rate = clock_rate
self.sample_time = opx_iface.sample_clocks / self.clock_rate

async def play(self, disable=True):
async def play(self):
try:
await self._opx_iface.enable()
await self._reader.parse_data(self)
finally:
if disable:
await self._opx_iface.disable()
await self._opx_iface.disable()

async def record(self, queue, chunk_count=8192):
total_count = int(self._reader.total_seconds / self.sample_time)
@@ -642,7 +643,7 @@ async def serve_vgm(self, request):
resample_queue = asyncio.Queue()
resample_fut = asyncio.ensure_future(resample(input_queue, resample_queue))
record_fut = asyncio.ensure_future(vgm_player.record(input_queue))
play_fut = asyncio.ensure_future(vgm_player.play(disable=False))
play_fut = asyncio.ensure_future(vgm_player.play())

try:
response = web.StreamResponse()
@@ -845,7 +846,7 @@ async def write_pcm(input_queue):
args.pcm_file.write(input_chunk)

input_queue = asyncio.Queue()
play_fut = asyncio.ensure_future(vgm_player.play(disable=False))
play_fut = asyncio.ensure_future(vgm_player.play())
record_fut = asyncio.ensure_future(vgm_player.record(input_queue))
write_fut = asyncio.ensure_future(write_pcm(input_queue))
done, pending = await asyncio.wait([play_fut, record_fut, write_fut],