Skip to content

Commit

Permalink
update releases.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
okyeron committed Sep 13, 2024
2 parents 2881e74 + 15578a1 commit 832063e
Show file tree
Hide file tree
Showing 37 changed files with 561 additions and 178 deletions.
46 changes: 30 additions & 16 deletions crone/src/Tape.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ namespace crone {
virtual // from any thread
void start() {
if (isRunning) {
std::cout << "Tape::SfStream::start(): already running" << std::endl;
return;
} else {
std::cout << "Tape::SfStream: starting..." << std::endl;
envIdx = 0;
envState = Starting;

this->th = std::make_unique<std::thread>(
[this]() {
this->diskLoop();
Expand Down Expand Up @@ -127,7 +130,7 @@ namespace crone {
envIdx = 0;
envState = Stopped;
shouldStop = true;
std::cerr << "Tape: fade-out finished; stopping" << std::endl;
std::cout << "Tape: fade-out finished; stopping" << std::endl;
}
}

Expand Down Expand Up @@ -164,7 +167,7 @@ namespace crone {

if (bytesToPush > bytesAvailable) {
#if 0
std::cerr << "Tape: writer overrun: "
std::cout << "Tape: writer overrun: "
<< bytesAvailable << " bytes available; "
<< bytesToPush << " bytes to push; "
<< numFramesCaptured << " frames captured"
Expand Down Expand Up @@ -229,7 +232,7 @@ namespace crone {

if (framesToWrite > (int) maxFramesToWrite) {
// _really_ shouldn't happen
std::cerr << "warning: Tape::Writer has too many frames to write" << std::endl;
std::cout << "warning: Tape::Writer has too many frames to write" << std::endl;
framesToWrite = (int) maxFramesToWrite;
}

Expand All @@ -243,22 +246,22 @@ namespace crone {
if (sf_writef_float(this->file, diskOutBuf, framesToWrite) != framesToWrite) {
char errstr[256];
sf_error_str(nullptr, errstr, sizeof(errstr) - 1);
std::cerr << "error: Tape::writer failed to write (libsndfile: " << errstr << ")" << std::endl;
std::cout << "error: Tape::writer failed to write (libsndfile: " << errstr << ")" << std::endl;
this->status = EIO;
break;
}

numFramesCaptured += framesToWrite;
if (numFramesCaptured >= maxFrames) {
std::cerr << "Tape: writer exceeded max frame count; aborting.";
std::cout << "Tape: writer exceeded max frame count; aborting.";
break;
}

}

std::cerr << "Tape::writer closing file...";
std::cout << "Tape::writer closing file...";
sf_close(this->file);
std::cerr << " done." << std::endl;
std::cout << " done." << std::endl;
SfStream::isRunning = false;
}

Expand All @@ -267,6 +270,13 @@ namespace crone {
size_t maxFrames = JACK_MAX_FRAMES, // <-- ridiculous big number
int sampleRate = 48000,
int bitDepth = 24) {

if (SfStream::isRunning) {
std::cout << "Tape Writer::open(): stream is running; no action was taken" << std::endl;
return false;
}


SF_INFO sf_info;
int short_mask;

Expand Down Expand Up @@ -295,7 +305,7 @@ namespace crone {
if ((this->file = sf_open(path.c_str(), SFM_WRITE, &sf_info)) == NULL) {
char errstr[256];
sf_error_str(nullptr, errstr, sizeof(errstr) - 1);
std::cerr << "cannot open sndfile" << path << " for output (" << errstr << ")" << std::endl;
std::cout << "cannot open sndfile" << path << " for output (" << errstr << ")" << std::endl;
return false;
}

Expand Down Expand Up @@ -337,6 +347,7 @@ namespace crone {
private:
// prime the ringbuffer
void prime() {
// std::cout << "priming tape reader" << std::endl;
jack_ringbuffer_t *rb = this->ringBuf.get();
size_t framesToRead = jack_ringbuffer_write_space(rb) / frameSize;
if (framesToRead > maxFramesToRead) { framesToRead = maxFramesToRead; };
Expand All @@ -347,7 +358,7 @@ namespace crone {

// couldn't read enough, file is shorter than the buffer
if (framesRead < framesToRead) {
std::cerr << "Tape::Reader: short file, disable loop" << std::endl;
std::cout << "Tape::Reader: short file, disable loop" << std::endl;
SfStream::shouldStop = false;
}
}
Expand Down Expand Up @@ -425,22 +436,26 @@ namespace crone {

// from any thread
bool open(const std::string &path) {
SF_INFO sfInfo;
if (SfStream::isRunning) {
std::cout << "Tape Reader::open(): stream is running; no action was taken" << std::endl;
return false;
}

SF_INFO sfInfo;
if ((this->file = sf_open(path.c_str(), SFM_READ, &sfInfo)) == NULL) {
char errstr[256];
sf_error_str(0, errstr, sizeof(errstr) - 1);
std::cerr << "Tape Reader:: cannot open sndfile" << path << " for output (" << errstr << ")" << std::endl;
std::cout << "Tape Reader:: cannot open sndfile" << path << " for output (" << errstr << ")" << std::endl;
return false;
}

if (sfInfo.frames < 1) {

std::cerr << "Tape Reader:: error reading file " << path << " (no frames available)" << std::endl;
std::cout << "Tape Reader:: error reading file " << path << " (no frames available)" << std::endl;
return false;
}
this->frames = static_cast<size_t>(sfInfo.frames);
std::cerr << "Tape Reader:: file size " << this->frames << " samples" << std::endl;
std::cout << "Tape Reader:: file size " << this->frames << " samples" << std::endl;
inChannels = sfInfo.channels;
if (inChannels > NumChannels)
return 0;//more than stereo is going to break things
Expand Down Expand Up @@ -498,12 +513,13 @@ namespace crone {
if (loopFile) {
// couldn't perform full read so must be end of file. Seek to start of file and keep reading
while (framesRead < framesToRead) {
// std::cout << "tape reader: couldn't perform full read; looping file..." << std::endl;
sf_seek(this->file,0, SEEK_SET);
auto nextRead = (size_t) sf_readf_float(this->file, diskBufPtr, framesToRead-framesRead);
if (nextRead < 1)
{
//Shouldn't happen
std::cerr << "Tape::Reader: unable to read file" << std::endl;
std::cout << "Tape::Reader: unable to read file" << std::endl;
SfStream::shouldStop = true;
break;
}
Expand All @@ -514,7 +530,6 @@ namespace crone {
}
}
else {
std::cerr << "Tape::Reader::diskloop() reached EOF" << std::endl;
SfStream::shouldStop = true;
}

Expand All @@ -525,7 +540,6 @@ namespace crone {

}
sf_close(this->file);
std::cerr << "Tape::reader closed file" << std::endl;
}

}; // Reader class
Expand Down
3 changes: 2 additions & 1 deletion doc/modules/screen.html
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ <h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
font face (see list, or Screen.font_face_names)
<p> 1 04B_03 (norns default)
<p> 1 norns (default)
2 ALEPH
3 Roboto Thin
4 Roboto Light
Expand Down Expand Up @@ -1064,6 +1064,7 @@ <h3>Parameters:</h3>
65 unscii-8.pcf
66 unscii-8-tall.pcf
67 unscii-8-thin.pcf
68 Particle
</li>
</ul>

Expand Down
18 changes: 16 additions & 2 deletions lua/core/clock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ end

function clock.add_params()
local send_midi_clock = {}
params:add_group("CLOCK", 27)
params:add_group("CLOCK", 29)

params:add_option("clock_source", "source", {"internal", "midi", "link", "crow"},
norns.state.clock.source)
Expand Down Expand Up @@ -275,6 +275,20 @@ function clock.add_params()
end
params:set_save("clock_midi_out_"..i, false)
end

params:add_separator("midi_clock_in_separator", "midi clock in")
local midi_clock_in_options = { "all", "none"}
for i=1,16 do
table.insert(midi_clock_in_options, tostring(i))
end
params:add_option("clock_midi_in", "midi clock in",
midi_clock_in_options, norns.state.clock.midi_in)
params:set_action("clock_midi_in", function(x)
norns.state.clock.midi_in = x
midi.update_clock_receive()
end)
params:set_save("clock_midi_in", false)

params:add_separator("crow_clock_separator", "crow")
params:add_option("clock_crow_out", "crow out",
{"off", "output 1", "output 2", "output 3", "output 4"}, norns.state.clock.crow_out)
Expand Down Expand Up @@ -375,4 +389,4 @@ end
--------------------------------------------------------------------------------
]]

return clock
return clock
25 changes: 20 additions & 5 deletions lua/core/encoders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,44 @@ end

--- process delta
encoders.process = function(n,d)
encoders.tick[n] = encoders.tick[n] + d
if encoders.accel[n] then
local s = d<0 and -1 or 1
d = s * math.pow(math.abs(d),1.6)
end
if math.abs(encoders.tick[n]) >= encoders.sens[n] then
local val = encoders.tick[n] / encoders.sens[n]
val = (val > 0) and math.floor(val) or math.ceil(val)
encoders.callback(n,val)
encoders.tick[n] = math.fmod(encoders.tick[n],encoders.sens[n])
screen.ping()
end
end

--- process delta, selected if _norns.adc_rev() == 0 in norns.lua
encoders.process_with_accel = function(n,d)
now = util.time()
local diff = now - encoders.time[n]
encoders.time[n] = now

if encoders.accel[n] then
if diff < 0.005 then d = d*6
elseif diff < 0.01 then d = d*4
elseif diff < 0.02 then d = d*3
elseif diff < 0.03 then d = d*2
end
end

encoders.tick[n] = encoders.tick[n] + d

if math.abs(encoders.tick[n]) >= encoders.sens[n] then
local val = math.floor(encoders.tick[n] / encoders.sens[n])
local val = encoders.tick[n] / encoders.sens[n]
val = (val > 0) and math.floor(val) or math.ceil(val)
encoders.callback(n,val)
encoders.tick[n] = 0
encoders.tick[n] = math.fmod(encoders.tick[n],encoders.sens[n])
screen.ping()
end
end



-- script state

local accel = {true,true,true,true}
Expand Down
12 changes: 6 additions & 6 deletions lua/core/grid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ grid.connect( port ) create a grid table using device [port]
this should be redefined by the script
.tilt( x, y, z ) function called with incoming grid tilt event
this should be redefined by the script
.led( x, y, level ) set LED at [x,y] to [level]
:led( x, y, level ) set LED at [x,y] to [level]
[level] range is 0..15
.all( level ) set all grid LED to [level]
:all( level ) set all grid LED to [level]
[level] range is 0..15
.refresh() update the grid LED state
:refresh() update the grid LED state
--------------------------------------------------------------------------------
-- example
Expand All @@ -274,9 +274,9 @@ end
-- simple draw function
draw_grid()
g.all(0)
g.led(lx,ly,lz)
g.refresh()
g:all(0)
g:led(lx,ly,lz)
g:refresh()
end
--------------------------------------------------------------------------------
]]
Expand Down
2 changes: 1 addition & 1 deletion lua/core/keyboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function keyboard.process(type,code,value)
if c == nil then
return
end

screen.ping()
-- textentry keycode
if te_kbd_cb.code then
te_kbd_cb.code(c,value)
Expand Down
4 changes: 2 additions & 2 deletions lua/core/menu.lua
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _menu.errormsg = ""
_menu.shownav = false
_menu.showstats = false
_menu.previewfile = ""
_menu.binarystates = {triggered = {}, on = {}}

-- menu pages
local m = {}
Expand Down Expand Up @@ -166,7 +167,7 @@ _menu.set_mode = function(mode)
norns.encoders.callback = enc
norns.enc.resume()
redraw()
elseif mode == true then -- ACTIVATE MENu MODE
elseif mode == true then -- ACTIVATE MENU MODE
if _menu.mode == false then _norns.screen_save() end
_menu.mode = true
_menu.alt = false
Expand Down Expand Up @@ -344,4 +345,3 @@ m["SLEEP"] = require 'core/menu/sleep'
m["MIX"] = require 'core/menu/mix'
m["TAPE"] = require 'core/menu/tape'
m["MODS"] = require 'core/menu/mods'
m["LOG"] = require 'core/menu/log'
30 changes: 0 additions & 30 deletions lua/core/menu/log.lua

This file was deleted.

1 change: 1 addition & 0 deletions lua/core/menu/mix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ m.init = function()
m.out2 = 0
norns.encoders.set_accel(2,true)
norns.encoders.set_sens(2,1)
norns.encoders.set_accel(3,true)
norns.encoders.set_sens(3,1)
end

Expand Down
Loading

0 comments on commit 832063e

Please sign in to comment.