Skip to content

Commit

Permalink
Playtime: Make pre-buffer be able to deal with time base "time"
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Nov 2, 2023
1 parent c2db1a2 commit d545b77
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
16 changes: 8 additions & 8 deletions allocator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ impl<I, D> HelgobossAllocator<I, D> {
let permit_count = ALLOC_PERMIT_COUNT.with(|p| p.get());
if forbid_count > 0 && permit_count == 0 {
// Comment out if you want to ignore it TODO-high
// permit_alloc(|| {
// eprintln!(
// "Memory allocation of {} bytes failed from:\n{:?}",
// layout.size(),
// backtrace::Backtrace::new()
// );
// });
permit_alloc(|| {
eprintln!(
"Memory allocation of {} bytes failed from:\n{:?}",
layout.size(),
backtrace::Backtrace::new()
);
});
// Comment out if you don't want to abort
std::alloc::handle_alloc_error(layout);
// std::alloc::handle_alloc_error(layout);
}
}
}
Expand Down
21 changes: 20 additions & 1 deletion playtime-api/src/persistence/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,17 @@ pub enum ClipTimeBase {
Beat(BeatTimeBase),
}

#[derive(Copy, Clone, PartialEq, Debug, Serialize, Deserialize, JsonSchema)]
impl ClipTimeBase {
pub fn is_time_based(&self) -> bool {
matches!(self, Self::Time)
}

pub fn is_beat_based(&self) -> bool {
matches!(self, Self::Beat(_))
}
}

#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema)]
pub struct BeatTimeBase {
#[deprecated(note = "moved to ClipAudioSettings#original_tempo")]
#[serde(skip_serializing)]
Expand Down Expand Up @@ -1304,6 +1314,15 @@ pub struct TimeSignature {
pub denominator: u32,
}

impl Default for TimeSignature {
fn default() -> Self {
Self {
numerator: 4,
denominator: 4,
}
}
}

#[derive(Clone, Eq, PartialEq, Debug, Serialize, Deserialize, JsonSchema)]
pub struct TrackId(String);

Expand Down

0 comments on commit d545b77

Please sign in to comment.